1、调用JS代码:
<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript" src="jqplot.js"></script>
2、添加HTML代码:
加入
<!--效果html开始-->......
<!--效果html结束-->之间的html代码;放在<body></body>之间。
3、代码调用:
<script type="text/javascript">
$(document).ready(function() {
var data = [[1,2,3,4,5,6,7,8,9],[3,6,8,1,11,22,4,21,6]];
var data_max = 30; //Y轴最大刻度
var line_title = ["A","B"]; //曲线名称
var y_label = "这是Y轴"; //Y轴标题
var x_label = "这是X轴"; //X轴标题
var x = [1,2,3,4,5,6,7,8,9]; //定义X轴刻度值
var title = "这是标题"; //统计图标标题
j.jqplot.diagram.base("chart1", data, line_title, "曲线图", x, x_label, y_label, data_max, 1);
j.jqplot.diagram.base("chart2", data, line_title, "柱状图", x, x_label, y_label, data_max, 2);
});
</script>