Hi all,
I have a mysql database that has a bunch of stock prices with their dates.
I have a php charting program that charts these prices and then the dates go on the bottom(x-axis).
I have 2 arrays.
The first array takes the array of dates(i made it only take the month name).
The second array takes the array of prices.
Each date and price array are relevant to each other.
The problem is, when I have over 300 dates, it gets really cluttered.
Therefore, I was wondering if how I can make my first array(dates) so that it would only show the month name once for each year, and not duplicate it.
However, at the same time, I want it still associate all dates with all stock prices(I don't want any price data not showing)
this is what I have so far :
$result = mysql_query("SELECT *, UNIX_TIMESTAMP(Date) as Date FROM table WHERE Stock = '$Stock' and Date >= '$Date' ORDER BY Date ASC LIMIT $Limit",$db);
$r1, $r2 = array();
while($row = mysql_fetch_array($result))
{
$r1[] = date('M', $row["Date"]);
$r2[] = $row["Average"];
}
$a = array($r1,$r2);
plot $a....
thanx
I have a mysql database that has a bunch of stock prices with their dates.
I have a php charting program that charts these prices and then the dates go on the bottom(x-axis).
I have 2 arrays.
The first array takes the array of dates(i made it only take the month name).
The second array takes the array of prices.
Each date and price array are relevant to each other.
The problem is, when I have over 300 dates, it gets really cluttered.
Therefore, I was wondering if how I can make my first array(dates) so that it would only show the month name once for each year, and not duplicate it.
However, at the same time, I want it still associate all dates with all stock prices(I don't want any price data not showing)
this is what I have so far :
$result = mysql_query("SELECT *, UNIX_TIMESTAMP(Date) as Date FROM table WHERE Stock = '$Stock' and Date >= '$Date' ORDER BY Date ASC LIMIT $Limit",$db);
$r1, $r2 = array();
while($row = mysql_fetch_array($result))
{
$r1[] = date('M', $row["Date"]);
$r2[] = $row["Average"];
}
$a = array($r1,$r2);
plot $a....
thanx