Hi,
In my chart I have used ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Segmented to draw 5 plots like on Capture1.
But when I try to resize chart to a smaller size, it seems like all plots and legends merges into one segment (see Capture2).
But when I draw chart with the same smaller size in YAxesLayout.Stacked, segments just overlap and don't merge
Could you please help me to allow segments to overlap but not to leave only one segment?
Plots Overlapping with Segmented layout
Moderator: Queue Moderators
-
- Posts: 141
- Joined: Wed Mar 27, 2019 1:05 pm
Re: Plots Overlapping with Segmented layout
Hello,
The segments automatically merge if the chart sees that there isn't enough space to draw them. This behaviour cannot be completely disabled. However there are several properties in AxisLayout, which you can try to control segments and any Y-axis belonging to them.
Of these SegmentsGap seems to have most impact on this issue. With SegmentsGap value 0 or 1, there pretty much is no merging happening. The problem in this case is that the axis values labels (-2 and 2) overlap each other even with larger chart sizes. Therefore it might be a good idea to change SegmentsGap dynamically via an event for instance.
In the example above, SegmentsGap is modified every time the height of the chart goes above or below 200.
Hope this is helpful.
Best regards,
Lasse
The segments automatically merge if the chart sees that there isn't enough space to draw them. This behaviour cannot be completely disabled. However there are several properties in AxisLayout, which you can try to control segments and any Y-axis belonging to them.
Code: Select all
_chart.ViewXY.AxisLayout.AutoShrinkSegmentsGap = true;
_chart.ViewXY.AxisLayout.AutoAdjustMargins = false;
_chart.ViewXY.AxisLayout.AutoAdjustAxisGap = 10;
_chart.ViewXY.AxisLayout.SegmentsGap = 1;
_chart.ViewXY.AxisLayout.YAxisTitleAutoPlacement = false;
_chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.Off;
Code: Select all
_chart.SizeChanged += _chart_SizeChanged;
private void _chart_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (_chart.ViewXY.AxisLayout.SegmentsGap == 10 && e.NewSize.Height < 200)
{
_chart.ViewXY.AxisLayout.SegmentsGap = 1;
}
else if (_chart.ViewXY.AxisLayout.SegmentsGap == 1 && e.NewSize.Height > 200)
{
_chart.ViewXY.AxisLayout.SegmentsGap = 10;
}
}
Hope this is helpful.
Best regards,
Lasse
-
- Posts: 2
- Joined: Wed Jul 17, 2019 8:45 am
Re: Plots Overlapping with Segmented layout
Thank you so much, your suggestion helped me well.