Pchart Chart Chinese display problem
Project needs, chart display data, personal ability Limited,
/* Cat:bar Chart */
Header ("content-type:text/html; Charset=utf-8 ");
/* Pchart Library inclusions */
Include ("class/pdata.class.php");
Include ("class/pdraw.class.php");
Include ("class/pimage.class.php");
/* Create and populate the PData object */
$MyData = new PData ();
$MyData->addpoints (Array (150,220,300,250,420,200,300,200,100), "test");
$MyData->setaxisname (0, "Hits");
$MyData->addpoints (Array ("January", "February", "March", "April", "May", "June", "July", "August", "September"), "Months");
$MyData->setseriedescription ("Months", "Month");
$MyData->setabscissa ("Months");
/* Create the Pchart object */
$myPicture = new Pimage (700,230, $MyData);
/* Turn of antialiasing */
$myPicture->antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawgradientarea (0,0,700,230,direction_vertical,array ("Startr" =>240, "STARTG" =>240, "StartB "=>240," Endr "=>180," ENDG "=>180," Endb "=>180," Alpha "=>100));
$myPicture->drawgradientarea (0,0,700,230,direction_horizontal,array ("Startr" =>240, "STARTG" =>240, " STARTB "=>240," Endr "=>180," ENDG "=>180," Endb "=>180," Alpha "=>20));
$myPicture->drawrectangle (0,0,699,229,array ("R" =>0, "G" =>0, "B" =>0));
/* Set The default font */
$myPicture->setfontproperties (Array ("fontname" = "Fonts/pf_arma_five.ttf", "FontSize" =>6));
/* Define the chart area */
$myPicture->setgrapharea (60,40,650,200);
/* Draw the scale */
$scaleSettings = Array ("GRIDR" =>200, "GRIDG" =>200, "Gridb" =>200, "Drawsubticks" =>true, "Cyclebackground" =>true);
$myPicture->drawscale ($scaleSettings);
/* Write the chart legend */
$myPicture->drawlegend (580,12,array ("Style" =>legend_noborder, "Mode" =>legend_horizontal));
/* Turn on Shadow Computing */
$myPicture->setshadow (True,array ("X" =>1, "Y" =>1, "R" =>0, "G" =>0, "B" =>0, "Alpha" =>10));
/* Draw the chart */
$myPicture->setshadow (True,array ("X" =>1, "Y" =>1, "R" =>0, "G" =>0, "B" =>0, "Alpha" =>10));
$settings = Array ("Surrounding" =>-30, "innersurrounding" =>30);
$myPicture->drawbarchart ($settings);
Ob_clean (); Key code to prevent the ' image cannot be displayed because of its own error '.
Header ("Content-type:image/png");
/* Render the picture (choose the best) */
$myPicture->autooutput ("Examples/pictures/example.drawbarchart.simple.png");
How to put $MyData->addpoints (Array (150,220,300,250,420,200,300,200,100), "test"), the string test is displayed in Chinese, how to $MyData Setaxisname (0, "Hits"), display Chinese, such as $MyData->setaxisname (0, "set");
------Solution--------------------
Is it not possible to write directly in Chinese?
------Solution--------------------
Comment out the header ("content-type:text/html; Charset=utf-8 ");
------Solution--------------------
Is it the latest version?
See you later, next.
------Solution--------------------
1, the header is not, because you are the image of the way out
2, you choose the font is a Western text body, no Chinese characters can not be displayed, you need to choose a Chinese font
3, if your program is not utf-8, then all the characters to be exported must be converted into Utf-8