ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  '-' in labels
Posted by Brian on Jul-16-2011 09:11
Attachments:
Hi

I have some text that is not in a chart director expression but just in a label, it contains a '-' ie 2001-2005 etc

anything after and including the '-' is not shown so it looks like chart director is trying to parse the - as an expression.

Have you a work around...

in the example the text is actually 'non-debt' but only non is showing up on the legend or the pie chart labels.

and the calls to set the text are

Call Box.setText( _
"<*block,valign=top*><*block,width=160*>" & _
"{label}<*/*><*block,width=40,halign=right*>{value|2}<*/*>%")

and

Call Pie.setLabelFormat("{field0}")

Thanks in advance

Brian
Image2.png

  Re: '-' in labels
Posted by Peter Kwan on Jul-19-2011 00:20
Attachments:
Hi Brian,

I have tried your code by modifying the "Legend Pie Chart" sample code, and the "Non-Debt" is shown normally. I have attached my test code and the resulting chart.

If the above still does not solve the problem, is it possible to provide an example that can illustrate the problem? May be you can modify your existing charting code to use hard coded data, and inform me of the resulting code. If you cannot post your code in this forum, may be you can email to me at pkwan@advsofteng.net

Regards
Peter Kwan
legendpie.png
legendpie.asp
<%@ language="vbscript" %>
<%
Set cd = CreateObject("ChartDirector.API")

' The data for the pie chart
data = Array(25, 18, 15, cd.NoValue, 8, 30, 35)

' The labels for the pie chart
labels = Array("Labor", "Licenses", "Taxes", "Legal", "Non-Debt", "Facilities", _
    "Production")

' Create a PieChart object of size 600 x 270 pixels
Set c = cd.PieChart(600, 270)

' Set the center of the pie at (150, 100) and the radius to 80 pixels
Call c.setPieSize(150, 135, 100)

' add a legend box where the top left corner is at (330, 50)
Call c.addLegend(330, 60)

' modify the sector label format to show percentages only
Call c.setLabelFormat("{label}")

' Set the pie data and the pie labels
Call c.setData(data, labels)

' Use rounded edge shading, with a 1 pixel white (FFFFFF) border
Call c.setSectorStyle(cd.RoundedEdgeShading, &Hffffff, 1)

Call c.getLegend().setText( _
"<*block,valign=top*><*block,width=160*>" & _
"{label}<*/*><*block,width=40,halign=right*>{value|2}<*/*>%")


' Output the chart
Response.ContentType = "image/png"
Response.BinaryWrite c.makeChart2(cd.PNG)
Response.End
%>

  Re: '-' in labels
Posted by Brian on Jul-19-2011 03:00
Hi Peter

I ran your code and you are correct it works like you say it does....

I stripped out my database code and it was fine using statics, I should have done that first. then I looked at the database call supplying the data, the - was used as a delimiter and was being stripped out.

To everybody reading this:

The problem was not in Chart Director.... it was a stupid bug in my code...

Sorry, to have wasted your time...

Brian