
上QQ阅读APP看书,第一时间看更新
Passing in both x and y values
The next option to pass in data to the chart is to use a two-dimensional array. Our inner array contains individual arrays, which in turn contain the value for x axis followed by the value for y axis. When we include both x
and y
values, our data points may not increment at a constant interval, as was the case in our previous chart:
<script> $(document).ready(function(){ var secondPlot = $.jqplot ('secondChart', [[[5,4],[10,7],[15,6],[20,9]]]); }); </script> <div id="secondChart" style="width:400px;"></div>
We load this new chart in our web browser, and the results are as shown in the following figure:
