ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Exist SurfaceChart(3D Chart) Data series limit ?
Posted by hong on Jan-19-2023 12:32
I set Surface Chart data (setData) 120,000ea
but chart display almost 65,000ea.

some limitation is exist?
or my mistake? ;-(

  Re: Exist SurfaceChart(3D Chart) Data series limit ?
Posted by Peter Kwan on Jan-20-2023 13:39
Hi Hong,

Some of our customers are using the surface chart with around 1 million points, and it still works normally.

I have just tried myself. In my testing, the surface chart works normally even with 1 million points. It works quite fast if the data points lies on a regular grid, but quite slow if the data points are randomly positioned (scatter points). This is normal and expected as scattered points surface chart is CPU intensive for large number of data points.

Would you mind to clarify which programming language edition of ChartDirector you are using, and which programming framework you are using (eg. C++/MFC, C#/Windows Forms, PHP ...)? Are you data points lie on a rectangular grid, or as they randomly positioned? May be I can write an example with large number of data points for you.

Best Regards
Peter Kwan

  Re: Exist SurfaceChart(3D Chart) Data series limit ?
Posted by hong on Jan-25-2023 17:25
Attachments:
My Version is 7.0 and MFC(VS 2019).

Data Series is..

xData 120,000
yData 100
so.. zData 120,000*100, almost 12,000,000 point.

I want to use more data..

Attatched capture file is
Left Chart is XYChart and addContourLayer x,y,z data size is same.
Rigit Chart is SurfaceChart.

The chart is not drawn from approximately the 65,000th x-axis.
Capture.jpg

  Re: Exist SurfaceChart(3D Chart) Data series limit ?
Posted by Peter Kwan on Jan-26-2023 04:33
Attachments:
Hi hong,

I have just tried myself to create a contour and a surface chart with 120,000,00 points, and it works normally in my test.

I started from the mfcdemo sample code included in ChartDirector 7.0. I modified the "contour chart" sample code and the "surface chart" sample code as listed below. For the x coordinates, I simply use 0, 1, 2, .... 12000 (12001 values in total). For the y-coordinates, I use 0, 1, 2, ...100 (101 values in total). For the z coordinates, the array size is 12001 x 101 = 1212101. I use the formula z = sin(x / 500) * cos(y / 10)
to generate some sample z values. All the axis area auto-scaled by ChartDirector.

For your original chart, the axis labels look strange. Usually, ChartDirector will not automatically generate this kind of labels. Does your code specify the labels using Axis.setLabels? For Axis.setLabels, the labels are provided as text strings. They are just names for human reading and have no meaning to ChartDirector. For example, if the labels are "Apple", "Orange", "1000", "Pear", ChartDirector will just put them one by one on the axes, with each label occupy one axis unit, that is, they will be put at x = 0, 1, 2, 3. Note that the label "1000" will not be put at the x=1000 position. It will be at x=2 in the above case.

If this still cannot solve the problem, is it possible to provide some code that I can try. May be you can modify my code to make it not work, so I can see what may be causing the issue.


void contour(CChartViewer* viewer, int /* chartIndex */)
{
    std::vector<double> dataX(12001);
    for (int i = 0; i < dataX.size(); ++i)
        dataX[i] = i;

    std::vector<double> dataY(101);
    for (int i = 0; i < dataY.size(); ++i)
        dataY[i] = i;

    std::vector<double> dataZ(dataX.size() * dataY.size());
    int zIndex = 0;
    for (int i = 0; i < dataY.size(); ++i)
    {
        double yFactor = cos(dataY[i] / 10);
        for (int j = 0; j < dataX.size(); ++j)
            dataZ[zIndex++] = sin(dataX[j] / 500) * yFactor;
    }

    XYChart* c = new XYChart(900, 500);
    c->setPlotArea(75, 30, 700, 400, -1, -1, -1, c->dashLineColor(0x80000000, Chart::DotLine), -1);

    ContourLayer* layer = c->addContourLayer(DoubleArray(dataX.data(), dataX.size()),
        DoubleArray(dataY.data(), dataY.size()), DoubleArray(dataZ.data(), dataZ.size()));

    // Move the grid lines in front of the contour layer
    c->getPlotArea()->moveGridBefore(layer);

    // Add a color axis (the legend) in which the top left corner is anchored at (505, 40). Set the
    // length to 400 pixels and the labels on the right side.
    ColorAxis* cAxis = layer->setColorAxis(805, 30, Chart::TopLeft, 400, Chart::Right);

    // Output the chart
    viewer->setChart(c);
}


void surface(CChartViewer *viewer, int /* chartIndex */)
{
    std::vector<double> dataX(12001);
    for (int i = 0; i < dataX.size(); ++i)
        dataX[i] = i;

    std::vector<double> dataY(101);
    for (int i = 0; i < dataY.size(); ++i)
        dataY[i] = i;

    std::vector<double> dataZ(dataX.size() * dataY.size());
    int zIndex = 0;
    for (int i = 0; i < dataY.size(); ++i)
    {
        double yFactor = cos(dataY[i] / 10);
        for (int j = 0; j < dataX.size(); ++j)
            dataZ[zIndex++] = sin(dataX[j] / 500) * yFactor;
    }

    // Create a SurfaceChart object of size 720 x 600 pixels
    SurfaceChart* c = new SurfaceChart(720, 600);

    // Add a title to the chart using 20 points Times New Roman Italic font
    c->addTitle("Surface Energy Density   ", "Times New Roman Italic", 20);

    // Set the center of the plot region at (350, 280), and set width x depth x height to 360 x 360
    // x 270 pixels
    c->setPlotRegion(350, 280, 360, 360, 270);

    // Set the data to use to plot the chart
    c->setData(DoubleArray(dataX.data(), dataX.size()), DoubleArray(dataY.data(), dataY.size()),
        DoubleArray(dataZ.data(), dataZ.size()));

    // Spline interpolate data to a 80 x 80 grid for a smooth surface
    c->setInterpolation(80, 80);

    // Add a color axis (the legend) in which the left center is anchored at (645, 270). Set the
    // length to 200 pixels and the labels on the right side.
    c->setColorAxis(645, 270, Chart::Left, 200, Chart::Right);

    // Set the x, y and z axis titles using 10 points Arial Bold font
    c->xAxis()->setTitle("X (nm)", "Arial Bold", 10);
    c->yAxis()->setTitle("Y (nm)", "Arial Bold", 10);
    c->zAxis()->setTitle("Energy Density (J/m<*font,super*>2<*/font*>)", "Arial Bold", 10);

    // Output the chart
    viewer->setChart(c);
}
contourtest.png
surfacetest.png

  Oh My God.... (-),(-)/
Posted by hong on Jan-26-2023 11:22
Code is Exactlly Same but...

c->setInterpolation is key point (maybe...)

if skip the code, my problem is occured
but not perfact chart is created;;

thank you for your effort ^^b