You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by xiaotebie July 5, 2023
Hello,
I am currently using LiveCharts2 in my WPF application and I have a question about setting a fixed number of x-axis labels.
In my application, I want to display a fixed number of labels on the x-axis, regardless of the number of data points in my series. For example, I want to display 10 labels on the x-axis, but I might only have 7 data points in my series.
I tried to set the Labels property of the Axis object to a string array of 10 elements, but it didn't work as expected. The x-axis still only showed labels for the 7 data points in my series, and it didn't display the remaining 3 labels.
Here is a snippet of my code:
public ISeries[] Series { get; set; } = new ISeries[]
{
new LineSeries<double>
{
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
Fill = null
}
};
public Axis[] XAxes { get; set; }
= new Axis[]
{
new Axis
{
Name = "X Axis",
NamePaint = new SolidColorPaint(SKColors.Black),
LabelsPaint = new SolidColorPaint(SKColors.Blue),
TextSize = 10,
Labels = new string[] { "1", "2", "3", "4" ,"5","6","7","8","9","10"},
SeparatorsPaint = new SolidColorPaint(SKColors.LightSlateGray) { StrokeThickness = 2 }
}
};
Is there a way to achieve this in LiveCharts2? Any help would be greatly appreciated.
Thank you in advance!
The text was updated successfully, but these errors were encountered:
This is a necessary, the library needs to provide a solution for this, I have seen a couple of similar issues related to this.
I transferred the discussion to an issue, so we can track the implementation of this.
Discussed in #1098
Originally posted by xiaotebie July 5, 2023
Hello,
I am currently using LiveCharts2 in my WPF application and I have a question about setting a fixed number of x-axis labels.
In my application, I want to display a fixed number of labels on the x-axis, regardless of the number of data points in my series. For example, I want to display 10 labels on the x-axis, but I might only have 7 data points in my series.
I tried to set the Labels property of the Axis object to a string array of 10 elements, but it didn't work as expected. The x-axis still only showed labels for the 7 data points in my series, and it didn't display the remaining 3 labels.
Here is a snippet of my code:
Is there a way to achieve this in LiveCharts2? Any help would be greatly appreciated.
Thank you in advance!
The text was updated successfully, but these errors were encountered: