Huang Cong: how to use Open Flash Chart in php

Source: Internet
Author: User

To draw a beautiful table, I found OpenFlashChart (ofc) on the Internet, which is very good. After several days of research, I finally drew my own table. Let's take a look at my table (here is only one ):

Okay. It may be too stupid. It costs a lot of twists and turns out. Let's talk about the simple steps and hope to provide some help to interested friends.

1. Download Open Flash Chart:Http://sourceforge.net/projects/openflashchart/files/

2. openflashchart(After the name is changed) Put it under the root directory of the website, and according to the instructions, put the js folder separately under the root directory.

3. Create the chart.htm FileAnd save the following content in the openflashchart directory.

4. Compile the PHP FileThe provided json data file data. php contains the following content and is saved to the openflashchart directory.

<? Phprequire_once ('ofc/ofc_chart.php'); $ title = new OFC_Elements_Title ('My first table :'. date ("d m d Y"); // set the line $ line_dot = new OFC_Charts_Line (); $ line_dot-> set_values (array (6, 2, 7, 8, 10, 12, 7, 6, 5, 12, 10, 9, 11, 4, 3, 2, 1); $ line_dot-> set_colour ('# D7E4A3'); $ line_dot1 = new OFC_Charts_Line (); $ line_dot1-> set_values (array (2, 4, 6, 8, 11, 9, 12, 8, 10, 6, 15, 14, 8, 6, 8, 9, 2, 1 )); // set the icon and the XY axis $ chart = new OFC_Chart (); $ chart-> set_title ($ Title); $ x = new OFC_Elements_Axis_X (); $ x-> set_offset (false); $ x-> set_steps (1 ); $ x-> set_colour ('# A2ACBA'); $ x-> set_range (, 1); $ y = new OFC_Elements_Axis_Y (); $ y-> set_range, 1); $ y-> set_steps (1); $ y-> set_colour ('# A2ACBA'); $ chart-> set_x_axis ($ x ); $ chart-> set_y_axis ($ y); // Add coordinates $ chart-> add_element ($ line_dot); $ chart-> add_element ($ line_dot1 ); echo $ chart-> toPrettyString ();?>

5. You can see from the data file that you want to use the ofc/ofc_chart.php FileTo copy the ofc folder under the open-flash-chart \ php5-ofc-library \ lib directory to the openflashchart directory.

6. Open your browser and enter the address.For example: http: // localhost/openflashchart/chart.htm? Ofc = data. php, you can see your own picture.

 

 

 

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: info-contact@alibabacloud.com 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.