Page 1 of 1
plot more data points.
Posted: Tue Sep 01, 2009 9:29 pm
by 9642625
I am querying from a database and plotting the retrieved data.
The query on an average returns around 10 million data points.
I am currently not able to plot them all.
Please advice.
Re: plot more data points.
Posted: Wed Sep 02, 2009 12:00 pm
by yeray
Hi cs_ech,
A first possibility, if you are using a FastLine series, would be setting DrawAllPoints property to false to reduce the number of points to draw.
Another possibility would be using the provided DownSampling function. Please, see the All Features\Welcome !\Functions\Extended\Reducing number of points example demo from New Features Demo (you should find it at TeeChart program's group).
And, of course, it would be also good if you could manually reduce the number of points applying your own filter before adding the points to the series.
Re: plot more data points.
Posted: Wed Sep 02, 2009 9:14 pm
by 9642625
hi,
I am not using FastLine series but a point graph.
I was unable to activate the paging property.
Out of the 10 million data points, I am only able to plot 1000 points in one page.
Re: plot more data points.
Posted: Thu Sep 03, 2009 8:28 am
by narcis
Hi cs_ech,
FastLine series are the fastest in TeeChart. I strongly suggest you to do something as in the example below. If you can't use FastLine then remove all properties that are exclusive to that series. Anyway, and as Yeray suggested, DownSampling function can also be applied to Points series.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
int nrOfSamples = 25000000;
private Steema.TeeChart.Styles.FastLine fastline1;
private System.Diagnostics.Stopwatch stopWatch;
private void InitializeChart()
{
stopWatch = new System.Diagnostics.Stopwatch();
tChart1.Aspect.View3D = false;
tChart1.Aspect.SmoothingMode =
System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
tChart1.Legend.Visible = false;
tChart1.Axes.Bottom.SetMinMax(0, nrOfSamples);
fastline1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
//pre-assign ChartPens
Pen rPen = new Pen(Color.Red);
Steema.TeeChart.Drawing.ChartPen redPen = new
Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
fastline1.LinePen = redPen;
fastline1.DrawAllPoints = false;
fastline1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
tChart1.AfterDraw += new
Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D
g)
{
//calculate elapsed time
//stopWatch.Stop();
TimeSpan elapsedTime = stopWatch.Elapsed;
string total = elapsedTime.TotalSeconds.ToString();
label1.Text = "Elapsed time: " + total + " s";
}
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
stopWatch.Reset();
stopWatch.Start();
tChart1.AutoRepaint = false;
double[] x1 = new double[nrOfSamples];
for (int i = 0; i < x1.Length; i++)
{
x1[i] = i;
}
double[] random1 = new double[nrOfSamples];
FillArray(random1);
//fastline1.Add(x1, random1);
fastline1.XValues.Value = x1;
fastline1.XValues.Count = nrOfSamples;
fastline1.YValues.Value = random1;
fastline1.YValues.Count = nrOfSamples;
tChart1.AutoRepaint = true;
tChart1.Refresh();
Application.DoEvents();
stopWatch.Stop();
button1.Enabled = true;
}
private static void FillArray(double[] myArray)
{
Random y = new Random();
for (int i = 0; i < myArray.Length; i++)
{
myArray[i] = y.Next();
}
}
Hope this helps!
Re: plot more data points.
Posted: Mon Sep 14, 2009 10:15 pm
by 9642625
This code gives me following errors:
Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
The best overloaded method match for 'Steema.TeeChart.Drawing.ChartPen.ChartPen(Steema.TeeChart.Chart, bool)' has some invalid arguments
Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
Argument '2': cannot convert from 'System.Drawing.Pen' to 'bool'
fastline1.LinePen = redPen;
Property or indexer 'Steema.TeeChart.Styles.BaseLine.LinePen' cannot be assigned to -- it is read only
label1.Text = "Elapsed time: " + total + " s";
The name 'label1' does not exist in the current context
Re: plot more data points.
Posted: Tue Sep 15, 2009 7:57 am
by narcis
Hi cs_ech,
Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
The best overloaded method match for 'Steema.TeeChart.Drawing.ChartPen.ChartPen(Steema.TeeChart.Chart, bool)' has some invalid arguments
Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
Argument '2': cannot convert from 'System.Drawing.Pen' to 'bool'
fastline1.LinePen = redPen;
Property or indexer 'Steema.TeeChart.Styles.BaseLine.LinePen' cannot be assigned to -- it is read only
As I told you in my previous reply, some of those properties are exclusive to FastLine series. If you are using Points series you'll have to remove them.
label1.Text = "Elapsed time: " + total + " s";
The name 'label1' does not exist in the current context
You just need to drop a Label at your form and call it label1 to get this working.