|
Multiple plotareas? |
Posted by Bas Beemsterboer on Feb-09-2011 01:12 |
|
Hi folks, question about stacked charts
How can I create multiple charts (stacked) sharing the same horizontal axis, but with separate y axes?
I have implemented one of the Gantt chart examples with BoxWhisker anmd Scatter layers in it. On top of that I would want to create a second Gantt Chart and yet another Scatterplot, so 3 stacked charts in total.
Do I need to make multiple plotareas inside one XY Chart? Or how does it work? I looked at the finance chart for inspiration, but I couldnt finmd out how the stacking works there.
Thanks for the help (and a short sample to get me inspired would be nice too)
Bas |
Re: Multiple plotareas? |
Posted by Peter Kwan on Feb-09-2011 06:06 |
|
Hi Bas,
To create multiple plot areas, you need multiple XYChart objects. You may use a MultiChart container to contain multiple XYChart objects. This is how the financial chart is created.
For example, in PHP:
$chart1 = new XYChart(600, 300, Transparent);
.. draw first chart ..
$chart2 = new XYChart(600, 300, Transparent);
.. draw second chart ..
$c = new MultiChart(600, 600);
$c->addChart(0, 0, $chart1);
$c->addChart(0, 300, $chart2);
... output $c ....
To create charts with the same horizontal axis, just use the same axis scale in all the charts.
To stack the charts, you may set the horizontal axes of all the charts to transparent except the bottom chart. In this way, only the bottom horizontal axis is visible. You may size and position the plot area properly so that the charts are stacked with minimal gaps.
Hope this can help.
Regards
Peter Kwan |
Re: Multiple plotareas? |
Posted by Bas Beemsterboer on Feb-10-2011 06:35 |
|
Great stuff as always, Peter
Thanks for the help
Bas |
Re: Multiple plotareas? |
Posted by Bas Beemsterboer on Feb-11-2011 17:27 |
|
Peter, one more question for the same graph: I am using the Gantt Chart capability to draw a road (and the stacked graphs on top to display inspection results and other stuff). This works fine and I think I can do exactly what I want with it.
With regards to the Road I am drawing: Can I use "patterns" to create an intermittent stripe in the middle of the road? I want to make it obvious for the user to see what he is looking at....
If so, how? By the way, I am using JSP
Thanks
Bas |
Re: Multiple plotareas? |
Posted by Bas Beemsterboer on Feb-11-2011 18:09 |
|
Sorry to bother, I just found out that I can easily do it. I love ChartDirector!!! |
|