Axis Titles are rendered late when using Segmented axes
Posted: Thu Feb 28, 2019 2:29 pm
I've been experimenting with using YAxesLayout.Segmented to handle certain of our use cases. With this axis layout, it seems that the Y axis title is rendered after the line series are plotted. This means for a few moments the chart shows the new data, then it applies the Y axis titles, causing things to resize. This is a pretty jarring experience. Is there something wrong with how I'm setting up my axis segments? Below is the code I used to create the attached screenshot
Code: Select all
private void Button_Click(object sender, RoutedEventArgs e)
{
try
{
this.chart.BeginUpdate();
this.chart.ViewXY.YAxes.Clear();
this.chart.ViewXY.PointLineSeries.Clear();
this.chart.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Segmented;
this.chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.AllLeft;
this.chart.ViewXY.AxisLayout.Segments.Clear();
this.chart.ViewXY.AxisLayout.Segments.Add(new YAxisSegment(this.chart));
this.chart.ViewXY.AxisLayout.Segments.Add(new YAxisSegment(this.chart));
for (int i = 0; i < 2; i++)
{
AxisY axis = new AxisY(this.chart.ViewXY);
axis.SegmentIndex = i;
PointLineSeries pointLineSeries = new PointLineSeries(this.chart.ViewXY, this.chart.ViewXY.XAxes.First(), axis);
IEnumerable<double> data = Enumerable.Range(0, 1000).Select((num) => (double)num);
pointLineSeries.SetValues(data.ToArray(), data.ToArray());
this.chart.ViewXY.YAxes.Add(axis);
this.chart.ViewXY.PointLineSeries.Add(pointLineSeries);
}
}
finally
{
this.chart.EndUpdate();
}
}