Is there anyway to do this without PHP?


On Oct 30, 3:52 pm, rcrisman <[EMAIL PROTECTED]> wrote:
> Heres what I did for an Annotated Time Line usingMySQL+ PHP:
>
> <?php
>
> $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
> connecting tomysql');
> mysql_select_db($dbname);
>
> $int_y_pos = -1;
> $int_y_step_small = 1;
>
> $sql = "SELECT count(id) AS count, DATE_FORMAT(date, '%Y, %m-1, %d')
> AS date FROM dtt WHERE date NOT LIKE '0000-00-00 00:00:00' AND date
> NOT LIKE '2000-00-00 00:00:00' GROUP BY DATE_FORMAT(date, '%Y, %m,
> %d')";
> $sql = mysql_query($sql);
> $rownum = mysql_num_rows($sql);
>
> ?>
> <html>
>   <head>
>     <script type="text/javascript" src="http://www.google.com/jsapi";></
> script>
>     <script type="text/javascript">
>       google.load("visualization", "1", {packages:
> ["annotatedtimeline"]});
>       google.setOnLoadCallback(drawData);
>       function drawData() {
>         var data = new google.visualization.DataTable();
>         data.addColumn('date', 'Date');
>         data.addColumn('number', 'Repairs');
> <?php
> echo "     data.addRows($rownum);\n";
> while($row = mysql_fetch_assoc($sql)) {
>
>         $int_y_pos += $int_y_step_small;
>
>         echo "     data.setValue(" . $int_y_pos . ", 0, new Date(" .
> $row['date']  . "));\n";
>         echo "     data.setValue(" . $int_y_pos . ", 1," . $row['count'] . ");
> \n";
>
> }
>
> ?>
>         var time = new
> google.visualization.AnnotatedTimeLine(document.getElementById('time_div')) ;
>         time.draw(data, {displayExactValues:true});
>
>       }
>     </script>
>   </head>
>
>   <body>
>     <div id="time_div" style="width: 940px; height: 240px;"></div>
>   </body>
> </html>
>
> On Oct 17, 5:19 am, VizGuy <[EMAIL PROTECTED]> wrote:
>
> > In our examples there is no such an example, because they only web pages.
> > What you want to do, is to generate on your server, where you create the
> > dynamic html page, a javascript code which is similar to the pages we have
> > in our docs (for 
> > instance:http://code.google.com/apis/visualization/documentation/gallery/inten...
> > )
>
> > Hope this helps.
>
> > Vizguy
>
> > On Thu, Oct 16, 2008 at 10:55 PM, Newbie <[EMAIL PROTECTED]>wrote:
>
> > > Can you point us to a specific example here ?
> > > Say, the data is in a flat file and we want to populate a data table.
>
> > > Thanks.
>
> > > On Oct 15, 3:45 pm, VizGuy <[EMAIL PROTECTED]> wrote:
> > > > Hi,
> > > > I am not sure I follow what is the exact question here.
> > > > Anyway - the main challenge is to create a data table from theMySql
> > > query
> > > > data.
> > > > The only way to do it today, is to generate the html page with the
> > > > javascript code that generates the data table object, and populates it
> > > with
> > > > cols, rows, and cells, and then using it as any data table.
>
> > > > Please have a look at our docs athttp://
> > > code.google.com/apis/visualization
>
> > > > VizGuy
>
> > > > On Tue, Oct 14, 2008 at 3:30 PM, Jud <[EMAIL PROTECTED]> wrote:
>
> > > > > Good morning -
> > > > > I just yesterday started digging in to this Google Visualization API,
> > > > > so needless to say, I'm not too fluent yet.
>
> > > > > But, before I begin really learning I have a simple question that
> > > > > might kill it all.
>
> > > > > What I am hoping to do with Google Visualization is to use anMySQL
> > > > > database to populate data to make the charts. For instance - theMySQL
> > > > > database has 10 fields, I will use an email of 10 most populated
> > > > > cities. So I have a row for 'cities' and I have a row for
> > > > > 'citypopulation'.
>
> > > > > 1) Is that possible?
>
> > > > > 2) HOW?
>
> > > > > 3) Any other 'best practices' or 'ideas'?
>
> > > > > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to