Thanks a lot for your reply mate .... it would be really great if you could
provide me an exact solution to this.. i've tried a lot but unfortunately
nothing worked for me ...i need to print dates ..... these are ever
increasing dates .... like begin from say 30 aug to every upcoming days
for years ......
On Friday, September 7, 2012 3:54:16 PM UTC+5:30, gnik wrote:
>
> i have a mysql database . i want to plot a dynamic graph between two of
> my table colums named as date and sales .where date is stored in this
> format("yyyy-mm-dd") and sales are integers (not float )
> please help me with this. though i am successful in plotting data but the
> graph is not properly drawn . i guess there's an issue with intervals.
>
> i want
> x axis interval as : aug 30 , aug 31 , sep 01 , sep 02 and so on.....
> y axis interval as : 0 , 10 , 20 ,30 ....
>
>
> my code goes like this :
>
>
> <?php
> include('dbconnect.php');
> $sql_data = mysql_query("SELECT date , sales FROM analytics WHERE
> id ='12345' ORDER BY date ASC");
>
> ?>
>
> <html>
> <head>
> <script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
>
> <?php
> echo "<script type=text/javascript>";
> echo "google.load(\"visualization\", \"1\",
> {packages:[\"corechart\"]});";
> echo "google.setOnLoadCallback(drawChart);";
>
> echo "function drawChart() { ";
> echo "var data = google.visualization.arrayToDataTable([
> ['Date', 'Score'],";
> while($result = mysql_fetch_array($sql_data))
> {
> $t1 = strtotime($result['date']);
> $t2 = date("d",$t1);
> $display .= "[".$t2.",".$result['sales']."],";
> }
>
> $display .= " ]);";
>
> echo $display;
>
> echo "var options = {
> title: 'Sales Analysis' ,
> vAxis: {title: \"sales\"},
> hAxis: {title: \"date\"} ,
>
> };";
>
> echo "var chart = new
> google.visualization.LineChart(document.getElementById('chart_div'));";
> echo "chart.draw(data, options);";
> echo "}
> </script>";
>
> ?>
> </head>
> <body>
> <div id="chart_div" style="width: 900px; height: 500px;"></div>
> </body>
> </html>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/BYbP8Oc-fgMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.