0
Q
折线图中的目标线
A
回答
2
您可以使用canvasOverlay插件绘制类似的线。 请参阅示例here和文档here。你必须适应下面的代码:
plot1 = $.jqplot('chart1', [s1], {
series:[{...}],
axes: {
xaxis: {
renderer: $.jqplot.CategoryAxisRenderer
}
},
grid: grid,
canvasOverlay: {
show: true,
objects: [
{horizontalLine: {
name: 'targetLine',
y: 1000000, //put here y-value where you want to draw your target line**
lineWidth: 3,
xOffset: 0,
color: 'rgb(89, 198, 154)',
shadow: false
}}
]
}
});
});
P.S. :不要忘了,包括帆布覆盖的插件(external link here - 或你的源代码:jqplot /距离/插件/ jqplot.canvasOverlay.js)
1
看到这个
这里是jQuery代码
$(document).ready(function(){
var target=6;
var data1=[3,7,9,1,5,3,8,2,5];
var data2=[1,2,3,1,3,5,4,3,1];
var data3=[2,3,3,6,5,4,5,1,1];
var targetData=new Array();
for(i=0;i<data1.length;i++)
{
targetData.push(target);
}
var plot2 = $.jqplot ('chart2', [data1,data2,data3,targetData], {
// Give the plot a title.
title: 'Plot With Options',
// You can specify options for all axes on the plot at once with
// the axesDefaults object. Here, we're using a canvas renderer
// to draw the axis label which allows rotated text.
axesDefaults: {
labelRenderer: $.jqplot.CanvasAxisLabelRenderer
},
// Likewise, seriesDefaults specifies default options for all
// series in a plot. Options specified in seriesDefaults or
// axesDefaults can be overridden by individual series or
// axes options.
// Here we turn on smoothing for the line.
seriesDefaults: {
rendererOptions: {
smooth: true
}
},
// An axes object holds options for all axes.
// Allowable axes are xaxis, x2axis, yaxis, y2axis, y3axis, ...
// Up to 9 y axes are supported.
axes: {
// options for each axis are specified in seperate option objects.
xaxis: {
label: "X Axis",
// Turn off "padding". This will allow data point to lie on the
// edges of the grid. Default padding is 1.2 and will keep all
// points inside the bounds of the grid.
pad: 0
},
yaxis: {
label: "Y Axis"
}
}
});
});
相关问题
- 1. SSRS折线图:将平均线/目标线添加到折线图
- 2. 分解折线图中的折线图
- 3. 输入折线图旁边折线图中的趋势线
- 4. r中交错条目的折线图
- 5. 折线图的参考线
- 6. SSRS折线图
- 7. Visifire折线图
- 8. Spotfire - 折线图
- 9. PHP:折线图
- 10. 折线图android
- 11. VB.NET:在折线图中标记点
- 12. SSRS中的折线图
- 13. openpyxl中的折线图
- 14. swift中的折线图3
- 15. matplotlib中的折线图
- 16. 折线图海图
- 17. 谷歌地图折线:标记包含点击LatLng的两个折线坐标
- 18. d3折线图上的标签
- 19. 带图片的折线图?
- 20. HighCharts将折线动画虚线为折线图
- 21. AJAX折线图中Asp.Net
- 22. 更新折线图
- 23. 谷歌折线图
- 24. Laravel jQuery折线图
- 25. dimple.js破折线图
- 26. R 3D折线图
- 27. 创建折线图
- 28. chartjs折线图Javascript
- 29. 折线图问题
- 30. flotr2 - 在折线图