jqplot 实用技巧——重绘

技巧一:
当浏览器窗体大小改变时:
$('#resizable1').bind('resize', function(event, ui) {
    plot1.replot( { resetAxes: true } );
});


技巧二:
重新加载数据进行重绘时:
chartObj.series[0].data = [[0, 4], [1, 7], [2, 3]];
chartObj.replot();


技巧三:
改变plot的ticks:
plot.axes.yaxis.reset();
plot.axes.yaxis.ticks = new_yticks;
plot.replot();


技巧四:
浏览器窗体大小变更后指定图表大小:
$('#resizable2').bind('resizestop', function(event, ui) {
    $('#chart2').height($('#resizable2').height()*0.96);
    $('#chart2').width($('#resizable2').width()*0.96);
    plot2.replot({resetAxes:true});
});


技巧四:
浏览器窗体大小变更后重置BarChart图表的bar(柱子)大小:
$.each(plot.series, function(index, series) {
    series.barWidth = undefined;
});

plot.replot({
    resetAxes : true
});

你可能感兴趣的:(JavaScript,jquery,UI,jqplot,chart)