Javascript 获取jqplot折线图刻度的线性分布
我想在jqPlot图表渲染器上提供Javascript 获取jqplot折线图刻度的线性分布,javascript,jquery,charts,jqplot,linechart,Javascript,Jquery,Charts,Jqplot,Linechart,我想在jqPlot图表渲染器上提供tickInterval,以获得xaxis上的线性分布 $.jqplot.config.enablePlugins = true; var chartData = [[1, 224], [3, 672], [5, 1120],[15,2240]]; function PlotChart(chartData) { var plot2 = $.jqplot('chart1', [chartData], { title:
tickInterval
,以获得xaxis上的线性分布
$.jqplot.config.enablePlugins = true;
var chartData = [[1, 224], [3, 672], [5, 1120],[15,2240]];
function PlotChart(chartData) {
var plot2 = $.jqplot('chart1', [chartData], {
title: 'Mouse Cursor Tracking',
seriesDefaults: {
renderer: $.jqplot.CanvasAxisLabelRenderer,
rendererOptions: {
smooth: true
},
pointLabels: {
show: true
}
},
axes: {
xaxis: {
label: 'Number of Cookies',
renderer: $.jqplot.CategoryAxisRenderer,
// renderer to use to draw the axis,
tickOptions: {
formatString: '%d'
}
},
yaxis: {
label: 'Calories',
tickOptions: {
formatString: '%.2f'
}
}
},
highlighter: {
sizeAdjust: 7.5
},
cursor: {
show: true
}
});
} PlotChart(chartData);
以上是图表当前外观的示例。我想提供
xaxis
(tickInterval-5)上的点1,5,10,15,20,并且与1,3,5,15相关的图需要在坐标平面上绘制值[[1,224],[3,672],[5,1120],[152240]]
目前,其分布按照xticks
进行,这是不均匀的。欢迎任何帮助
我试着使用min/max和
tickInterval
属性来获取它,但它似乎无法正常运行 如果您想在x轴上提供间隔,那么可以这样做
$.jqplot.config.enablePlugins = true;
var chartData = [[1, 224], [3, 672], [5, 1120],[15,2240]];
function PlotChart(chartData) {
var plot2 = $.jqplot('chart1', [chartData], {
title: 'Mouse Cursor Tracking',
seriesDefaults: {
renderer: $.jqplot.CanvasAxisLabelRenderer,
rendererOptions: {
smooth: true
},
pointLabels: {
show: true
}
},
axes: {
xaxis: {
label: 'Number of Cookies',
min:0,
max:20,
tickInterval:5,
// renderer to use to draw the axis,
tickOptions: {
formatString: '%d'
}
},
yaxis: {
label: 'Calories',
tickOptions: {
formatString: '%.2f'
}
}
},
highlighter: {
sizeAdjust: 7.5
},
cursor: {
show: true
}
});
}
PlotChart(chartData);
在绘制图形之前,可以计算min
、max
和tickInterval
。
我希望这会有所帮助。通过而不是
使用渲染器:$.jqplot.CategoryAxisRenderer
您将按自己的方式运行它。您的代码运行良好。但是看起来您提供的JSFIDLE链接来自我的示例,因此它没有反映出更改。这是最新的-