Dynamically udpate canvasOverlay property of jQuery jqPlot
- by You Kuper
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);