Dynamically udpate canvasOverlay property of jQuery jqPlot
Posted
by
You Kuper
on Stack Overflow
See other posts from Stack Overflow
or by You Kuper
Published on 2012-09-09T09:23:15Z
Indexed on
2012/09/09
9:38 UTC
Read the original article
Hit count: 235
I want to dynamically udpate canvasOverlay property of jQuery jqPlot. This will provide the effect of a timeline in my jqPlot. This effect should be similar to the one shown in this jFiddle. However, instead of drawing points, I want to update canvasOverlay property every second:
canvasOverlay: {
show: true,
objects: [
{ rectangle: { xmax: new Date(), xminOffset: "0px", xmaxOffset: "0px", yminOffset: "0px", ymaxOffset: "0px",
color: "rgba(0, 0, 0, 0.1)", showTooltip: true } },
]
}
How can I do this? What are the functions I should use?
UPDATE:
My idea is to do something like this:
canvasOverlay: {
name: 'current',
show: true,
objects: [
{ rectangle: { xmax: new Date(), xminOffset: "0px", xmaxOffset: "0px", yminOffset: "0px", ymaxOffset: "0px",
color: "rgba(0, 0, 0, 0.1)", showTooltip: true } },
]
}
/...
var co = plot.plugins.canvasOverlay;
var current = co.get('current');
current.options.objects.rectangle.xmax = new Date();
co.draw(plot);
© Stack Overflow or respective owner