使用 jqPlot 强调 x 轴上的 0
当用 jqPlot 绘制图形时,我的曲线包含正值和负值,因此与 x 轴交叉。我想强调 0 处的 x 轴,以便更清楚地区分正值和负值。有办法做到这一点吗?
在我使用的代码下方有一个示例曲线:
$.jqplot(
'plotDiv',
[[[40,-5], [41,-5], [42,-5], [43,-5], [44,-5], [45,-5],
[46,-5], [47,-5], [48,-5], [49,-5], [50,-5], [51,-4],
[52,-3], [53,-2], [54,-1], [55,0], [56,1], [57,2], [58,3], [59,4], [60,5]]],
{ title:{text:"Results"},
axes: {
yaxis: {tickInterval: 2, label: 'Profit'},
xaxis: {tickInterval: 2, label: 'Price'}}});});
提前致谢
when plotting a graph with jqPlot I have curves which contains both positive and negative values, thus crossing the x-axis. I would like to emphasize the x-axis at 0 to distinguish positive and negative values more clearly. Is there a way to do this ?
Below the code I'm using with an example curve:
$.jqplot(
'plotDiv',
[[[40,-5], [41,-5], [42,-5], [43,-5], [44,-5], [45,-5],
[46,-5], [47,-5], [48,-5], [49,-5], [50,-5], [51,-4],
[52,-3], [53,-2], [54,-1], [55,0], [56,1], [57,2], [58,3], [59,4], [60,5]]],
{ title:{text:"Results"},
axes: {
yaxis: {tickInterval: 2, label: 'Profit'},
xaxis: {tickInterval: 2, label: 'Price'}}});});
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用画布覆盖在 y=0 上画一条线:
更多使用画布覆盖的示例可以在 jqPlot 下载包中的“examples\canvasOverlay.html”中找到。
You could draw a line on y=0 using the canvas overlay:
More examples using the canvas overlay can be found in "examples\canvasOverlay.html" in the jqPlot downloaded package.