I'm not good at English.
Was created using a translator.
Please understand that.
1. When the mouse is over, CrossHair want to show.
(Image file was attached.)
2. PointLineSeries add how much data can you do? When expression of the following "Out of Memory" occurs. No way to add data to do?
private void OpenLargeData()
{
GC.Collect();
m_chart.BeginUpdate();
ViewXY viewXY = m_chart.ViewXY;
SeriesPoint[] points = new SeriesPoint[26500000];//I want more
using (FileStream fs = File.Open(SampleProvider.FilePath, FileMode.Open))
using (BinaryReader br = new BinaryReader(fs))
{
int count = 0;
for (int i = 0; i < points.Length; i ++)
{
points[count].X = count + 1;
points[count].Y = br.ReadInt32();
count++;
}
}
m_chart.ViewXY.YAxes[0].SetRange(points[0].Y, points.Last().Y);
m_chart.ViewXY.XAxes[0].SetRange(points[0].X, points.Last().X);
m_chart.ViewXY.PointLineSeries[0].AddPoints(points, false);
m_chart.EndUpdate();
}
Thank you for reading.
mouse move crosshair and add large data in PointLineSeries.
Moderator: Queue Moderators
-
- Posts: 1
- Joined: Mon Apr 21, 2014 6:14 am
mouse move crosshair and add large data in PointLineSeries.
- Attachments
-
- Question 1
- crossHair.png (116.49 KiB) Viewed 5237 times
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: mouse move crosshair and add large data in PointLineSeri
Hello,
the SeriesPoint structure is quite large, it takes 16 bytes per point.
If your data is fixed interval data (point X values have a certain step that doesn't vary), I'd suggest using SampleDataSeries as follows:
Each point takes only 4 bytes. By experimenting with this, I could use 512 million points, and that produces 2 GB array. I ran with AnyCPU configuration with 64-bit Win7, x86 may not allow this large array.
With this kind of data set size, the performance is not great anymore. So using less points would be a good idea, and loading new data when X axis range changes or so.
To add an value displaying annotation bubble, please refer to "Cursor tracking" example:
the SeriesPoint structure is quite large, it takes 16 bytes per point.
If your data is fixed interval data (point X values have a certain step that doesn't vary), I'd suggest using SampleDataSeries as follows:
Code: Select all
m_chart.BeginUpdate();
m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
int pointCount = 512000000;
double pointsXInterval = 0.01;
SampleDataSeries sds = new SampleDataSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0]);
sds.SamplingFrequency = 1.0 / pointsXInterval; //Setting sampling frequency tells the series how many points per sec there is in X axis.
sds.FirstSampleTimeStamp = 0; //x value of first point
sds.LineStyle.Width = 1;
sds.LineStyle.AntiAliasing = LineAntialias.None;
sds.MouseInteraction = false;
sds.SampleFormat = SampleFormat.SingleFloat;
m_chart.ViewXY.SampleDataSeries.Add(sds);
Single[] points =new Single[pointCount];
Random rand = new Random();
for (int i = 0; i < pointCount; i++)
{
points[i] = (Single)(i % 5000000); //just set index modulo 5000000 as Y value
}
sds.SamplesSingle = points;
m_chart.ViewXY.XAxes[0].SetRange(0, (double)(pointCount-1) * pointsXInterval);
m_chart.ViewXY.YAxes[0].SetRange(0, 5000000);
//Add a line series cursor
LineSeriesCursor cursor = new LineSeriesCursor(m_chart.ViewXY, m_chart.ViewXY.XAxes[0]);
cursor.ValueAtXAxis = 0;
cursor.SnapToPoints = true;
m_chart.ViewXY.LineSeriesCursors.Add(cursor);
m_chart.EndUpdate();
Each point takes only 4 bytes. By experimenting with this, I could use 512 million points, and that produces 2 GB array. I ran with AnyCPU configuration with 64-bit Win7, x86 may not allow this large array.
With this kind of data set size, the performance is not great anymore. So using less points would be a good idea, and loading new data when X axis range changes or so.
To add an value displaying annotation bubble, please refer to "Cursor tracking" example:
LightningChart Support Team, PT