【发布时间】:2013-02-26 11:19:51
【问题描述】:
我正在使用 jqPlot 创建条形图,但遇到了一些问题。
问题 1: 图表上的第一个和最后一个条被截断。只显示了一半
问题 2:我不希望我的数据点跨越整个 x 轴。有没有数据跨越整个x轴?
ex: 这就是现在所做的。
这是我传递给它的数据
var chartData = [["19-Jan-2012",2.61],["20-Jan-2012",5.00],["21-Jan-2012",6.00]]
这是我正在使用的 jquery。
// Plot chart
function PlotChart(chartData, numberOfTicks) {
$.jqplot.config.enablePlugins = true;
var plot2 = $.jqplot('chart1', [chartData], {
title: 'Mouse Cursor Tracking',
seriesDefaults:{
renderer: $.jqplot.BarRenderer,
rendererOptions: {
barPadding: 1,
barMargin: 15,
barDirection: 'vertical',
barWidth: 50
},
pointLabels: { show: true }
},
axes: {
xaxis: {
pad: 0, // a factor multiplied by the data range on the axis to give the
numberTicks: numberOfTicks,
renderer: $.jqplot.DateAxisRenderer, // renderer to use to draw the axis,
tickOptions: {
formatString: '%b %#d' // format string to use with the axis tick formatter
}
},
yaxis: {
tickOptions: {
formatString: '$%.2f'
}
}
},
highlighter: {
sizeAdjust: 7.5
},
cursor: {
show: true
}
});
}
【问题讨论】:
-
改变你的 xaxis 垫,改变或不硬核滴答数。
-
我尝试更换垫子,但没有任何效果。刻度数设置为要显示的项目数...我会尝试增加它
-
增加项目数量没有影响
标签: jquery jquery-plugins jqplot