I'm using Highstock with Wordpress. I've created a plugin file that includes both the PHP, and the associated javascript to create the final chart.
UPDATE: I had been stuck with double quotes around my UNIX_TIMESTAMP after my data was json encoded, the resulting output looked like this:
["822985200000",9.99653] The UNIX_TIMESTAMP was being treated as a string.
THE FIX to remove the double quotes from the UNIX_TIMESTAMP was to convert or cast the timestamped variable to a float before the json encoding happens.
Example:
Original causing double quoted date (pay attention to $this_date):
Code: Select all
$date_array[] = array($this_date,(float)$this_value);
Code: Select all
$date_array[] = array((float)$this_date,(float)$this_value);
Code: Select all
$query = "SELECT DISTINCT FundID, UNIX_TIMESTAMP(TDate)*1000 AS TDate, UnitValue FROM $data_table WHERE FundID IN($sFund) ORDER BY FundID, TDate";
$result = mysql_query($query) or die ('Sorry, there was a database error.');
jQuery snippet on the webpage:
Code: Select all
jQuery(window).load("myPlugin.php", jQuery("#div_Containing_ListUser_Selected_Stocks").serializeArray());