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

Closed
network-interface-controller opened this issue Mar 28, 2024 · 1 comment · Fixed by #1664
Closed

WPF: Inverting axis does not work as expected #1473

network-interface-controller opened this issue Mar 28, 2024 · 1 comment · Fixed by #1664
Labels
priority 1 might not be fixed in the next release of the library, but it will soon! requires-attention
Milestone

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
@beto-rodriguez beto-rodriguez added requires-attention priority 1 might not be fixed in the next release of the library, but it will soon! labels Sep 13, 2024
@beto-rodriguez
Copy link
Owner

Fixed with the referenced PR and will be included in the next version of the library. Thanks for the report.

@beto-rodriguez beto-rodriguez added this to the rc-4 milestone Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority 1 might not be fixed in the next release of the library, but it will soon! requires-attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants