|
multiple graphs, one plot, different number of points |
Posted by multiplex on Jul-03-2013 02:53 |
|
long time user here, but have stumbled to find a solution to my latest graph
i'd like to plot a bar graph that has 1440 points, on top of a bar graph that has 24 points.
i see its possible to have multiple axises, perhaps top and bottom but even those seem to
expect the same number of points?
short of merging to images using GD, i'd like to find a way to plot it
thanks for any help |
Re: multiple graphs, one plot, different number of points |
Posted by Peter Kwan on Jul-04-2013 02:41 |
|
Hi multiplex,
For your chart, there are two things you need to determine:
(A) How the 24 bars are to be aligned with the 1440 bars.
(B) How wide are the 24 bars in relation to the 1440 bars. (In addition to the height, the bars also have a width.)
Judging from the numbers 24 and 1440, I speculate that you are trying to plot 24 bars for 24 hours, and then 1440 bars for 1440 minutes in the 24 hours.
Let's say there are 60 minutes in the first hour 00:00 to 00:59, so there are 60 per minute bars, and 1 per hour bar. How should be per hour bar aligned with the 60 per minute bars? If you want the per hour bar to be at the center of the hour, it means the per hour bar should be plotted at around 00:30 (not at 00:00). For the width of the bar, if you would like the bar width to span 60 minutes (by default, the gap between bars will be around 20% of the "bar slot", so the per hour bar width would default to 48 minutes only if not explicitly configured).
So one suggested method is as follows (in PHP):
$c->addBarLayer($perMinuteBars, .....);
$positionOfPerHourBars = array(30, 90, 150, ..... 1410);
$perHourBarLayer = $c->addBarLayer($perHourBars, ....);
$perHourBarLayer->setXData($positionOfPerHourBars);
$perHourBarLayer->setBarGap(TouchBar);
Hope this can help.
Regards
Peter Kwan |
|