|
Data values in the x axis on a bar chart |
Posted by Brian on Jul-18-2011 19:33 |
|
Hi
I know im doing some thing stupid... but Ive looked all over the forum and cant find the answer
I want to put the % values in my swaped bar chart
but when ever try and set the values the text labels appear
Hope you can help again
Brian
code
Set layer = c.addBarLayer3(data,colors)
Call c.swapXY(True)
Set box = c.xAxis().setLabels(labels)
Call c.xAxis().setLabelFormat("{value}%")
Call layer.setAggregateLabelFormat( "{xLabel}")
'Call layer.setDataLabelFormat( "{value}%")
i have tried value and values as the parameter, no luck
I cant see what I am doing wrong...
|
Re: Data values in the x axis on a bar chart |
Posted by Peter Kwan on Jul-19-2011 01:59 |
|
Hi Brian,
In an XYChart, there can be many layers. The x-axis is shared by all layers. It is not controlled by any particular layer, and does not use the data in any layer.
If you want to set the labels on the x-axis, just set it directly using Axis.setLabels or Axis.setLabels2 (instead of going through a layer). For example, instead of c.xAxis().setLabels(labels), you may try:
Call c.xAxis().setLabels2(data, "{value}%")
Hope this can help.
Regards
Peter Kwan |
Re: Data values in the x axis on a bar chart |
Posted by Brian on Jul-19-2011 03:36 |
|
Hi Peter
I tried Call c.xAxis().setLabels2(data, "{value}%") then I just got the percentages on the axis and at the end of the data
If I did it as before I got the text in both places
I have stripped out all the database code and my setLicenseCode for your inspection see below
and I include the 2 results I get
What I would like is the Percentages on the xaxis(swapped) and the text following the bar.
Hope this is ok
Brian
<%@LANGUAGE=VBSCRIPT%>
<%OPTION EXPLICIT%>
<%
dim CD
dim c
dim Layer
Dim Data,Colors,Labels
Data=Array(10.0,6.0,5.0,15.0,35.0,20.0)
Colors = Array(&Hb8bc9c, &Hecf0b9, &H999999, &H666699, &Hc3c3e6, &H898390, &Ha0bdc4)
Labels=Array("First","Second","Third","Fourth","Fifth","Sixth")
Set CD = CreateObject("ChartDirector.API")
Set c = CD.XYChart(490, 200)
Call c.setPlotArea(30, 5, 350, 190, CD.Transparent, CD.Transparent, CD.Transparent, CD.Transparent, CD.Transparent)
' I added the extra parameter labels and that didnt help
Set layer = c.addBarLayer3(data,colors,labels)
Call c.swapXY(True)
Call layer.setAggregateLabelFormat( "{xLabel}")
'call c.xAxis().setLabels(labels) ' Comment this or the next line out
Call c.xAxis().setLabels2(data, "{value}%")
Response.ContentType="image/gif"
Response.BinaryWrite c.makeChart2(CD.GIF)
Set c = Nothing
Set CD = Nothing
%>
|
|