Menu

More Plots on One Image

2007-09-20
2012-09-07
  • Nobody/Anonymous

    I have array of
    $report[0]
    ..
    ..
    $report[9]

    $plot =& new PHPlot(800,2700);
    $plot->SetImageBorderType('plain');

    Disable auto-output:

    $plot->SetPrintImage(0);

    There is only one title: it is outside both plot areas.

    $plot->SetTitle('Position Gender Graph');

    $value1=40;
    $value2=350;
    $area_plot=117000;
    for($i=0;$i<8;$i++){
    $plot->SetPlotAreaPixels(80, $value1, 740,$value2);

    $plot->SetDataType('text-data');
    $plot->SetDataValues($report[$i]);
    $plot->SetPlotAreaWorld(NULL, 0, NULL, $area_plot);
    $plot->SetDataColors(array('blue'));
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    $plot->SetYTickIncrement(1000);
    $plot->SetYTitle("No of Employee");

    $plot->SetPlotType('bars');
    $plot->DrawGraph();

    $value1+=500;
    $value2+=400;
    $area_plot-=11700;

    }

    Output the image now:

    $plot->PrintImage();

    I'm Just Using the same ratio as the documentation
    for $value1,$value2 and $area_plot

    My Problem is that it generate the fine output to 3 loop but after 4 loop i don't know what happend the graph is upsidedown some are very small.I just want to know wat is the calculation in this dynamic graph
    thanks
    in Advance

     
    • Nobody/Anonymous

      sure gonna tried this one thank you very much for your suggestion.

       
    • lbayuk

      lbayuk - 2007-09-20

      (Thank you for contributing your test case to the ever-growing PHPlot test suite...)

      Your range calculations are broken. I think $value1 is supposed to be the lower Y bound of each graph, and $value2 is the upper. But the way you increment them in the loop, $value1 passes $value2 and you end up with a negative area. Ouch. If it was me, I would do something like this at the bottom of the loop instead:
      $value1 = $value2 + 20;
      $value2 = $value1 + 300;
      So each additional plot starts below where the previous one ends. Then you adjust the 20 and 300 to suit.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.