Hi,
Where should I change the code to my vertical lines appear?
I want to use function explorer: { actions: ['dragToZoom',
'rightClickToReset'],
axis: 'horizontal',
keepInBounds: true,
maxZoomIn: 4.0}
and does not work.
I'm a beginner.<https://lh3.googleusercontent.com/-EjorBakEt4U/WHt4TI6VJ1I/AAAAAAAAAAM/MjN9G03J6q0oxoKQOrwfPcZGluy5qhnVgCLcB/s1600/graf.jpg> marți, 5 martie 2013, 19:12:53 UTC+2, asgallant a scris: > > Ok, with dates and hex numbers, you have to do a bit of fiddling with the > data when you input it into the JSON. The "while" loop should look > something like this: > > while($r = mysql_fetch_assoc($query)) { > $temp = array(); > // each column needs to have data inserted via the $temp array > // break apart the date and time data so we can import it in the proper > format > // I assume your dates are in the form "year-month-day hour:minute:second" > $casArr = explode(' ', $r['cas']); // split into date and time segments > $dateArr = explode('-', $casArr[0]); // split date into year, month, day > $timeArr = explode(':', $casArr[1]); // split time into hour, minute, > second > $year = (int) $dateArr[0]; > $month = ((int) $dateArr[1]) - 1; // javascript uses a 0-based index for > months, so we have to subtract 1 > $day = (int) $dateArr[2]; > $hour = (int) $timeArr[0]; > $minute = (int) $timeArr[1]; > $second = (int) $timeArr[2]; > $date = "Date($year, $month, $day, $hour, $minute, $second)"; > $temp[] = array('v' => $date); > $temp[] = array('v' => hexdec($r['data'])); // convert hexadecimal output > to decimal, as JSON doesn't support hex numbers > // insert the temp array into $rows > $rows[] = array('c' => $temp); > } > > On Tuesday, March 5, 2013 3:44:56 AM UTC-5, Vojtěch Piska wrote: >> >> Thank you a lot, i modified some think but on screen appears this: " Object >> 2013-03-04 18:53:52 has no method 'getTimezoneOffset'×" >> >> $table = array(); >> $table['cols'] = array( >> /* define your DataTable columns here >> * each column gets its own array >> * syntax of the arrays is: >> * label => column label >> * type => data type of column (string, number, date, datetime, boolean) >> */ >> // I assumed your first column is a "string" type >> // and your second column is a "number" type >> // but you can change them if they are not >> array('cas' => 'cas', 'type' => 'datetime'), * // cas from mysql >> are in format 2013-03-1 14:45:23* >> array('data' => 'data', 'type' => 'number') *// data from mysql are >> HEX numbers* >> >> *and I want to do a Line chart, so i modified: * >> >> function drawChart() { >> var json = $.ajax({ >> url: 'get_json.php', // make this url point to the data file >> dataType: 'json', >> async: false >> }).responseText; >> // Create our data table out of JSON data loaded from server. >> var data = new google.visualization.DataTable(json); >> var options = { >> title: 'My Weekly Plan', >> is3D: 'true', >> width: 800, >> height: 600 >> }; >> // Instantiate and draw our chart, passing in some options. >> //do not forget to check ur div ID >> var chart = new google.visualization*.LineChart* >> (document.getElementById('chart_div')); >> chart.draw(data, options); >> >> >> >> I still dont know where is the problem, but you shift me:) >> >> >> Dne pondělí, 4. března 2013 21:38:13 UTC+1 Vojtěch Piska napsal(a): >>> >>> Hi friends, >>> I have problem i want to display some data from my mysql DB in line >>> chart, but still doesnt work. I am tired... because i dont know why, and I >>> read many, many forums.. >>> >>> my MySQL table: >>> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> code in file *graf.php :* >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> <?php >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>$con >>> >>> = mysql_connect("localhost","root","123456"); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>mysql_select_db("aplikace", >>> >>> $con); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>$result >>> >>> = mysql_query("SELECT * FROM data"); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>while >>> >>> ($row=mysql_fetch_array($result)){ >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> $pole[]= >>> array( >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> 'cas' >>> => $row['cas'], >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> 'data'=> >>> $row['data'] >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> ); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> } >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> echo >>> json_encode($pole); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>*?> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>* >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>Code >>> >>> in* get_json.html* >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> >>> >>> * >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><html> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><head> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><script >>> >>> type="text/javascript" src="https://www.google.com/jsapi"></script> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><script >>> >>> type="text/javascript" >>> src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><script >>> >>> type="text/javascript"> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>google.load("visualization", >>> >>> "1", {packages:["corechart"]}); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>google.setOnLoadCallback(drawChart); >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>function >>> >>> drawChart() { >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>var >>> >>> jsonData = $.ajax({ >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>url: >>> >>> "graf.php", >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>dataType:"json", >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>async: >>> >>> false >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>}).responseText; >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>// >>> >>> Create our data table out of JSON data loaded from server. >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>var >>> >>> data = new google.visualization.DataTable(jsonData); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>var >>> >>> options = { >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>width: >>> >>> 800, height: 480, >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>title: >>> >>> 'Company Performance' >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>}; >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>var >>> >>> chart = new >>> google.visualization.LineChart(document.getElementById('chart_div')); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>chart.draw(data, >>> >>> options); >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>} >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG></script> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG></head> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><body> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG><div >>> >>> id="chart_div"></div> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG></body> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG></html> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>If >>> >>> you can help me plese, I really dont know what to do and time is kicking >>> me:/I also added source files. Thanks a lot:) >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG>* >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >>> <https://lh4.googleusercontent.com/-zNtE_GTwImI/UTUEqT1N5qI/AAAAAAAAAmE/DFaiXsPWc-8/s1600/tab.JPG> >>> >> -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/a91c412e-4426-4c62-9daf-5f6e515d10bb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
<<attachment: get_json.php>>
<<attachment: grafcopy.php>>
