|
Depth Bar Chart |
Posted by Rafael Felipe Schroeder on Oct-20-2005 00:12 |
|
Hello,
I'd like to change the angle of the X -Y Axys on the Depth Bar Chart to hava a view from the side, as we make in the Excel. Can I do it?
Thanks,
Rafael |
Re: Depth Bar Chart |
Posted by Peter Kwan on Oct-20-2005 02:28 |
|
Hi Rafael,
By "angle from the Axes (X - Y)", I assume you mean the 3D projection method of the depth bar chart.
ChartDirector currently is using othrogonal 3D project method. In this method, the x and y axes are always 90 degrees. ChartDirector currently does not support other projection method.
However, you can use a larger 3D depth and 3D gap to make the chart more looks like isometric projection. I have attached two samples for your reference. They are just normal 3D depth bar chart, but with the depth setting to a larger value and with a 3D gap. The code is something like:
//3d depth = 20 pixels, 3d gap = 30 pixels
layer.set3D(20, 30);
Hope this can help.
Regards
Peter Kwan
|
Re: Depth Bar Chart |
Posted by Rafael Felipe Schroeder on Oct-20-2005 02:55 |
|
Thank you, I think that will help me a lot!
I?m attachmenting the image of the gantt chart that I wanna make, can you see if it?s possible to make that?
Thanks,
Rafael
|
Re: Depth Bar Chart |
Posted by Peter Kwan on Oct-25-2005 09:35 |
|
Hi Rafael,
I believe I should have already responded to this enquiry offline via email. However, to allow other people reading this thread to know what is the result, I will also post the solution in this forum.
Basically, in the original "Multi-Layer Gantt Chart" sample code, the two bars in each x position overlaps with each others. In the new code, I shift one set of bars up, and the other set of bars down, so they do not overlap but appear side by side.
Regards
Peter Kwan
|
Re: Depth Bar Chart |
Posted by Jeff Behen on Dec-17-2005 07:17 |
|
Hi Peter,
I am curious how you set the labels, AAAAAA, BBBBBB, and CCCCCC, on the z-axis. Was this done via some built in setLabels method or are they just carefully placed text boxes?
Maybe if you still have the source to these charts , you could post the source?
thanks - jeff |
Re: Depth Bar Chart |
Posted by Peter Kwan on Dec-17-2005 12:28 |
|
Hi Jeff,
The "AAAAA", "BBBBB" and "CCCCC" are custom text boxes. This is possible because all positions (the size of the plot area, and 3D depth for each layer) are well-known, so the text coordinates can be computed easily.
I have attached the code for your reference.
Regards
Peter Kwan
zbar.asp |
---|
<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")
'The data for the bar chart
data0 = Array(1, 4, 3)
data1 = Array(5, 4, 0)
data2 = Array(3, 1, 3)
data4 = Array(3, 4, 5)
data5 = Array(5, 2, 2)
data6 = Array(3, 5, 1)
data7 = Array(9, 6, 7)
data8 = Array(3, 5, 4)
data9 = Array(2, 3, 4)
data10 = Array(3, 6, 4)
'The labels for the bar chart
labels = Array("One", "Two", "Three")
'Create a XYChart object of size 500 x 320 pixels
Set c = cd.XYChart(600, 400)
'Set the plotarea at (100, 40) and of size 280 x 240 pixels
Call c.setPlotArea(100, 100, 280, 240, &Heeeeee, &Hffffff)
'Add a legend box at (405, 100)
Call c.addLegend(460, 100, 1, "arialbd.ttf").setBackground(&Hdddddd, &Hdddddd, 1)
'Set the labels on the x axis
Call c.xAxis().setLabels(labels)
Call c.xAxis().setLabelStyle("arialbd.ttf", 10)
Call c.xAxis().setTickLength(0)
Call c.yAxis().setTickDensity(50)
Call c.yAxis().setLinearScale(0, 15, 5)
Call c.yAxis().setLabelStyle("arialbd.ttf", 10)
Set layer = c.addLineLayer(data10, cd.DataColor + 4, "XXXX XXXX")
Call layer.setLineWidth(3)
Call layer.getDataSet(0).setDataSymbol(cd.DiamondSymbol, 13)
'Add three bar layers, each representing one data set. The bars are drawn in
'semi-transparent colors.
Set layer = c.addBarLayer2(cd.Stack)
Call layer.addDataSet(data0, cd.DataColor + 0, "XXXX XXXX")
Call layer.addDataSet(data1, cd.DataColor + 1, "XXXX XXXX")
Call layer.addDataSet(data2, cd.DataColor + 2, "XXXX XXXX")
Call layer.addDataSet(Nothing, cd.DataColor + 3, "XXXX XXXX")
Call layer.set3D(6, 15)
Call layer.setBarGap(0.5)
Call layer.setBarShape(cd.SquareShape)
Set layer = c.addBarLayer2(cd.Stack)
Call layer.addDataSet(data4, cd.DataColor + 0)
Call layer.addDataSet(data5, cd.DataColor + 1)
Call layer.addDataSet(data6, cd.DataColor + 3)
Call layer.set3D(6, 15)
Call layer.setBarGap(0.5)
Call layer.setBarShape(cd.SquareShape)
Call layer.setBarShape(cd.StarShape(5))
Set layer = c.addBarLayer2(cd.Stack)
Call layer.addDataSet(data7, cd.DataColor + 0)
Call layer.addDataSet(data8, cd.DataColor + 2)
Call layer.addDataSet(data9, cd.DataColor + 3)
Call layer.set3D(6, 15)
Call layer.setBarGap(0.5)
Call layer.setBarShape(cd.SquareShape)
Call layer.setBarShape(cd.PolygonShape(6))
Call c.addText(390, 325, "AAAAAA", "arialbd.ttf", 10)
Call c.addText(410, 305, "BBBBBB", "arialbd.ttf", 10)
Call c.addText(430, 285, "CCCCCC", "arialbd.ttf", 10)
'output the chart
Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>
|
| |
Re: Depth Bar Chart |
Posted by hotsync on May-03-2007 08:47 |
|
Hi..
I need source codes for Depth Bar Chart as your examples.
Please reply. |
Re: Depth Bar Chart |
Posted by hotsync on May-03-2007 09:19 |
|
For PHP |
Re: Depth Bar Chart |
Posted by Peter Kwan on May-03-2007 21:43 |
|
Hi hotsync,
I have just translated the code in this thread to PHP. Please see the attached.
Hope this can help.
Regards
Peter Kwan
zbar.php |
---|
<?php
require_once("../lib/phpchartdir.php");
#The data for the bar chart
$data0 = array(1, 4, 3);
$data1 = array(5, 4, 0);
$data2 = array(3, 1, 3);
$data4 = array(3, 4, 5);
$data5 = array(5, 2, 2);
$data6 = array(3, 5, 1);
$data7 = array(9, 6, 7);
$data8 = array(3, 5, 4);
$data9 = array(2, 3, 4);
$data10 = array(3, 6, 4);
#The labels for the bar chart
$labels = array("One", "Two", "Three");
#Create a XYChart object of size 500 x 320 pixels
$c = new XYChart(600, 400);
#Set the plotarea at (100, 40) and of size 280 x 240 pixels
$c->setPlotArea(100, 100, 280, 240, 0xeeeeee, 0xffffff);
#Add a legend box at (405, 100)
$b = $c->addLegend(460, 100, 1, "arialbd.ttf");
$b->setBackground(0xdddddd, 0xdddddd, 1);
#Set the labels on the x axis
$c->xAxis->setLabels($labels);
$c->xAxis->setLabelStyle("arialbd.ttf", 10);
$c->xAxis->setTickLength(0);
$c->yAxis->setTickDensity(50);
$c->yAxis->setLinearScale(0, 15, 5);
$c->yAxis->setLabelStyle("arialbd.ttf", 10);
$layer = $c->addLineLayer($data10, DataColor + 4, "XXXX XXXX");
$layer->setLineWidth(3);
$ds = $layer->getDataSet(0);
$ds->setDataSymbol(DiamondSymbol, 13);
#Add three bar layers, each representing one data set. The bars are drawn in
#semi-transparent colors.
$layer = $c->addBarLayer2(Stack);
$layer->addDataSet($data0, DataColor + 0, "XXXX XXXX");
$layer->addDataSet($data1, DataColor + 1, "XXXX XXXX");
$layer->addDataSet($data2, DataColor + 2, "XXXX XXXX");
$layer->addDataSet(null, DataColor + 3, "XXXX XXXX");
$layer->set3D(6, 15);
$layer->setBarGap(0.5);
$layer->setBarShape(SquareShape);
$layer = $c->addBarLayer2(Stack);
$layer->addDataSet($data4, DataColor + 0);
$layer->addDataSet($data5, DataColor + 1);
$layer->addDataSet($data6, DataColor + 3);
$layer->set3D(6, 15);
$layer->setBarGap(0.5);
$layer->setBarShape(SquareShape);
$layer->setBarShape(StarShape(5));
$layer = $c->addBarLayer2(Stack);
$layer->addDataSet($data7, DataColor + 0);
$layer->addDataSet($data8, DataColor + 2);
$layer->addDataSet($data9, DataColor + 3);
$layer->set3D(6, 15);
$layer->setBarGap(0.5);
$layer->setBarShape(SquareShape);
$layer->setBarShape(PolygonShape(6));
$c->addText(390, 325, "AAAAAA", "arialbd.ttf", 10);
$c->addText(410, 305, "BBBBBB", "arialbd.ttf", 10);
$c->addText(430, 285, "CCCCCC", "arialbd.ttf", 10);
# output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
?>
|
| |
|