Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPF: Inverting axis does not work as expected #1473

Open
network-interface-controller opened this issue Mar 28, 2024 · 0 comments
Open

WPF: Inverting axis does not work as expected #1473

network-interface-controller opened this issue Mar 28, 2024 · 0 comments

Comments

@network-interface-controller

Describe the bug
I have a chart with a row series as illustrated below and want to change the direction of the x-axis (horizontal) to mirror it, i.e. the x-axis starts on the right at 0 and the rows are drawn to the left.
grafik

However, if I set the x-axis to inverted (and remove the MinLimit of 0) a strange effect occurs and the bars behave totally unpredictable:
grafik

public List<ISeries> Series
{
    get
    {
        ... [calculations]...

        List<ISeries> rowSeries =
        [
            new RowSeries<int>
            {
                Values = myValues,
                Fill = new SolidColorPaint(ChartColors.DodgerBlue),
                DataLabelsPaint = new SolidColorPaint { ... },
                DataLabelsSize = 20,
                DataLabelsPosition = DataLabelsPosition.End,
                DataLabelsFormatter = (chartPoint) => $"{chartPoint.Coordinate.PrimaryValue}",
                XToolTipLabelFormatter = (chartPoint) => $"..."
            }
        ];

        return rowSeries;
    }
}

public static Axis[] XAxesValues =>
[
    new Axis
    {
        MinLimit = 0,
        LabelsPaint = Configuration.StandardLabelsPaint
    }
];

public Axis[] YAxesValues =>
[
    new Axis
    {
        Labels = myLabels,
        LabelsPaint = Configuration.StandardLabelsPaint,
        ShowSeparatorLines = false,
        ForceStepToMin = true,
        Padding = new Padding(0, 0, 25, 0)
    }
];

To Reproduce
Steps to reproduce the behavior:

  1. Create a row series as explained above
  2. Set the x-axis to inverted
public static Axis[] XAxesValues =>
[
    new Axis
    {
        IsInverted = true,
        LabelsPaint = Configuration.StandardLabelsPaint
    }
];

Expected behavior
Something similar to this:
grafik

Desktop (please complete the following information):
OS: Windows 10, Version 22H2
Browser --> Not applicable; WPF app
Version: LiveChartsCore 2.0.0-rc2, LiveChartsCore.SkiaSharpView.WPF 2.0.0-rc2
Framework: .NET 8.0

@network-interface-controller network-interface-controller changed the title Inverting axis does not work as expected WPF: Inverting axis does not work as expected Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant