使用不同颜色设置绘图不同部分的背景颜色 jqplot

发布于 2024-11-03 00:15:56 字数 239 浏览 9 评论 0原文

我想设置具有不同颜色的图表部分的背景颜色。并且还能够使轴刻度也可点击,特别是对于 jqplot 和 flot。我已经能够用 highcharts 做到这一点。你可以看看我做了什么: http://jsfiddle.net/fonpah/jPrvK/4/ 。如果有人可以用 jqplot 或 flot 做同样的事情,我将非常感激。 谢谢

i want to set the background color of portions of a graph with diffrent colors. and also to be able to make the axis ticks also clickable particularly for jqplot and flot. i have been able to do that with highcharts. you can have a look at what i did : http://jsfiddle.net/fonpah/jPrvK/4/ . i would really appreciate it if anyone can do thesame thing with jqplot or flot.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恰似旧人归 2024-11-10 00:15:56

flot 使画布可供您使用,因此您可以轻松地将代码从高图表示例翻译到那里。

var plot = $.plot(...);
var ctx = plot.getCanvas().getContext("2d"); //get the canvas

var point1 = plot.pointOffset({ x: 5, y: 5}); //translate a value to pixels
var point2 = plot.pointOffset({ x: 10, y: 10}); 

//fill and draw a rectangle
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect(point1.x,point1.y,point2.x,point2.y);

有关详细信息,请参阅注释示例

flot makes the canvas available to you, so you can easily translate your code from your high-charts example to there.

var plot = $.plot(...);
var ctx = plot.getCanvas().getContext("2d"); //get the canvas

var point1 = plot.pointOffset({ x: 5, y: 5}); //translate a value to pixels
var point2 = plot.pointOffset({ x: 10, y: 10}); 

//fill and draw a rectangle
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect(point1.x,point1.y,point2.x,point2.y);

See the annotating example for details.

我不是你的备胎 2024-11-10 00:15:56

使用 Flot,使用 {fill=true} 选项可以非常轻松地绘制填充区域,例如:

lines: { show: true, fill: true, fillColor: "#98FB98" },

With Flot, it's very easy to draw fill area using the {fill=true} option e.g.:

lines: { show: true, fill: true, fillColor: "#98FB98" },

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文