|
3D Area Chart with Stacking? |
Posted by Eric Simon on Feb-15-2013 04:02 |
|
Hi,
I am needing to do a variable-width bar chart, so I followed the instructions on how to instead create an Area Chart. However, I need to do stacking, and want to make it 3D. I've had to be creative by adding layers, making them 3D, and then sliding them backwards so they still sit next to one another. Additionally, I had to purposely add the right-most layers first.
Everything's gone well up to this point, except for the stacking. Can you tell me how to make the blue area layer not stack behind, but instead stack on top of the green bar (see attached image)?
Thanks!
|
Re: 3D Area Chart with Stacking? |
Posted by Eric Simon on Feb-15-2013 04:02 |
|
Sorry, I meant to attach my code:
use perlchartdir;
my $c = XYChart->new(300,300);
$c->setPlotArea(30,30,240,230);
$c->xAxis->setDateScale(63496359590,63496618790);
$c->yAxis->setLabels2([0..7]);
my $layer2 = $c->addAreaLayer([0,2,2,0],0x00aa00);
$layer2->setXData([63496412590,63496412590,63496579590,63496579590]);
$layer2->set3D(20,-20);
my $layer1 = $c->addAreaLayer([0,3,3,0],0x00aa00);
$layer1->setXData([63496372590,63496372590,63496412590,63496412590]);
$layer1->addDataSet([3,6,6,3],0x66aaee);
$layer1->set3D(20,-20);
# Dummy layer who's only purpose is to establish the chart as 3D.
my $corner = $c->addAreaLayer([0,0,0,0]);
$corner->setXData([63496359590,63496359590,63496359590,63496359590]);
$corner->set3D(20);
$r->set_headers(-type => 'image/png');
return \\$c->makeChart2($perlchartdir::PNG); |
Re: 3D Area Chart with Stacking? |
Posted by Peter Kwan on Feb-15-2013 23:05 |
|
Hi Eric,
For stacking, may be you can try a stacked area layer, like:
my $layer1 = $c->addAreaLayer2($perlchartdir::Stack);
$layer1->setXData([63496372590,63496412590]);
$layer1->addDataSet([3,3],0x00aa00);
$layer1->addDataSet([3,3],0x66aaee);
$layer1->set3D(20,-20);
Hope this can help.
Regards
Peter Kwan |
Re: 3D Area Chart with Stacking? |
Posted by Eric Simon on Feb-16-2013 01:15 |
|
That did it! Nice. This app was quite the gem to find.
Any chance that I can control the border color per Data Set? I know I can put a blue border on everything, but I'd like to have a light green border on the bottom part of the stack, and a light blue border on the top stack. |
Re: 3D Area Chart with Stacking? |
Posted by Peter Kwan on Feb-19-2013 01:00 |
|
Hi Eric,
Yes. You can put a border color per data set. Instead of using:
$layer1->addDataSet([3,3], $myFillColor);
You may use:
$ds1 = $layer1->addDataSet([3,3]);
$ds1->setDataColor($myFillColor, $myBorderColor);
Hope this can help.
Regards
Peter Kwan |
Re: 3D Area Chart with Stacking? |
Posted by Eric Simon on Feb-19-2013 06:18 |
|
Perfect! Thanks so much for taking the time to answer. |
|