How to Quickly Add Thousands of Points to a T chart

The trick is to pre-allocate the memory for the points in the chart series.

1 Steps 1 min read Easy

Step-by-Step Guide

  1. Step 1: The trick is to pre-allocate the memory for the points in the chart series.

    There is no obvious function in TSeries that does this, but the FillSampleValues function serves the same purpose by filling the series with a known number of points. // load the data into a memory stream ms->LoadFromFile("data"); // compute number of points numpts = ms->Seek (0, soFromEnd)/sizeof(cd); // pre-allocate space Series1->FillSampleValues(numpts); // load the data into the chart ms->Position = ms->Seek(0, soFromBeginning); for (unsigned i=0; i < numpts; i++) { ms->Read(&cd, numbytes); Series1->XValues->Value= cd.x; Series1->YValues->Value= cd.y; };

Detailed Guide

There is no obvious function in TSeries that does this, but the FillSampleValues function serves the same purpose by filling the series with a known number of points. // load the data into a memory stream ms->LoadFromFile("data"); // compute number of points numpts = ms->Seek (0, soFromEnd)/sizeof(cd); // pre-allocate space Series1->FillSampleValues(numpts); // load the data into the chart ms->Position = ms->Seek(0, soFromBeginning); for (unsigned i=0; i < numpts; i++) { ms->Read(&cd, numbytes); Series1->XValues->Value= cd.x; Series1->YValues->Value= cd.y; };

About the Author

A

Albert Howard

Albert Howard specializes in digital media and internet and has been creating helpful content for over 17 years. Albert is committed to helping readers learn new skills and improve their lives.

35 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: