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

Message ListMessage List     Post MessagePost Message

  Can't display thai language in ChartDirector for ASP V. 3.1
Posted by manotai manomun on Jun-22-2011 11:55
Dear Support
   Example Code
<%@ language="vbscript" codepage = "874"  %>

<%
Set cd = CreateObject("ChartDirector.API")

'The data for the chart
data0 = Array(90, 60, 85, 75, 55)
data1 = Array(60, 80, 70, 80, 85)

'  Thai language lebel
labels = Array("ทักษะการบริหารโครงการด้านสารสนเทศ", "ทักษะการบริหารโครงการด้านสารสนเทศ", "ทักษะการบริหารโครงการด้านสารสนเทศ", "ทักษะการบริหารโครงการด้านสารสนเทศ", "ทักษะการบริหารโครงการด้านสารสนเทศ")

'Create a PolarChart object of size 480 x 380 pixels
Set c = cd.PolarChart(480, 380)

'Set background color to gold (goldGradient), with 1 pixel 3D border effect
Call c.setBackground(c.gradientColor(cd.goldGradient, 90, 2), cd.Transparent,1)

'Add a title to the chart using 12 pts Arial Bold Italic font. The title text is
'white (0xffffff) on a black background
Call c.addTitle("Functional Competency", "arialbi.ttf", 12, &Hffffff _
    ).setBackground(&H0)

'Set center of plot area at (240, 210) with radius 150 pixels
Call c.setPlotArea(240, 210, 150)

'Add a legend box at (5, 30) using 10 pts Arial Bold font. Set the background to
'silver (silverGradient), with a black border, and 1 pixel 3D border effect.
Call c.addLegend(5, 30, True, "arialbd.ttf", 10).setBackground( _
    c.gradientColor(cd.silverGradient, 90, 0.5), 1, 1)

'Add an area layer to the chart using semi-transparent blue (0x806666cc). Add a
'blue (0x6666cc) line layer using the same data with 3 pixel line width to
'highlight the border of the area.
Call c.addAreaLayer(data0, &H806666cc, "Expect")
Call c.addLineLayer(data0, &H6666cc).setLineWidth(3)

'Add an area layer to the chart using semi-transparent red (0x80cc6666). Add a
'red (0xcc6666) line layer using the same data with 3 pixel line width to
'highlight the border of the area.
Call c.addAreaLayer(data1, &H80cc6666, "Actual")
Call c.addLineLayer(data1, &Hcc6666).setLineWidth(3)

'Set the labels to the angular axis as spokes.
Call c.angularAxis().setLabels(labels)

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

  Re: Can't display thai language in ChartDirector for ASP V. 3.1
Posted by Peter Kwan on Jun-22-2011 17:04
Dear Manotai,

The issue is because the default font for the axis labels is "Arial", but the Arial font does not have Thai characters.

To solve the problem, please configure another font for the axis labels. For example:

Call c.angularAxis().setLabelStyle("tahoma.ttf", 10)

Hope this can help.

Regards
Peter Kwan