Plot more than 20 points on a line chart

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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 Gustavo on 16th July 2014
Great software!!

I am trying to plot 100 points in a basic line graph. Tried many things but all I get is a plot of 20 points. I am actually uploading 100.

<script>
         $(document).ready(function ()
         {
             RGraph.CSV('/sample.txt', function (csv)
             {
                
                 var data = csv.getRow(1);

                 var line = new RGraph.Line('cvs', data)
                    
                     .set('shadow', true)
       .set('numxticks',10)
  
   .set('xmax', 100)
   .set('outofbounds', true)
                 .set('numyticks', 0)
                 .set('background.grid', false)
                 .set('colors', ['green'])
                 .set('linewidth', 1)
                 .set('hmargin', 5)
                 .set('ylabels', false)
  
                
                     .draw();
             })
         })
     </script>

xmax does not change anything.

Your help is most appreciated
Posted by Richard on 17th July 2014
It depends what's in the array that's returned by getRow(1), This will be the second line of your CSV file - which will probably be 20 values. You can use these functions to inspect the data variable:

// These log the variable to the console:
console.log(data);
$cl(data);

Use the alert() function to show it:
$a(data);

// Use the alert() function but with some formatting too so you can see the structure better:
$p(data);


And the xmax property is a Scatter chart property - not a Line chart property.












Richard
Posted by Gustavo on 18th July 2014
Thanks Richard.

My sample csv is:

Gustavo,12345,79,91,36.1,121,81,15Sep15:30,61,31,15,24Jun12:21,61,81,91
67,67,90,67,6,66,67,67,67,67,6,65,66,66,67,67,67,69,61,43,52,7,66,67,67,67,66,66,66,66,66,66,65,65,64,64,62,62,61,61,62,64,65,66,67,66,67,67,67,67,66,67,67,66,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,66,66,66,66,68,67,67,70,64,44,51,71,67,68,68,67,67,67,67,67,67,66,66,65,65,64,63,62,61

I have included the code you sent in the script as shown below but the graph disappears. (am I missing a Script link in the header?):

  <script>
         $(document).ready(function ()
         {
             RGraph.CSV('/sample.csv', function (csv)
             {
                
                 var data = csv.getRow(1);


                 var line = new RGraph.Line('cvs', data)
                    
                     .set('shadow', true)
       .set('numxticks',10)
  
   .set('xmax', 100)
   .set('outofbounds', true)
                 .set('numyticks', 0)
                 .set('background.grid', false)
                 .set('colors', ['green'])
                 .set('linewidth', 1)
                 .set('hmargin', 5)
                 .set('ylabels', false)
  
                
                     .draw();

// These log the variable to the console:
console.log(data);
$cl(data);

Use the alert() function to show it:
$a(data);

// Use the alert() function but with some formatting too so you can see the structure better:
$p(data);



             })
         })
     </script>


Thanks again
Posted by Richard on 21st July 2014
I don't know - you haven't specified what libraries that you've included in the header. Send a link to the page in question.





Richard
Posted by Gustavo on 5th August 2014
Thank you for answer Richard and my apologies for the delayed response.
I am traveling far from home.

Here are the links:

This is the data:

zuniv.net/monitor/getdata1.html

The following link is supposed to plot all points but it only plots 15 (I estimate).

zuniv.net/monitor/line1

Another example is:

zuniv.net/monitor/dynamicAjax1

It only updates the first point but does not read the rest.

I cannot figure out what I am doing wrong and I copied exactly your examples.

Thank you so much.

Gustavo.
Posted by Richard on 5th August 2014
Your first example looks to have a set of hard-coded values that don't change.

Your second example uses the RGraph.AJAX.getNumber() function which will always get the first number from your AJAX page.





Richard

Add a reply




« Back to message list