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.
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.
- Deferred view bug example
- (10.57 KiB) Downloaded 320 times
Thank you for the detailed description and test project. It looks a little bit as our Demo's (WPF) example "Billion Points". You maybe interested to check the implementation there. For example, the CheckBox "Prefill with data" looks like the one you would like to use.
The problem you described sound very unusual. We will check your test project as soon as possible.
All the best.
There are few bugs in your program, which spoil the party.
First and foremost, you binding series to Yaxis, which is not yet added to view. You need to add axis and only when create SampleDataSeries:
Code: Select all
view.YAxes.Add(axis); var series = new SampleDataSeries(view, view.XAxes, axis);
Second, you have less segments than series. Therefore, you should not assign Segment's indices you don't have. For example something like this would be fine
Code: Select all
axis.SegmentIndex = i % SegmentCount;
Code: Select all
//allSeries[i].AddSamples(seriesSamples, false); lcu.ViewXY.SampleDataSeries[i].AddSamples(seriesSamples, false);
Hope this helps.
All the best.
P.S. Axis and Series have visibility property if you want to make them temporally invisible. You can add Vertical ScrollBar to LightningChart, which would allow to place more segments. There are many other ideas how to present dense data, please check them in our Demo app. If you could not find some implementation, you can always ask through support account.
I have tried adding Y axis into view before constructing the series object. Worked for visible series. But if I add invisible series into the view this solution does not work. Therefore it seems like another workaround but not a problem with my sample codeFirst and foremost, you binding series to Yaxis, which is not yet added to view.
As a reminder, constructing series before adding the Y axis into view works perfectly if the chart is visible (ie. added to the window) before updates. If chart gets visible sometime later, then the problem (broken relationship between the axis and the series) occurs.
This is intended, because like I have pointed out before (1)there are too many channels and I cannot show all of them at once because the details in the Y domain would be invisible, (2) I need to hold the data in series instead of somewhere else. If I have added all the segments then visible axes would become too small.Second, you have less segments than series.
This causes "The Problem" even if I set series Visible property to false, if I add the series into ViewXY.SampleDataSeries list, the series assigns itself to the first visible Y axis when the chart is not visible but the data is being fed.Third, there is no reason why you should limit adding Series or Axis to ViewXY, because SeriesCount > SegmentCount.
Moreover, even if I make series and the related Y-axis invisible remaining axes will be small and there will be a lot of empty space because of the remaining segments. Hence, we need to add/remove segments when needed.
"MakeAllSeriesVisible" method actually exists for demonstration that, if the series are not added to the view, they will keep the relationship with corresponding Y-Axis unlike the series that are added to the view.MakeAllSeriesVisible() method completely useless or even harmful
Beyond these, we don't want scroll-bars and, in your demo application the segmented Y axis layout looked like a best fit for our needs. Therefore, it seems we will go on with the IsVisibleChanged event workaround for the time being.