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

Message ListMessage List     Post MessagePost Message

  No label shown on the chart.
Posted by Marty on May-23-2012 09:58
I just use the Simple Bar Chart code to try it.
But no labels shown on the chart.
Please help!

  Re: No label shown on the chart.
Posted by Marty on May-23-2012 10:01
Attachments:
Update the Attachment chart.
untitled.bmp
untitled.bmp

190.05 Kb

  Re: No label shown on the chart.
Posted by Marty on May-23-2012 10:50
Python code on CentOS

from pychartdir import *

# The data for the bar chart
data = [85, 156, 179.5, 211, 123]

# The labels for the bar chart
labels = ["Mon", "Tue", "Wed", "Thu", "Fri"]

# Create a XYChart object of size 250 x 250 pixels
c = XYChart(250, 250)

# Set the plotarea at (30, 20) and of size 200 x 200 pixels
c.setPlotArea(30, 20, 200, 200)

# Add a bar chart layer using the given data
c.addBarLayer(data)

# Set the labels on the x axis.
c.xAxis().setLabels(labels).setFontColor("0xcccccc")

# Output the chart
print("Content-type: image/png\\n")
binaryPrint(c.makeChart2(PNG))

Marty wrote:

I just use the Simple Bar Chart code to try it.
But no labels shown on the chart.
Please help!

  Re: No label shown on the chart.
Posted by Marty on May-23-2012 11:15
Attachments:
I tried some other samples.
I found all the character can not display

This is another code in CentOS.And attachment is the chart.

from pychartdir import *

# The data for the bar chart
data0 = [100, 125, 245, 147, 67]
data1 = [85, 156, 179, 211, 123]
data2 = [97, 87, 56, 267, 157]

# The labels for the bar chart
labels = ["Mon", "Tue", "Wed", "Thu", "Fri"]

# Create a XYChart object of size 500 x 320 pixels
c = XYChart(500, 320)

# Set the plotarea at (100, 40) and of size 280 x 240 pixels
c.setPlotArea(100, 40, 280, 240)

# Add a legend box at (400, 100)
c.addLegend(400, 100)

# Add a title to the chart using 14 points Times Bold Itatic font
c.addTitle("Weekday Network Load", "timesbi.ttf", 14)

# Add a title to the y axis. Draw the title upright (font angle = 0)
c.yAxis().setTitle("Average\\nWorkload\\n(MBytes\\nPer Hour)").setFontAngle(0)

# Set the labels on the x axis
c.xAxis().setLabels(labels)

# Add a stacked bar layer and set the layer 3D depth to 8 pixels
layer = c.addBarLayer2(Stack, 8)

# Add the three data sets to the bar layer
layer.addDataSet(data0, '0xff8080', "Server # 1")
layer.addDataSet(data1, '0x80ff80', "Server # 2")
layer.addDataSet(data2, '0x8080ff', "Server # 3")

# Enable bar label for the whole bar
layer.setAggregateLabelStyle()

# Enable bar label for each segment of the stacked bar
layer.setDataLabelStyle()

# Output the chart
print("Content-type: image/png\\n")
binaryPrint(c.makeChart2(PNG))
untitled.bmp
untitled.bmp

79.92 Kb

  Re: No label shown on the chart.
Posted by Peter Kwan on May-23-2012 23:28
Hi Marty,

Have you included the fonts subdirectory when you install ChartDirector for Python? If you do not include the ofnts subdirectory, the chart will not have text, because there are no fonts.

According to the Installation section of the ChartDirector Documentation, you should copy *everything* ((including the fonts subdirectory in Linux, FreeBSD and Solaris versions) from "ChartDirector/lib" to a directory in your Python module search path.

Please let me know if the above can solve the problem.

Regards
Peter Kwan

  Re: No label shown on the chart.
Posted by Marty on May-24-2012 08:08
I copy the fonts directory to Python directory.
Then it works!

Thank you very much!