/usr/share/jpgraph/jpgraph_scatter.php is in libphp-jpgraph 1.5.2-12.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | <?php
/*=======================================================================
// File: JPGRAPH_SCATTER.PHP
// Description: Scatter (and impuls) plot extension for JpGraph
// Created: 2001-02-11
// Author: Johan Persson (johanp@aditus.nu)
// Ver: $Id: jpgraph_scatter.php,v 1.12 2002/01/18 10:11:31 aditus Exp $
//
// License: This code is released under GPL 2.0
// Copyright (C) 2001 Johan Persson
//========================================================================
*/
//===================================================
// CLASS ScatterPlot
// Description: Render X and Y plots
//===================================================
class ScatterPlot extends Plot {
var $impuls = false;
var $linkpoints = false, $linkpointweight=1, $linkpointcolor="black";
//---------------
// CONSTRUCTOR
function ScatterPlot(&$datay,$datax=false) {
if( (count($datax) != count($datay)) && is_array($datax))
JpGraphError::Raise("JpGraph: Scatterplot must have equal number of X and Y points.");
$this->Plot($datay,$datax);
$this->mark = new PlotMark();
$this->mark->SetType(MARK_CIRCLE);
$this->mark->SetColor($this->color);
}
//---------------
// PUBLIC METHODS
function SetImpuls($f=true) {
$this->impuls = $f;
}
// Combine the scatter plot points with a line
function SetLinkPoints($f=true,$lpc="black",$weight=1) {
$this->linkpoints=$f;
$this->linkpointcolor=$lpc;
$this->linkpointweight=$weight;
}
function Stroke(&$img,&$xscale,&$yscale) {
$ymin=$yscale->scale_abs[0];
if( $yscale->scale[0] < 0 )
$yzero=$yscale->Translate(0);
else
$yzero=$yscale->scale_abs[0];
for( $i=0; $i<$this->numpoints; ++$i ) {
if( isset($this->coords[1]) )
$xt = $xscale->Translate($this->coords[1][$i]);
else
$xt = $xscale->Translate($i);
$yt = $yscale->Translate($this->coords[0][$i]);
if( $this->linkpoints && isset($yt_old) ) {
$img->SetColor($this->linkpointcolor);
$img->SetLineWeight($this->linkpointweight);
$img->Line($xt_old,$yt_old,$xt,$yt);
}
if( $this->impuls ) {
$img->SetColor($this->color);
$img->SetLineWeight($this->weight);
$img->Line($xt,$yzero,$xt,$yt);
}
$this->mark->Stroke($img,$xt,$yt);
$xt_old = $xt;
$yt_old = $yt;
}
}
// Framework function
function Legend(&$aGraph) {
if( $this->legend != "" ) {
$aGraph->legend->Add($this->legend,$this->mark->fill_color);
}
}
} // Class
/* EOF */
?>
|