I am following example 5.34 and the output has an extra series in the legend of the second plot.
It appears to be carried over from the first plot.
I am pulling the temperature and humidity data from mysql into two arrays
Then I use the overlay plot to plot both.
The legend on the second plot to the right contains the keys Temperaturea
and humidity.
<?phprequire_once'connect.php';require'phplot.php';$tempData=array();$humidData=array();while($temperature=mysql_fetch_assoc($temperatures)){$tempData[]=array($temperature['blank'],strtotime($temperature['time']),$temperature['temperature']);$humidData[]=array($temperature['blank'],strtotime($temperature['time']),$temperature['humidity']);}# Strings for titles and legends$title='Temperature and humidity chart';$yTitleTemp='Degrees C';$legendTemp='Temperature';$yTitleHumid='%';$legendHumid='Humidity';# Main title$plot=newPHPlot(800,600);$plot->SetPrintImage(False);$plot->SetTitle($title);$plot->SetPlotBgColor('gray');$plot->SetLightGridColor('black');# Plot one for Temperature$plot->SetDrawPlotAreaBackground(True);$plot->SetPlotType('linepoints');$plot->SetDataType('data-data');#$plot->SetXLabelType('time','%Y-%m-%d %H:$M');$plot->SetXLabelType('time','%H:%M');$plot->SetDataValues($tempData);$plot->SetYTitle($yTitleTemp);$plot->SetLegend($legendTemp);$plot->SetLegendPixels(5,30);$plot->SetMarginsPixels(120,120);$plot->SetPlotAreaWorld(NULL,0,NULL,40);$plot->SetYTickIncrement(5);#$plot->SetXTickLabelPos('none');$plot->DrawGraph();# Plot two for Humidity$plot->SetDrawPlotAreaBackground(False);$plot->SetDrawYgrid(False);$plot->SetPlotType('linepoints');$plot->SetDataValues($humidData);$plot->SetYTitle($yTitleHumid,'plotright');$plot->SetLegend($legendHumid);$plot->SetLegendPixels(690,30);$plot->SetPlotAreaWorld(NULL,40,NULL,100);$plot->SetYTickIncrement(10);$plot->SetYTickPos('plotright');$plot->SetYTickLabelPos('plotright');$plot->SetDataColors('black');$plot->SetYLabelType('data',0,'','%');$plot->DrawGraph();$plot->PrintImage();
What mistake have I made?
Adrian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am following example 5.34 and the output has an extra series in the legend of the second plot.
It appears to be carried over from the first plot.
I am pulling the temperature and humidity data from mysql into two arrays
Then I use the overlay plot to plot both.
The legend on the second plot to the right contains the keys Temperaturea
and humidity.
What mistake have I made?
Adrian