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

Message ListMessage List     Post MessagePost Message

  Dynamic series addition
Posted by Sean L on Mar-30-2023 08:46
Hi Peter,

   I am looking at the Scatter chart in your Java library. I see that the ScatterLayers are added as follows.

ScatterLayer scatter1 = c.addScatterLayer(dataX1, dataY1, "AAAAAA ", Chart.CircleSymbol, 9,
                0x6666ff);

My question is as follows:

If I want to add multiple scatter layers which will be known to me only at run time. how can I male the above statement dynamic?

Assume that I will get the following parameters in an array of objects - dataX1, dataY1, Series name, color. Also in my case there will be only 1 value for X & Y in each series i.e. each series will represent only a single point

  Re: Dynamic series addition
Posted by Sean L on Mar-31-2023 18:30
Maybe the answer can be found here?
https://www.advsofteng.com/doc/cdjava.htm#scattersymbols.htm

Code snipper from above:
//

// Add each point of the data as a separate scatter layer, so that they can have a different symbol
for(int i = 0; i < dataX.length; ++i) {
    c.addScatterLayer(new double[]{dataX[i]}, new double[]{dataY[i]}).getDataSet(0).setDataSymbol2(
        symbols[i]);
}

//

  Re: Dynamic series addition
Posted by Sean L on Apr-01-2023 04:55
I was able to use one of the examples. Please ignore my question