我正在使用 jqplot 并且我已经绘制了来自数组 php 的数据但是当我尝试从 javascript 绘制时不起作用
这是代码php:
$array= array();
$array[] = 34.890;
$array[] = 25.090;
现在代码吸收:
<script>
$(function() {
var array = new Array();
<?php
for( $i=0; $i<count($array); $i++){
echo "\narray[$i] = '$array[$i]';";
}
?>
graficar( array );
});
</script>
函数 graficar 是:
function graficar( array )
{
var plot2 = $.jqplot('lienzo',
[
array
],
{
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
// Show point labels to the right ('e'ast) of each bar.
// edgeTolerance of -15 allows labels flow outside the grid
// up to 15 pixels. If they flow out more than that, they
// will be hidden.
pointLabels: {show: true, location: 'e', edgeTolerance: -15},
// Rotate the bar shadow as if bar is lit from top right.
shadowAngle: 135,
// Here's where we tell the chart it is oriented horizontally.
rendererOptions: {
barDirection: 'horizontal',
barWidth:18
}
},
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer
}
}
}
);
}
我得到的错误是:
TypeError: this[r]._ticks[0] is undefined
[Break On This Error]
...{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAt...
图表显示:
如何解决我的麻烦?
坦克。