My Scatter chart is saying that RGraph.CreateUID is not a function


« 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 Mimi on 25th February 2018
I'm getting this error when I try to do a scatter plot using RGraph. I've copied in commons.core etc.: (Sorry - there are no code tags)

<script src='<c:url value="/resources/js/RGraph.common.core.js" />' type="text/javascript" charset="utf-8"></script>
<script src='<c:url value="/resources/js/RGraph.common.tooltips.js" />' type="text/javascript" charset="utf-8"></script>
<script src='<c:url value="/resources/js/RGraph.scatter.js" />' type="text/javascript" charset="utf-8"></script>

This is my canvas area:

<div id='graph-crm-scattergram'>
     <canvas id="scattergram" width="500" height="500">[No canvas support]</canvas>
</div>

And this is my JavaScript code:

normalData = $.parseJSON(str);
var scatter = new RGraph.Scatter('scattergram', normalData);
scatter.Set('chart.tickmarks', 'circle');
scatter.Set('chart.xaxispos', 'center');
scatter.Draw();

I'm just not sure what's going wrong. I seem to have done everything, but something must be missing.
Posted by RGraph support on 15th November 2012
Hi,

That error would suggest that you haven't included the core library. Maybe the path is wrong. Check with view-source in your browser. The tag should look something like this (the path may need changing):

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

I see that you're using single quotes - try changing these to double quotes.
Posted by Mistoss on 20th May 2013
I try to define the chart labels in other language such as

bar.Set('chart.labels', ['&#3617;.&#3588;.', '&#3585;.&#3614;.']);

'&#3617;.&#3588;.' and '&#3585;.&#3614;.' are Thai Language.
But the output seem to be not encoding (look like not UTF-8).

My html file is already set to "UTF-8" charset.
Please advise any solution. Thank you.
Posted by RGraph support on 21st May 2013
Hi there,

By the looks of it you're using HTML entities - canvas is not HTML. So try using the actual characters instead. You may also need to change the pages character set.



Richard, RGraph Support
Posted by Alexander on 25th February 2018
I have copied the code exactly the example used in: www.rgraph.net/demos/svg-bar-sheets.html (to test), and the libraries are in the same folder as my html but still I have the same error called: [TypeError: RG.SVG.createUID is not a function]


<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Linkage</title>
  <link rel="stylesheet" type="text/css" href="styles.css">
     <script src="RGraph.common.core.js" ></script>
     <script src="RGraph.common.sheets.js" ></script>
     <script src="RGraph.svg.bar.js"></script>
  <script src="RGraph.svg.common.tooltips.js"></script>
</head>
<body>
  <div style="width: 700px; height: 300px" id="chart-container"></div>


     <script>
     new RGraph.Sheets('1ncvARBgXaDjzuca9i7Jyep6JTv9kms-bbIzyAxbaT0E', function (sheet)
     {
         var data = sheet.get('B2:B13'),
             labels = sheet.get('A2:A13');
        
         // TODO Carriage retyurns don't work yet
         for (var i=0; i<labels.length; i+=2) {
             labels[i] = "\u00A0\n" + labels[i];
         }

         new RGraph.SVG.Bar({
             id: 'chart-container',
             data: data,
             options: {
                 backgroundGridVlines: false,
                 backgroundGridBorder: false,
                 yaxis: false,
                 colors: ['Gradient(rgb(102, 102, 204):rgb(102, 102, 204):white)'],
                 xaxisLabels: labels
             }
         }).draw();
     });
</script>


</body>
</html>


What are you suggesting?
Posted by Richard on 25th February 2018
Hi there,

You're using the canvas core library, the canvas sheets library, but the SVG bar and the SVG tooltips libraries.

And you can't mix and match. So use the SVG core and sheets libraries instead:

<script src="RGraph.svg.common.core.js"></script>
<script src="RGraph.svg.common.sheets.js"></script>

Richard

Add a reply




« Back to message list