【问题标题】:Graphing this with Jquery.Flot or similar用 Jquery.Flot 或类似工具绘制这个
【发布时间】:2011-09-03 20:31:40
【问题描述】:
我正在尝试使用 Flot 绘制此图表。有一条从 0 到 10 的平线(在 y=1 处)。并且在 x=2、x=3、x=7 处的点也都在 y=1 处。
________O____O_______________O_____________
0 1 2 3 4 5 6 7 8 9 10
我也愿意接受除 Flot 之外的任何其他内容,如果有一个明确的示例如何做我想做的事情,我几乎可以复制/粘贴。
【问题讨论】:
标签:
javascript
jquery
flot
graphing
【解决方案1】:
使用 flot 非常简单:
<div id="placeholder" style="width:600px;height:300px;"></div>
<script type="text/javascript">
$(function () {
var someLine = [[0, 1], [10, 1]];
var somePoints = [[2,1],[3,1],[7,1]];
$.plot($("#placeholder"),[
{
data: someLine,
lines: { show: true}
},
{
data: somePoints,
points: { show: true}
}
]);
});
</script>