TH3*_*339 5 javascript jquery jqplot
一个非常简单的问题,但我无法弄清楚...我试图使用jqplot生成一个垂直y轴标签的线图.基于jqplot网站的示例,我只需要使用这个插件jqplot.canvasAxisLabelRenderer.min.js.我在当地试了一下,但没办法.任何人都可以给我一个暗示吗?这是我的问题的演示.
以下是我的代码:
$(document).ready(function(){
$.jqplot.config.enablePlugins = true;
var s1 = $.parseJSON($('#x_indi_val').text());
$.jqplot('chart1', [s1], {
seriesDefaults: {
showMarker:false,
pointLabels: { show:false } ,
},
series:[
{label:'Individuals'}
],
axes: {
xaxis: {
label :'Time units',
pad: 0,
},
yaxis: {
label: 'Number of individuals',
//jqplot example indicated that use the following js file can give you a vertical label, I tried locally, but it did not work
//renderer: $.jqplot.canvasAxisLabelRenderer
}
},
legend: {
show: true,
location: 'ne',
placement: 'inside',
fontSize: '11px'
}
});
})?;
Run Code Online (Sandbox Code Playgroud)
您在代码中遇到了一些小问题,如提供的演示示例中所示:
您忘记导入标签渲染器所需的两个脚本:
<script type="text/javascript" src="../src/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="../src/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
您正在设置轴的渲染器而不是轴的标签渲染器:
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
| 归档时间: |
|
| 查看次数: |
7529 次 |
| 最近记录: |