Menu

help on a broken line

dan ramon
2009-05-04
2012-09-07
  • dan ramon

    dan ramon - 2009-05-04

    Hi i am wondering if somebody could help me change the blue broken line into a straight line, because as far as i have read, brokenlines are drawn if there is missing data, but in my code there is no missing data, you can view the picture here http://www.shareapic.net/content.php?id=16680629&owner=steelwater

    <?php
    //Include the code
    require_once 'phplot.php';

    //Define the object
    $plot = new PHPlot(1200);

    //Set titles
    $plot->SetTitle("January 2009 WMS -1a Au");
    $plot->SetXTitle('Accurassay Job Number');
    $plot->SetYTitle('Concentration (ppm)');

    //straight lines data
    $lines_data = array(
    array('200844812',0.18,.22,.3,.38,.42),
    array('',0.18,.22,.3,.38,.42),
    array('200844840',0.18,.22,.3,.38,.42),
    array('200844841',0.18,.22,.3,.38,.42),
    array('200844849',0.18,.22,.3,.38,.42),
    array('200844306',0.18,.22,.3,.38,.42),
    array('200830265',0.18,.22,.3,.38,.42),
    );

    //points data
    $points_data = array(
    array('200844812',0.357519231),
    array('',.452),
    array('200844840',0.268557692),
    array('200844841',.684),
    array('200844849',.50),
    array('200844306',.135),
    array('200830265',1.300403846),
    );

    $plot->SetPrintImage(0);
    $plot->SetDrawBrokenLines(false);
    $plot->SetPrecisionY(2);
    $plot->SetBackgroundColor('grey');
    $plot->SetXLabelAngle(90);
    $plot->SetXDataLabelPos('plotdown');
    //$plot->SetPlotAreaWorld(null,-1.300403846, null, 50);

    points chart

    $plot->SetPlotAreaPixels(125, 80, 1150, 320);
    $plot->SetDataValues($points_data);
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    $plot->SetDataColors(array('blue'));
    $plot->SetPlotType('points');
    $plot->DrawGraph();

    end points chart

    lines chart

    $plot->SetDataValues($lines_data);
    $plot->SetDataColors(array( 'red', 'green','blue', 'green', 'red'));
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    $plot->SetPlotType('Lines');
    $plot->DrawGraph();

    end lines chart

    Output the image now:

    $plot->PrintImage();

     
    • dan ramon

      dan ramon - 2009-05-05

      Hi.

      Thanks for the big help, i used $plot->SetLineStyles( array( "solid", "solid", "solid")); and it worked perfectly :)

      Dan

       
    • Alex Doll

      Alex Doll - 2009-05-05

      Try this Method;

      function SetLineStyles($which_ls=NULL)

      $which_ls is an array of Strings where each string is either the word "solid" or "dashed".

      Have a look in the phplot.php file for this (line 170 on my machine):

      var $line_styles = array('solid', 'solid', 'dashed'); // single value or array

      This is the default, so the third line will be dashed by default.

      So you can add to your code:
      $plot->SetLineStyles( array( "solid", "solid", "solid"));

       

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.