Use jqplot to draw a line chart and jqplot to draw a line chart.

Source: Internet
Author: User

Use jqplot to draw a line chart and jqplot to draw a line chart.

First, you need to download the js and css files required by jqplot. I have nearly packed them. You can download them if you need them.

Next, import the key js and css as follows,

<link href="css/jquery.jqplot.min.css" rel="stylesheet" /><script src="js/jquery.min.js"></script><script src="js/jquery.jqplot.min.js"></script><script src="js/jqplot.canvasTextRenderer.js"></script><script src="js/jqplot.canvasAxisLabelRenderer.js"></script>

Html section

<Div id = "chart" style = "width: 500px; height: 300px;"> </div> pay attention to the id and $. the first parameter in jqplot ('chart', data, option) corresponds

Js Section

$ (Function () {var cosPoints = []; for (var I = 0; I <2 * Math. PI; I + = 0.4) {cosPoints. push ([I, 2.5 + Math. pow (I/4, 2)]);} $. jqplot ('chart', [[1, 3, 4, 5, 6], [5, 6, 8, 9, 12], [3, 6, 7, 8, 9], cosPoints], {// $. jqplot ('chart', data, option); target: the position to be displayed. Data: The displayed data. Options: Other stackSeries: false, // if it is set to true and has multiple categories (if it is a line chart, there must be more than one line chart), then each category (line chart) the value on the vertical axis is the sum of the values of the vertical axis and its vertical axis of all previous categories. The value of the Axis value is the sum of the values (for example, the current vertical axis value is Y3 title: 'My line my', axes: {xaxis: {label: 'x axis ', // specifies the description text pad: 0} for the X axis, yaxis: {label: 'y axis', pad: 0 }}, series: [{lineWidth: 3, // specify the width of the line markerOptions: {style: "dimaond"} // specify the line style}, {// showLine: false, // specify whether to display the line markerOptions: {size: 5, style: "circle"} // size to set the size of each node}, {markerOptions: {style: "filledSquare" }}, {showMarker: false} // corresponds to four lines respectively], grid: {gridLineColor: '#978887' // set the color of the grid background of the entire icon area }});});

I have explained the key points in the code. You can download the code by yourself.

Link: http://pan.baidu.com/s/1pKIX41d password: 2as7

Related Article

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.