Frage

having a canvas element in my html page, i can draw graphs, using the rgraph library... Now i would like to add a certain text element on there which i can do by printing it like this:

RGraph.Text(this.canvas.getContext("2d"), "Verdana", 8, 30, 125, 'TECHNOLOGY', "top", "left", false, 270, '#000000');

now, there is only 1 argument for color, and it's the text background color i would need to change it's text color dynamically. does anyone know how to change the text color of that item?

War es hilfreich?

Lösung

Many of the RGraph methods (though not all) use whatever the current strokeStyle or fillStyle settings are. So for example:

context.fillStyle = 'red';
RGraph.Text(...);

Andere Tipps

oh dear, I was again way to fast in posting here. this solution is simple, but default canvas, and not possible with the RGraph.Text() method itself, just initialize a context fillcolor.

myContext = this.canvas.getContext('2d');
myContext.setFillColor(255, 255, 0, 1.0); // you can add any RGBA values here...
RGraph.Text(/* arguments go here */);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top