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

Message ListMessage List     Post MessagePost Message

  Touching Scatter points
Posted by James on Apr-12-2011 00:17
Attachments:
Hi

Ive set up an XY graph with numerous scatter layers.  The scatter points are cutom ploygons set up as a line.

int[] line = { 0, 500, 500, 500, 0, 501, 500, 501 };
ScatterLayer layer = chart.addScatterLayer(Xvalues, Yvalues);
                        layer.getDataSet(0).setDataSymbol4(line, shapeSize, (int)colourDataRgba[i], (int)colourDataRgba[i]);

Each layer of scatter points has a different colour.  So final graph is a multicoulered layer of scatter points which represents a density graph.  I have chosen this manner due to the nature of the data, i cannot use interpolation and contour graphs with scatter points would not make sense.

In general my graph works pretty well but there is a problem with scaling.  I am trying to set the scatter points to touch however there always appears to be one pixel blank between the lines, or they overlap.  I think this is due to the drawing of the points in the graph.   I have couple of questions.

1 Is it possible to make the points in a scatter graph touch similar to the functionality available in bar graph via

layer.setBarGap(ChartDirector.Chart.TouchBar);

2. Do you believe in general multi layered / couloured scatter points is the best way that chart director can do a density graph? I have included a picture of the graph i am trying to represent below.

image/x-png
densitygraph.png

  Re: Touching Scatter points
Posted by Peter Kwan on Apr-12-2011 00:54
Hi James,

1. In general, for the bars to touch in a bar chart, the bars would need to have different width.

For example, if the plot area is 200 pixels in width, and there are 21 bars, there is no way to make the bars touch if they all have the same width (as 200 is not divisible by 21, and in ChartDirector, the bars must be integer number of pixels in width). In "TouchBar", we modify the width of some of the bars to make them touch, so the bars really have different widths.

For your case, there is no "TouchBar" feature in a scatter layer (as the scatter points can be in arbitrary positions), but if they are really spreading in columns similar to a bar chart, you can make them touch my setting the plot area width as an exact multiple of the number of "columns" in your chart. For example, if you have 50 columns, and each column is 5 pixels, then the symbols should touch if the plot area is 250 pixels in width.


2. For the chart you would like to achieve, I think using scatter layers is a good choice.

A contour chat is more suitable if you have much less data points, but you would like to interpolate for the entire region. For example, if you would like to display the temperature distribution in a region, but you can only take measurements at 50 locations, then using a contour chart is ideal.

However, if the number of data points are so big that they can fill the chart by itself, or if the nature of the data are such that interpolation is not valid, then the contour chart should not be used.


Hope this can help.

Regards
Peter Kwan