Reputation: 183
I am using Dygraph to show students attendance. I am highlighting the area with low attendance in specific month. I am using this example from dygraph site.
In this chart, highlighted area is from top to bottom yellow. Is it possible to highlight area below series line only not top to bottom?
Updated - Is it possible to add multiple background colour according to Y axis value I mean at Y axis value 0 to 30 background will be red , 30 to 60 yellow & 60 to 100 green ?
Upvotes: 3
Views: 557
Reputation: 720
Yes it is possible to add multiple background colour according to Y axis value. Below you have the code necessary and a jsfiddle where you can see how to do it.
function highlightYaxesWithColour(y_start, y_end, color) {
var canvas_bottom = g.toDomYCoord(y_start);
var canvas_top = g.toDomYCoord(y_end);
var canvas_height = canvas_top - canvas_bottom;
canvas.fillStyle = color;
canvas.fillRect(area.x, canvas_bottom, area.w, canvas_height);
}
http://jsfiddle.net/Lucidio/2rmLLdcm/
Upvotes: 4