Jump to content
Software FX Community

Chart with dataset of 100000+ points is very slow in refreshing / updating


User (Legacy)

Recommended Posts

Hi,

I created a scatter chart with about 100100 points in a single serie. I

notice that it takes a very long time (5-10 seconds) for the chartFX control

to finishing plotting the points. I have attached a small project that

demonstrates the issue. Notice that it takes a long time for the UI to come

up, and then if you resize the window, then it takes a long time before the

resize is complete. The bulk of the time is spent waiting for the chart

control to finish refreshiing. Any help to speed things up would be

appreciated.

I'm not doing anything special; just something like this:

chart.OpenData(COD.Values | COD.AllocHidden, 1, nNumPoints);

chart.OpenData(COD.XValues | COD.AllocHidden, 1, nNumPoints);

int groupNumPoints = 100100;

for(int nPtIdx = 0; nPtIdx < groupNumPoints; nPtIdx++)

{

int binYValue = rand.Next(2000000);

int binXValue = rand.Next(2000000);

chart.Value[nSerIdx, nPtIdx] = binYValue;

chart.XValue[nSerIdx, nPtIdx] = binXValue;

SoftwareFX.ChartFX.PointAttributes point = chart.Point[1, nPtIdx];

point.Tag = 111;

point.Color = Color.Red;

point.MarkerSize = 1;

}

chart.CloseData(COD.Values);

chart.CloseData(COD.XValues);

Link to comment
Share on other sites

Here are a few things you can do to improve the performance:

0) Eliminate the Pre-Paint - Post-Paint event handlers and revise you code

in WndProc, this is causing multiple paints (to see it do step 4).

1) Avoid assigning Per-Point attributes in a chart so large. Per-Point

attributes are intended to be used to assign properties to "special" points

(a few) in your case you are assigning a point attribute toe all 100,101 of

them.

2) Turn off antialliasing:

chart1.SmoothFlags = SmoothFlags.TextSystem;

3) Consider changing your MarkerShape:

chart.Series[nSerIdx].MarkerShape = MarkerShape.Rect;

Will improve the performance. GDI+ is much faster at drawing Rectangles than

Circles.

4) Consider removing Double Buffering:

chart1.TypeEx &= ~ChartTypeEx.DoubleBuffer;

--

Francisco Padron

www.chartfx.com

Chart_Paint_is_slow.zip

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...