The data you are getting from Yahoo is only one data point. If you want a 24
hour chart, then you either need to request more data from Yahoo or find a way
to cache it. This isn't PHPlot's problem - you need to construct an array with
all 24h worth of data to feed to PHPlot.
Also remember to watch the structure of your $datatoplot array. It should
contain a (blank) label then the two values you want to plot (ergo: "label",
X, Y). The time that Yahoo provides is not a valid ISO time code readable by
PHPlot, so you need to turn that into something more digestible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm looking to create a chart that tells me the price of gold in dollars. I'm
getting the data from the yahoo stock price csv.
I can get two arrays - last trade time and price.
The problem I am having is finding out how this can be continually updated
every 30mins so that I have a 24 hour chart.
Any help would be much appreciated.
This is the code I am using at the moment
SetPlotType('points'); $plot->SetDataType('data-data'); $plot->SetDataValues($datatoplot); $plot->DrawGraph(); ?>The data you are getting from Yahoo is only one data point. If you want a 24
hour chart, then you either need to request more data from Yahoo or find a way
to cache it. This isn't PHPlot's problem - you need to construct an array with
all 24h worth of data to feed to PHPlot.
Also remember to watch the structure of your $datatoplot array. It should
contain a (blank) label then the two values you want to plot (ergo: "label",
X, Y). The time that Yahoo provides is not a valid ISO time code readable by
PHPlot, so you need to turn that into something more digestible.
Agreed, you will need to cache the values yourself. I'd pull the values into a
mySQL table and then use something like:
to pull the latest 24 hours for any given refresh and give that to PHPlot.