I'm getting a Pie chart error message: angles is undefined


« 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 John Molineux on 2nd November 2017
Hi There, we are using your Rgraph javascripts and we seem to getting to be an error message on one of our pie charts

the error message we see in firefox debugger is

TypeError: angles[i] is undefined[Learn More]

The data we have is as follows
[17,41,10,15

The labels set as tooltips is

['Helen Price','Karen Allen','Lisa Ward','Yvonne Montgomery']

We would be very grateful for any help

thanks

Posted by Richard on 2nd November 2017
Hi there,

That's not an error that gets brought up often. Your data looks OK, as well as your tooltips. Here's some code that should be working:

Include the libraries:

<script src="../libraries/RGraph.common.core.js" ></script>
<script src="../libraries/RGraph.common.dynamic.js" ></script>
<script src="../libraries/RGraph.common.tooltips.js" ></script>
<script src="../libraries/RGraph.pie.js" ></script>

Define the canvas tag:

<canvas id="cvs" width="300" height="300">[No canvas support]</canvas>


Create the chart:

new RGraph.Pie({
     id: 'cvs',
     data: [17,41,10,15],
     options: {
         tooltips: ['Helen Price','Karen Allen','Lisa Ward','Yvonne Montgomery'] ,
         shadow: false,
         strokestyle: 'rgba(0,0,0,0)'
     }
}).draw();


Richard
Posted by John on 2nd November 2017
Hi Richard

Thanks for the prompt reply, as use usinbg the .svg functions, code as below

<div style="HEIGHT: 350px; WIDTH: 350px" id="booking_summary"></div>

<script>

   new RGraph.SVG.Pie({
         id: 'booking_summary',
         data: [17,41,10],
         options: {
             exploded: 5,
             donut: true,
             title: <%a5 ?bookedpietitle %>,
             tooltips: ['Helen Price','Karen Allen','Lisa Ward'],
             shadow: true,
             colors: [
               'Gradient(red:red:red:#faa:red)',
               'Gradient(#0f0:#0f0:#0f0:#afa:#0f0)',
               'Gradient(#00f:#00f:#00f:#aaf:#00f)',
               'Gradient(gray:gray:gray:#ccc:gray)',
               'Gradient(#f0f:#f0f:#f0f:#faf:#f0f)',
               'Gradient(#ff0:#ff0:#ff0:#ffa:#ff0)',
               'Gradient(red:red:red:#faa:red)'
             ]
         }
     }).roundRobin();
</script><script>

Can you see anything obvious in this code ?

thanks
Posted by Richard on 2nd November 2017
Hi there,

Well here's your code:

www.rgraph.net/tests/svg.pie/john.html

But as you see there appears to be an with the donut code. Making it a Pie chart will work OK, or using the canvas libraries.

Richard
Posted by John on 2nd November 2017

Hi richard

It seems to work ok with 3 or less elements in the data and tooltips

If you add more than 3 elements , then the problem occurs

thanks

john
Posted by Richard on 2nd November 2017
Hi there,

OK I've fixed it now and just added it to the latest beta so try using that. Remember to update *all* libraries:

www.rgraph.net/download#beta

Richard
Posted by John on 2nd November 2017

Hi richard

Seem to still have the same issue ?

thanks

john
Posted by Richard on 2nd November 2017
Hi there,

1. Have you updated all of the libraries?
2. Are you seeing a cached copy?

Richard
Posted by John on 2nd November 2017

I have updated all the files in the libraries folder and have closed and re-opened my browser...

so think that should be ok ?

thanks

john
Posted by Richard on 2nd November 2017
Hi there,

No - hold either CTRL or SHIFT when you refresh the page. Try one - then the other.

Richard
Posted by John on 2nd November 2017

Sorry yes just tried that, same problem, also tried a different browser.. here is the latest code

<script>

   new RGraph.SVG.Pie({
         id: 'Consultant-Summary',
         data: [10,
     20,
     30,
     40
    ],
         options: {
             exploded: 5,
             donut: true,
             title: <%a5 ?bookedpietitle %>,
             tooltips: [
     'one',
     'two',
     'three',
     'four',
    ],
             shadow: true,
             colors: [
               'Gradient(red:red:red:#faa:red)',
               'Gradient(#0f0:#0f0:#0f0:#afa:#0f0)',
               'Gradient(#00f:#00f:#00f:#aaf:#00f)',
               'Gradient(gray:gray:gray:#ccc:gray)',
               'Gradient(#f0f:#f0f:#f0f:#faf:#f0f)',
               'Gradient(#ff0:#ff0:#ff0:#ffa:#ff0)',
               'Gradient(red:red:red:#faa:red)'
             ]
         }
     }).roundRobin();
</script>


Thanks for investigating, much appeciated

john
Posted by John on 2nd November 2017

Additionally if I try to the the non .svg. library

ie.

<script src="RGraph.common.core.js"></script>
<script src="RGraph.common.tooltips.js"></script>
<script src="RGraph.pie.js"></script>

I get the error below

TypeError: RGraph.CreateUID is not a function


thanks again

john
Posted by Richard on 2nd November 2017
Hi there,

Well try the test page here and try using the libraries that I've linked to below:

www.rgraph.net/tests/svg.pie/john.html

www.rgraph.net/tests/svg.pie/RGraph.svg.pie.js
www.rgraph.net/tests/svg.pie/RGraph.svg.common.core.js
www.rgraph.net/tests/svg.pie/RGraph.svg.common.tooltips.js


Richard

Add a reply




« Back to message list