我正在制作一个几乎不需要帮助的图表。(我已经用谷歌搜索了很多但无法成功,这就是为什么要问。 - 如果可能重复我道歉。)
我的代码:
var plot2 = $.jqplot('distance_graph', data.distance, {
// The "seriesDefaults" option is an options object that will
// be applied to all series in the chart.
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {fillToZero: false},
pointLabels: { show: true },
},
// Custom labels for the series are specified with the "label"
// option on the series option. Here a series option object
// is specified for each series.
// Show the legend and put it outside the grid, but inside the
// plot container, shrinking the grid to accomodate the legend.
// A value of "outside" would not shrink the grid and allow
// the legend to overflow the container.
legend: {
show: true,
placement: 'outsideGrid'
},
axes: {
// Use a category axis on the x axis and use our custom ticks.
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
label: 'Date',
ticks: ticks,
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions: {
angle: -30
}
},
// Pad the y axis just a little so bars can get close to, but
// not touch, the grid boundaries. 1.2 is the default padding.
yaxis: {
label: 'Distance Travelled',
pad: 1.05,
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions: {
labelPosition:'middle'
},
min:min_val,
max:max_val
}
}
});
plot2.legend.labels = data.device;
plot2.replot( { resetAxes: false } );
以及如何删除 0 值,因为我正在将此图表转换为多个项目的图表。这目前是一个项目的图表.. 那么如何删除 0 个标签也......