Getting the points displayed in the ViewXY when zooming in

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
itz_me_cheyi
Posts: 12
Joined: Wed Oct 02, 2013 6:26 am

Getting the points displayed in the ViewXY when zooming in

Post by itz_me_cheyi » Wed Oct 02, 2013 6:46 am

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

ArctionJari

Re: Getting the points displayed in the ViewXY when zooming

Post by ArctionJari » Thu Oct 03, 2013 1:19 pm

Hi Syarli.

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;
				}
			}
This code works with PointLineSeries. If you are using SampleDataSeries then use the commented lines.

Post Reply