Javascript jqPlot仅在刷新页面后工作
除了jQuery之外,我还想使用jqPlot来显示图表等等 添加所有文件后,我运行代码,页面为空。我按刷新,图表出现 我已将所有文件包括在我的: 连同一些js:Javascript jqPlot仅在刷新页面后工作,javascript,jquery,asp.net-mvc,jqplot,Javascript,Jquery,Asp.net Mvc,Jqplot,除了jQuery之外,我还想使用jqPlot来显示图表等等 添加所有文件后,我运行代码,页面为空。我按刷新,图表出现 我已将所有文件包括在我的: 连同一些js: <script> $(document).ready(function () { var data = [ ['Heavy Industry', 12], ['Retail', 9], ['Light Industry', 14],
<script>
$(document).ready(function () {
var data = [
['Heavy Industry', 12], ['Retail', 9], ['Light Industry', 14],
['Out of home', 16], ['Commuting', 7], ['Orientation', 9]
];
var plot1 = jQuery.jqplot('chart1', [data],
{
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true
}
},
legend: { show: true, location: 'e' }
}
);
});
</script>
最后,在我的发言中:
据我所知,我搞乱了文件的顺序,因为它们是在刷新后加载的。
该图表没有出现在IE9中,即使在刷新“是”之后,我也包括了excanvas.js
有人能帮我吗
提前谢谢,如果您遗漏了任何信息,请告诉我。我也有同样的问题。我所做的是创建一个函数来构建我的图表,一个事件页面中显示的绘图 $document.onpageshow,函数{ console.log'pageshow'; 多普洛特; }; 我的doPlot函数是:
function doPlot(){
var arrayValores = [];
// listaValores is an array that i send as model attribute from backend
$.each(JSON.parse(listaValores), function(idx, obj) {
var actual = [obj.fechaAccion, obj.valorAccion]
arrayValores.push(actual);
});
var plot = $.jqplot('accion-chart', [arrayValores], {
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickOptions:{formatString:'%H:%M'},
}
},
series:[{lineWidth:1,
markerOptions: { style:'none', display: 'none' },
showMarker:false}],
seriesColors:["#FF0000"]
});
if (plot) {
plot.destroy();
}
plot.replot();
}
我希望有帮助。问候。IE 9及以上版本不需要excanvas.js。您是否在控制台中看到任何错误?不,调试没有帮助,没有错误。
<div id="chart1" style="height:300px; width:500px;"></div>
function doPlot(){
var arrayValores = [];
// listaValores is an array that i send as model attribute from backend
$.each(JSON.parse(listaValores), function(idx, obj) {
var actual = [obj.fechaAccion, obj.valorAccion]
arrayValores.push(actual);
});
var plot = $.jqplot('accion-chart', [arrayValores], {
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer,
tickOptions:{formatString:'%H:%M'},
}
},
series:[{lineWidth:1,
markerOptions: { style:'none', display: 'none' },
showMarker:false}],
seriesColors:["#FF0000"]
});
if (plot) {
plot.destroy();
}
plot.replot();