I have a problem with drawing text onto my chart


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Antonio Vianello on 11th November 2013
Hi there!

When I try to draw text on a simple bar chart like this:

var x = bar.canvas.width / 2;
var y = bar.Get('gutter.top') - 5;
        
var text = new RGraph.Drawing.Text('cvs', x, y, 'An example of the drawing API text object')
.Set('valign', 'bottom')
.Set('halign', 'center')
.Set('size', 14)
.Set('tooltips', ['The drawing API text object'])
.Set('tooltips.event', 'mousemove')
.Set('highlight.stroke', 'rgba(0,0,0,0)')
.Draw();

I get the following javascript error:

"Uncaught Type Error: Cannot read property 'Text' of undefined"

I correctly include all the relative libraries, expecially the drawing API, so I cannot figure out what is the problem.

Thanks in advance
Posted by RGraph Support on 11th November 2013
Hi there,

The page is saying that RGraph.Drawing is undefined - so it looks like you haven't included the drawing API. If you think you have then you might have a 404, Try going to the URL of the JavaScript file directly in your browser - eg:





Richard, RGraph Support
Posted by Matt S. on 10th November 2017
Hi Richard

I get a similar problem " TypeError: text is undefined." on the following webpage:

iot.i3s.bfh.ch/iot-demoanlage/fensterueberwachung-t026

i updated to the newest version of the website today.
Posted by Richard on 10th November 2017
Hi there,

Looking at the list of libraries at the bottom of the page you haven't included the drawing API text library:

<script src="RGraph.drawing.text.js"></script>

Richard

Add a reply




« Back to message list