v7.2.4 When chart is not shown, series use first Y axis
Posted: Wed Mar 15, 2017 7:42 am
For a brief view, I am currently using a trial version of the LightningChartUltimate for WPF (no-binding). In my application I was trying to show and hide the graph according to the UI interactions. But occasionally I had this behavior. When I delved into the debugging in a separate VS solution I was able to pinpoint the problem. I have attached the solution to this post. All of the code is in MainWindow.xaml.cs file.
Details:
---------
Requirements:
1. There are too many channels of data that I cannot put all of them into the graph at the same time. Therefore, I am holding onto multiple series but add them into or remove them from the view when needed.
2. Duration of the view will be long, so amount of incoming data is huge. Therefore, I am holding data in the SampleDataSeries instead of holding in different buffers.
3. Graph will not always be visible, moreover when data starts pumping we may not even have a window open. Therefore, I need to create the chart instance apriori and show when needed.
4. Some of the channels need to be larger than other channels, therefore I use segmented layout instead of a stacked one.
Behavior:
When I feed data into a SampleDataSeries instance the series tries to find itself a YAxis to show the data. When the chart is visible, the series show itself in the YAxis which is given in its constructor. But if the chart is not visible, then the series show itself in the first YAxis regardless of whether its YAxis present in the chart or not.
Showcase(In the attached VS solution):
At first I don't add the chart into the window. I have 'm' YSegments and 'n' YAxis/SampleDataSeries, where 'm < n'. I add 'm' of the axes and series into the chart. Then I start generating data and feed into the series. I wait for a couple of seconds and then add the chart into the view. Then I see that the series that are added to the chart have lost their Y-axes. If I add remaining (n-m) series and axes into the view, I see that there is no problem with these remaining series. They show in their respective Y-axes
1. If I don't wait for a duration and add chart into the view immediately (not a solution to my problem)
2. If I don't add any series but add them after chart is added to the view manually (a possible workaround)
3. If I don't add any series and register for chart's IsVisibleChanged event, and then add series when the chart becomes visible. (a possible workaround)
In the end I have my workarounds to this problem. But it seems like a bug.
Details:
---------
Requirements:
1. There are too many channels of data that I cannot put all of them into the graph at the same time. Therefore, I am holding onto multiple series but add them into or remove them from the view when needed.
2. Duration of the view will be long, so amount of incoming data is huge. Therefore, I am holding data in the SampleDataSeries instead of holding in different buffers.
3. Graph will not always be visible, moreover when data starts pumping we may not even have a window open. Therefore, I need to create the chart instance apriori and show when needed.
4. Some of the channels need to be larger than other channels, therefore I use segmented layout instead of a stacked one.
Behavior:
When I feed data into a SampleDataSeries instance the series tries to find itself a YAxis to show the data. When the chart is visible, the series show itself in the YAxis which is given in its constructor. But if the chart is not visible, then the series show itself in the first YAxis regardless of whether its YAxis present in the chart or not.
Showcase(In the attached VS solution):
At first I don't add the chart into the window. I have 'm' YSegments and 'n' YAxis/SampleDataSeries, where 'm < n'. I add 'm' of the axes and series into the chart. Then I start generating data and feed into the series. I wait for a couple of seconds and then add the chart into the view. Then I see that the series that are added to the chart have lost their Y-axes. If I add remaining (n-m) series and axes into the view, I see that there is no problem with these remaining series. They show in their respective Y-axes
1. If I don't wait for a duration and add chart into the view immediately (not a solution to my problem)
2. If I don't add any series but add them after chart is added to the view manually (a possible workaround)
3. If I don't add any series and register for chart's IsVisibleChanged event, and then add series when the chart becomes visible. (a possible workaround)
In the end I have my workarounds to this problem. But it seems like a bug.