Reputation: 2881
I have a canvas tag which has come text inside (rendered by a jqplot chart):
<canvas id="myCanvas" width="578" height="200"></canvas>
is there a way I can make the text inside the canvas red? I've tried just adding css like this:
<canvas id="myCanvas" width="578" height="200" style="color: red;"></canvas>
From what I understand a canvas is almost like an image. Does this mean I wont be able to select things in that canvas?
Upvotes: 0
Views: 615
Reputation: 6230
Since you are using jqplot
you should look at the documentation to figure out how to change the color of the text. The following webpage looks promising which makes mention of a textColor
property.
http://www.jqplot.com/docs/files/plugins/jqplot-canvasAxisLabelRenderer-js.html#$.jqplot.CanvasAxisLabelRenderer
This looked helpful as well
http://www.jqplot.com/docs/files/jqplot-core-js.html#Axis.tickRenderer
http://www.jqplot.com/docs/files/jqplot-axisTickRenderer-js.html#$.jqplot.AxisTickRenderer
Basically I would try to find an event (hook) that gets called before each tick was drawn. Figure out which tick is about to be drawn. Then change the text color based on that information. I believe you can accomplish that with what I have provided you.
Upvotes: 2