Chinese display of jpgraph ....

Source: Internet
Author: User

Introduction: This is a Chinese display of jpgraph .... The details page of PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 326434 'rolling = 'no'>

I read a post here two days ago... With jpgraph, I think it is really very practical. It really saves us a lot of effort in graph statistics, so I 've been trying it out. Later I saw it:
Note: This information is only given here for very advanced users. no free support will ge given in the case you run into difficulties trying to add new fonts. at the moment adding new fonts require code modifications as outlined below.

At this time, my enthusiasm is less than half .... Can a rookie like me only use simsun. TTF? Later, I tried to change the names of many Chinese fonts to simsun. TTF, and found that most of the Chinese fonts can be displayed normally... (It may be in all Chinese characters). I don't dare to enjoy it exclusively. Now I will post the usage method to share it with you (I think many experts may already know the method, then I am here to show you ugly ..).

When using a class with text display, you must use the setfont method to set the font. The font has three parameters: font name, Font, and size. Currently, jpgraph only supports simsun fonts in Chinese. To use jpgraph, use the following method:
First in jpgraph. use define ("ttf_dir", "/usr/local/fonts/TTF/") in PHP to define the font path (you can put the font here later)
Then find the line comment "// Chinese font" in jpgraph. php"
Define ("ff_simfang", 9, "9" indicates the value of this constant. If it is not the same as its original value, no value is correct. If it is not large)

Now launch an image:
Find the comment "// constructor" (here, you must know what is going on) and add the following content to the array:
Ff_simfang => array (fs_normal => 'simfang ', fs_bold =>', fs_italic => ', fs_bolditalic =>'), which has four items, the first is the standard font, the second is the bold, the third is the italic, and the fourth is the bold italic. Each item corresponds to a font file. Their value is the font file name with the extension. If not, you do not need to fill it out, except for the standard.
Here, the general English font has been added, but the Chinese character is still restricted. The key lies in the following:
Find the languageconv class, that is, find "class languageconv"
In the function convert (), use the "elseif ($ aff = ff_simsun)" or ("|") to add your previously defined name, for example, "$ aff = ff_simfang"

Okay. Now you can try it. It's done !!

Love J2EE follow Java Michael Jackson video station JSON online tools

Http:// pageno: 13.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.