Jump to content

jqBarGraph pHP and MySQL


hkalan2007

Recommended Posts

Hello,

 

My newest project is to use the jqBarGraph on my webpage that is getting the data from MySQL table. (like the animation of the graph without using flash)

 

Now I am using a single (inline) jquery datepicker that I can click on a date, the date is shown in a DIV (not an input form). I want the function to start this with the onChange of the new date in the DIV and POST to PHP file to pull values of the "Power" column by that Date, and the graph will display the data by the hours (there is a time column 00:00:00 to 23:00:00) for each date, so the graph will display the 24 hours as the bottom axis and the power as the right axis.

 

My goal is to have 3 graphs in total on the page.. one for DAY (shown in hours), one for Month Shown in days), and on for Year (shown in months), as there is a div fo  each now on the page that change with the single date selection on the datepicker).

 

I have not seen a lot of information online about doing this... So I thought I would post this to see what ideas can come in as I begin the scripting today !

 

Hope to talk more soon !

 

Thanks,

 

Alan

Link to comment
Share on other sites

Well.

 

You have a selection of ajax, php and jquery libraries that you'll require.

 

on the onchange event, you can call a function() that does a

 

$.post - http://api.jquery.com/jQuery.post/

 

to a php file. That php file can do all the datbase work and exit() or return() the code you need, back to the html page you started at.

 

Good luck.

Link to comment
Share on other sites

Hello,

 

Thanks for the input.

 

I am starting that !!!

 

This is a fun project... I switched to using the "Highcharts" graphs rather than the jqgraph as it has more flexable abilities for my needs (and cooler FX).

 

The flow is.

1) on page load - the day, month, and year DIV's will display the current date (day DIV: Tuesday, 23 - month DIV: November - Year DIV: 2010)

3) Next to the DIV with the date is another DIV that will hold the values from the MySQL table for the date. An onChange call will post to a (day,month,year) php file to get the current (sum) values for each DIV to display the number in that DIV.

2) the graph display DIV will be controlled by an onChange of the day,month.year DIV to post to a PHP file to display the graph of that data in the graph DIV.

3) when the datepicker is used and a new value of the day,month,year DIV is entered an onChange call will post.

 

You can see what I have working so far.. http://www.pvmonitor.000a.biz/demo2.php

 

Getting the PHP to pull the information just the way Highcharts wants to read it, is where I am having some problems...

 

I think the dates are getting to the PHP, but thats when DeBugging may drive me insane !

 

Overal this is fun and turning my hair grey at the same time !

 

 

Thanks,

 

Alan

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.