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

Message ListMessage List     Post MessagePost Message

  Combined Zones for X/Y ?
Posted by Alex on Dec-02-2013 06:02
Attachments:
Hi Peter,

I would like to draw a scatter chart, where the combination of X and Y values should be drawn to specific area zones / bands (as in the two samples).


Is it possible to make such combined zones also in chartdirector ?
And how to achieve such a gradient like in the second sample ?

Thank you and best regards
Alex
large.gif
chart.jpg

  Re: Combined Zones for X/Y ?
Posted by Peter Kwan on Dec-03-2013 00:02
Hi Alex,

Yes. You can have combined XY zones. To do this, simply add a horizontal zone (call Axis.addZone on the y-axis), in which the zone color is an y-zone color (using XYChart.yZoneColor). For example, in Java/C#, it is like:

//create a zone for x < 90 and y < 140
c.xAxis().addZone(-9999, 90, c.yZoneColor(140, 0xff9999, Chart.Transparent));

For your case, you can use red as the background color of the plot area, then add a yellow zone, a green zone and a purple zone, and you can achieve your first chart.

For the second chart, you may use addTrendLayer to define the line that separates the zones, and then use an InterLineLayer to fill them. It is like:

// Define the line that separates two of the zones. The line is defined by providing two
// points (x1, y1) and (x2, y2) on the line.
TrendLayer layer1 = c.addTrendLayer2(new double[] { x1, x2 }, new double[] { y1, y2 }, Chart.Transparent);

// Define another liine that separates the other two of the zones
TrendLayer layer2 = c.addTrendLayer2(new double[] { x3, x4 }, new double[] { y3, y4 }, Chart.Transparent);

// Fill the region between the two lines
Layer fillLaye1 = c.addInterLineLayer(layer1.getLine(), layer2.getLine(), 0xffff00);

// If layer1 is the top most line, fill the region between that line and the top of the
// plot area
Layer fillLayer2 = c.addInterLineLayer(layer1.getLine(), c.yAxis().addMark(999999, Chart.Transparent), 0xff0000);


// Add the folloiwng line if you want the grid lines to be on top of the InterLineLayer
c.getPlotArea().moveGridBefore(fillLayer2);

Hope this can help.

Regards
Peter Kwan

  Re: Combined Zones for X/Y ?
Posted by Alex on Dec-03-2013 19:18
Hi Peter,

thank you very much !

Kind regards
Alex