Post variable in line09.html

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 Armand Joseph on 18th December 2012
can i use variable instead of numbers as value in demo line09.html? i really need help! tomorrow is our thesis defense and this is my last problem. :( any help will be appreciated.
Posted by RGraph support on 18th December 2012
Hi,

Yes - I've altered the demo to show this:

dev.rgraph.net/demos/line09.html

PS If you could link to the RGraph website I'd appreciate it - thanks.

Richard, RGraph Support
Posted by Armand Joseph on 18th December 2012
sorry my question is not specific.. here are the codes of my progam:

php:

<?php

 
$sql="SELECT * FROM nedr WHERE year='$year'";
$result=mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo "<input type='text' value=". $row['2'].", "." name='tb1'>";
echo "<input type='text' value=". $row['3'].", "." name='tb2'>";
echo "<input type='text' value=". $row['4'].", "." name='tb3'>";
}
?> // the query will fetch multiple data

jscript:

<script>
        function armand ()
         {
        
    var tb1 = 0;
    var tb2 = 0;
    var tb3 = 0;
    tb1 = Math.abs(parseInt(document.statNEDR.tb1.value));
    tb2 = Math.abs(parseInt(document.statNEDR.tb2.value));
    tb3 = Math.abs(parseInt(document.statNEDR.tb3.value));
             var myLine = new RGraph.Line('cvs',[tb3], [tb2], [tb3,]);


// here are the variable that I'm using, the graph didn't display, and i
m wondering what is the appropriate code for multiple data of textboxes in javascript


Yes I already inserted the link in the page.



Posted by RGraph support on 18th December 2012
Hi,

Are your numbers showing up in your HTML page (view the source in your browser to check)? If so then you're simply formatting it wrong. Try this:

tb1 = Math.abs(parseInt(document.statNEDR.tb1.value));
tb2 = Math.abs(parseInt(document.statNEDR.tb2.value));
tb3 = Math.abs(parseInt(document.statNEDR.tb3.value));

var myLine = new RGraph.Line('cvs',[tb1,tb2,tb3]);
Posted by Armand Joseph on 18th December 2012
Yes it's showing. I cannot figure out how to insert a variable with multiple values.

Every variable have multiple values,( example: var tb1= 1, 2, 3, 4, 5, 6) and I want to use it as the value inside this: var myLine = new RGraph.Line('cvs',[tb1],[tb2],[tb3]);.

I've use the php to fetch the data in mysql, and i'd echo it out in the text-boxes using php, the textboxes names are tb1, tb2, tb3..

and i want to insert the multiple values of every variable in the line chart.

Sorry, my english is bad. I hope you get what I wanted to say..
Posted by RGraph support on 18th December 2012
Hi,

In that case you would want the implode() PHP function:

$str = "[" . implode($tb1) . "]";

You can then use the $tb1 variable in your page.
Posted by Armand Joseph on 19th December 2012
Hello Admin! Your suggestion to use implode() function helped me. Our defense is successful! I will recommend RGraph to all of my classmates that needs visual charts.
Posted by RGraph support on 19th December 2012
Hi,

Thanks!

Add a reply




« Back to message list