Hi,
I am using Lightning Chart version 5.2.4001. I want to get the points being displayed when zooming in the graph, not all the points in the graph. Is there any way to do this in ViewXY?
Could you please assist? Some code sample for the workaround would be great.
Thanks,
Syarli
Getting the points displayed in the ViewXY when zooming in
Moderator: Queue Moderators
-
- Posts: 12
- Joined: Wed Oct 02, 2013 6:26 am
Re: Getting the points displayed in the ViewXY when zooming
Hi Syarli.
You could try something like this:
This code works with PointLineSeries. If you are using SampleDataSeries then use the commented lines.
You could try something like this:
Code: Select all
//Int32 iPointCount = m_chart.ViewXY.SampleDataSeries[0].PointCount;
//Double[] samples = m_chart.ViewXY.SampleDataSeries[0].SamplesDouble;
//Double dSamplingFrequency = m_chart.ViewXY.SampleDataSeries[0].SamplingFrequency;
//Double dFirstTimeStamp = m_chart.ViewXY.SampleDataSeries[0].FirstSampleTimeStamp;
//List<Double> zoomedValues = new List<Double>(iPointCount / 2);
Int32 iPointCount = m_chart.ViewXY.PointLineSeries[0].PointCount;
List<SeriesPoint> zoomedValues = new List<SeriesPoint>(iPointCount / 2);
SeriesPoint[] seriesPoints = m_chart.ViewXY.PointLineSeries[0].Points;
for (Int32 i = 0; i < iPointCount; i++)
{
//Double dX = dFirstTimeStamp + ((Double)i / dSamplingFrequency);
Double dX = seriesPoints[i].X;
// Zoomed area's minimum and maximum are stored in newMinimum and newMaximum.
if ((dX >= newMinimum) && (dX <= newMaximum))
{
//zoomedValues.Add(dX);
zoomedValues.Add(seriesPoints[i]);
}
else if (dX > newMax)
{
break;
}
}