I'm getting this error: Argument 1 of CanvasRenderingContext2D.setLineDash can't be converted to a sequence

« 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 Will Kostelecky on 16th February 2014
I get the above error when trying to generate a real time graph...using some code that I have working on another 'puter...also running Linux though Arch as opposed to Debian.

The code in question is as follows:

     // Setup for the real time temperature graph
     var d1 = [];
     var d2 = [];
     var streamSize = 100;

     // Pre-pad the arrays with null values
     for (var i = 0; i < streamSize; ++i) {

     function getGraph(id, d1, d2) {
         // After creating the chart, store it on the global window object
         if (!window.__rgraph_line__) {
             window.__rgraph_line__ = new RGraph.Line(id, d1, d2);
             window.__rgraph_line__.Set('chart.background.barcolor1', 'rgb(100,100,100)');
             window.__rgraph_line__.Set('chart.background.barcolor2', 'rgb(100,100,100)');
             window.__rgraph_line__.Set('chart.background.grid', false);
             window.__rgraph_line__.Set('chart.gutter.left', 0);
             window.__rgraph_line__.Set('chart.gutter.right', 0);
             window.__rgraph_line__.Set('chart.gutter.top', 0);
             window.__rgraph_line__.Set('chart.gutter.bottom', 0);
             window.__rgraph_line__.Set('ylabels', false);
             window.__rgraph_line__.Set('xlabels', false);
             window.__rgraph_line__.Set('yaxis', false);
             window.__rgraph_line__.Set('xaxis', false);
             window.__rgraph_line__.Set('colors', ['red', 'blue']);
             window.__rgraph_line__.Set('filled', [false, true]);
             window.__rgraph_line__.Set('chart.linewidth',[4.0, 4.0]);
             window.__rgraph_line__.Set('chart.ymax', 100);
             window.__rgraph_line__.Set('chart.filled.accumulative', false);
         return window.__rgraph_line__;

     function drawGraph (value, highwater) {
         try {
             var graph = getGraph('canvas', d1, d2);

             if (d1.length > streamSize) {
                 d1 = RGraph.array_shift(d1);
                 d2 = RGraph.array_shift(d2);

             window.__rgraph_line__.original_data[0] = d1;
             window.__rgraph_line__.original_data[1] = d2;
         catch(err) {
Posted by Richard on 16th February 2014
Hi there,

Well if you have the code working in one browser there might be nothing wrong with it. What you can do though is comment out lines that look like this in the RGraph.common.core.js that set the line dash:


There are three instances of the function being called - comment them all out.

Posted by Will Kostelecky on 17th February 2014
Sorry, should also have noted that:

Same browser, Midori, on both Debian and Arch

The following libraries included for rGraph"

<script src="/client/RGraph.common.core.js" ></script>
<script src="/client/RGraph.common.effects.js" ></script>
<script src="/client/RGraph.line.js" ></script>

and the canvas defined:

<div class='fbCurrentTemps '>
<canvas id="canvas" width="330" height="110"></canvas>

Any help would be appreciated as I am at a loss!

Posted by Will Kostelecky on 18th February 2014

Thanks for your fast response. Problem is fixed but it was nothing you could have helped me with as I was being a bit of an idiot. The error message actually had nothing to do with the problem. I seem to have something corrupt in my version of Firefox. The error message was not issued on Chrome (or Midori).

The root cause problem was that I was feeding your routines string values instead of converting stuff to Number when I pulled it out of socket.io. That led me on the merry chase given that I was trying to debug the problem under Firefox (my ultimate target is Midori on a Beaglebone Black).

The code that WAS working was not exactly the same as it, obviously, had done the magic conversion to Number!


Add a reply

« Back to message list