Graph area completely cleared with too many AxisY

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Queue Moderators

Post Reply
Energetic
Posts: 5
Joined: Wed Jun 03, 2020 10:56 am

Graph area completely cleared with too many AxisY

Post by Energetic » Fri Apr 30, 2021 11:57 am

Hello,
In our application users can add multiple additional AxisY to a ViewXY in a chart, however if the axes are too many compared to the size of the chart, the graph area gets completely cleared: one can see neither any axes, nor plots. Is there a way to detect with some event when this condition occures, so that I can at least give a message to the user to disable some of the axes. (It can be particularly confusing when the users loads multiple new data sources at once and cannot see that the area is gradually getting smaller before everything disaperas). I just updated to lightningchat 10.0.1.

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Graph area completely cleared with too many AxisY

Post by ArctionKestutis » Fri Apr 30, 2021 1:50 pm

In the next release it will be such event/message, which informs about problem. Even more - something still should be rendered automatically, even if there is not enough space to fit it all.
As for now, you should check Chart size and compare to required size. Main reason for failure is too big gap between segments. Default value for chart.ViewXY.AxisLayout.SegmentsGap property is 20 [px]. If you set it to 0, then chart should draw even if segment size just 1 pixel.
You could get Chart size, after it was rendered. Depending on platform used (WPF, WinForms, headless mode) it may different event. _chart.AfterRendering is most general approach. But in many cases it is enough to use Chart.Loaded or Chart.SizeChanged.

Post Reply