|
Classic ASP Multi Bar Chart |
Posted by Hari on Jun-08-2012 22:17 |
|
I am trying to create a 3 bars side by side chart. I am able to display 2 but not 3, please
let me know what i am doing wrong.
Here is my code.
data = cd.RecordSetToArray(rsOrder)
labels = data(0)
PrevYr = data(1)
CurYr = data(2)
PrevYearRMA = data(3)
PrevYrVal = Year(Now) - 1
CurYrVal = Year(Now)
' Create a XYChart object of size 400 x 240 pixels.
Set c = cd.XYChart(990, 360)
Call c.addTitle("BRE Yearly Revenue" , "timesbi.ttf", 14)
Call c.setPlotArea(60, 40, 850, 260, c.linearGradientColor(60, 40, 60, 220, _
&Hffffff, &Hcccc00), -1, &Hcc00ff, &Hffffff)
'Legend
Call c.addLegend(60, 30, 0, "", 8).setBackground(cd.Transparent)
'X - Axis
'Side by side bar
Set layer = c.addBarLayer2(cd.Side)
'Call layer.setBarGap(0.2,0.1)
Call layer.addDataSet(PrevYr, &Hff7020, PrevYrVal)
Call layer.addDataSet(CurYr, &H9000, CurYrVal)
Call layer.addDataSet(PrevYr, &Hff7020, PrevYearRMA)
Call layer.setBarShape(cd.CircleShape)
Call c.xAxis().setLabels(labels)
Call c.xAxis().setLabelStyle("arialbd.ttf", 8)
Call c.xAxis().setTitle("Month")
Call c.yAxis().setTitle("Revenue")
'Call c.xAxis().setLabels(labels).setFontAngle(90)
' output the chart in PNG format
Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG) |
Re: Classic ASP Multi Bar Chart |
Posted by Peter Kwan on Jun-09-2012 00:32 |
|
Hi Hari,
I believe there may be an error in the following code:
Call layer.addDataSet(PrevYr, &Hff7020, PrevYearRMA)
It should be something like:
'assuming PrevYearRMA is an array of numbers
Call layer.addDataSet(PrevYearRMA, &Hff7020, "xxx")
Hope this can help.
Regards
Peter Kwan |
|