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

Message ListMessage List     Post MessagePost Message

  Symbol count
Posted by Stephan Bielmann on Jul-17-2014 19:56
Hello all,

actually if a add a new scatter layer, or a line layer with a dataset and symbol, I get a
symbol for every datapoint. Is there a way to skip symbol drawing for some datapoints ?
For example having 10 datapoints, and I would like to have a symbol on every second
datapoint only.

Could these be the offset option mentioned in the future plans of CD ?

Thanks for any help,

Stephan

  Re: Symbol count
Posted by Peter Kwan on Jul-18-2014 04:08
Hi Stephan,

You can remove some data points before adding the scatter layer. For example, in Java,
you can use:


LineLayer myLineLayer = c.addLineLayer(myData, ....);

// change every other data point to Chart.NoValue
for (int i = 0; i < myData.length; ++i)
    if (i % 2 != 0) myData[i] = Chart.NoValue;

c.addScatterLayer(null, myData, "", Chart.DiamondShape, 9, 0xff0000,
0x000000).moveFront(myLineLayer);

Hope this can help.

Regards
Peter Kwan

  Re: Symbol count
Posted by Stephan Bielmann on Jul-18-2014 13:33
Hello Peter,

yes this is what I do for scatter, however when having a line layer with a dataset that should have both, line and symbol, this won't work, as the lesser count of datapoints also affects
the lines, but in my case it should not.

Regards, Stephan

  Re: Symbol count
Posted by Peter Kwan on Jul-19-2014 01:06
Hi Stephan,

For the line chart, there are two methods:

(a) Use the line chart to draw the line, and use the scatter chart to draw the symbols. The
example in my last message demonstrates this method. You may notice the same data are
used for both the line layer and the scatter layer, except that every other point is removed
before plotting the scatter layer. So the scatter symbols are exactly on the points that
define the line.

(b) In a line layer, you may use LineLayer.setSymbolScale to change the size of every other
symbol to 0. For example:

double[] symbolSize = new double[myData.length];
for (int i = 0; i < symbolSize.length; ++i)
    symbolSize[i] = (i % 2 == 0) ? 9 : 0;
myLineLayer.setSymbolSize(symbolSize);

Hope this can help.

Regards
Peter Kwan

  Re: Symbol count
Posted by Stephan Bielmann on Aug-04-2014 21:29
Hello Peter,

sorry it took some time, thank you for your hint, the second approach is what
I took and it is working as expected.

Regards, Stephan