📄 jpgraph.php
字号:
{
$this->img->SetAngle( $aAngle );
}
public function SetAlphaBlending( $aFlg = true )
{
$this->img->SetAlphaBlending( $aFlg );
}
public function SetMargin( $lm, $rm, $tm, $bm )
{
$this->img->SetMargin( $lm, $rm, $tm, $bm );
}
public function SetY2OrderBack( $aBack = true )
{
$this->y2orderback = $aBack;
}
public function Set90AndMargin( $lm = 0, $rm = 0, $tm = 0, $bm = 0 )
{
$lm = $lm == 0 ? floor( 0.2 * $this->img->width ) : $lm;
$rm = $rm == 0 ? floor( 0.1 * $this->img->width ) : $rm;
$tm = $tm == 0 ? floor( 0.2 * $this->img->height ) : $tm;
$bm = $bm == 0 ? floor( 0.1 * $this->img->height ) : $bm;
$adj = ( $this->img->height - $this->img->width ) / 2;
$this->img->SetMargin( $tm - $adj, $bm - $adj, $rm + $adj, $lm + $adj );
$this->img->SetCenter( floor( $this->img->width / 2 ), floor( $this->img->height / 2 ) );
$this->SetAngle( 90 );
if ( empty( $this->yaxis ) || empty( $this->xaxis ) )
{
JpgraphError::raisel( 25009 );
}
$this->xaxis->SetLabelAlign( "right", "center" );
$this->yaxis->SetLabelAlign( "center", "bottom" );
}
public function SetClipping( $aFlg = true )
{
$this->iDoClipping = $aFlg;
}
public function Add( $aPlot )
{
if ( $aPlot == null )
{
JpGraphError::raisel( 25010 );
}
if ( is_array( $aPlot ) && 0 < count( $aPlot ) )
{
$cl = $aPlot[0];
}
else
{
$cl = $aPlot;
}
if ( $cl instanceof Text )
{
$this->AddText( $aPlot );
}
else if ( $cl instanceof PlotLine )
{
$this->AddLine( $aPlot );
}
else if ( class_exists( "PlotBand", false ) && $cl instanceof PlotBand )
{
$this->AddBand( $aPlot );
}
else if ( class_exists( "IconPlot", false ) && $cl instanceof IconPlot )
{
$this->AddIcon( $aPlot );
}
else if ( class_exists( "GTextTable", false ) && $cl instanceof GTextTable )
{
$this->AddTable( $aPlot );
}
else
{
$this->plots[] = $aPlot;
}
}
public function AddTable( $aTable )
{
if ( is_array( $aTable ) )
{
$i = 0;
for ( ; do
{
$i < count( $aTable ); ++$i, )
{
$this->iTables[] = $aTable[$i];
break;
}
} while ( 1 );
}
else
{
$this->iTables[] = $aTable;
}
}
public function AddIcon( $aIcon )
{
if ( is_array( $aIcon ) )
{
$i = 0;
for ( ; do
{
$i < count( $aIcon ); ++$i, )
{
$this->iIcons[] = $aIcon[$i];
break;
}
} while ( 1 );
}
else
{
$this->iIcons[] = $aIcon;
}
}
public function AddY2( $aPlot )
{
if ( $aPlot == null )
{
JpGraphError::raisel( 25011 );
}
if ( is_array( $aPlot ) && 0 < count( $aPlot ) )
{
$cl = $aPlot[0];
}
else
{
$cl = $aPlot;
}
if ( $cl instanceof Text )
{
$this->AddText( $aPlot, true );
}
else if ( $cl instanceof PlotLine )
{
$this->AddLine( $aPlot, true );
}
else if ( class_exists( "PlotBand", false ) && $cl instanceof PlotBand )
{
$this->AddBand( $aPlot, true );
}
else
{
$this->y2plots[] = $aPlot;
}
}
public function AddY( $aN, $aPlot )
{
if ( $aPlot == null )
{
JpGraphError::raisel( 25012 );
}
if ( is_array( $aPlot ) && 0 < count( $aPlot ) )
{
$cl = $aPlot[0];
}
else
{
$cl = $aPlot;
}
if ( $cl instanceof Text || $cl instanceof PlotLine || class_exists( "PlotBand", false ) && $cl instanceof PlotBand )
{
JpGraph::raisel( 25013 );
}
else
{
$this->ynplots[$aN][] = $aPlot;
}
}
public function AddText( $aTxt, $aToY2 = false )
{
if ( $aTxt == null )
{
JpGraphError::raisel( 25014 );
}
if ( $aToY2 )
{
if ( is_array( $aTxt ) )
{
$i = 0;
for ( ; do
{
$i < count( $aTxt ); ++$i, )
{
$this->y2texts[] = $aTxt[$i];
break;
}
} while ( 1 );
}
else
{
$this->y2texts[] = $aTxt;
}
}
else if ( is_array( $aTxt ) )
{
$i = 0;
for ( ; do
{
$i < count( $aTxt ); ++$i, )
{
$this->texts[] = $aTxt[$i];
break;
}
} while ( 1 );
}
else
{
$this->texts[] = $aTxt;
}
}
public function AddLine( $aLine, $aToY2 = false )
{
if ( $aLine == null )
{
JpGraphError::raisel( 25015 );
}
if ( $aToY2 )
{
if ( is_array( $aLine ) )
{
$i = 0;
for ( ; do
{
$i < count( $aLine ); ++$i, )
{
$this->y2lines[] = $aLine[$i];
break;
}
} while ( 1 );
}
else
{
$this->y2lines[] = $aLine;
}
}
else if ( is_array( $aLine ) )
{
$i = 0;
for ( ; do
{
$i < count( $aLine ); ++$i, )
{
$this->lines[] = $aLine[$i];
break;
}
} while ( 1 );
}
else
{
$this->lines[] = $aLine;
}
}
public function AddBand( $aBand, $aToY2 = false )
{
if ( $aBand == null )
{
JpGraphError::raisel( 25016 );
}
if ( $aToY2 )
{
if ( is_array( $aBand ) )
{
$i = 0;
for ( ; do
{
$i < count( $aBand ); ++$i, )
{
$this->y2bands[] = $aBand[$i];
break;
}
} while ( 1 );
}
else
{
$this->y2bands[] = $aBand;
}
}
else if ( is_array( $aBand ) )
{
$i = 0;
for ( ; do
{
$i < count( $aBand ); ++$i, )
{
$this->bands[] = $aBand[$i];
break;
}
} while ( 1 );
}
else
{
$this->bands[] = $aBand;
}
}
public function SetBackgroundGradient( $aFrom = "navy", $aTo = "silver", $aGradType = 2, $aStyle = BGRAD_FRAME )
{
$this->bkg_gradtype = $aGradType;
$this->bkg_gradstyle = $aStyle;
$this->bkg_gradfrom = $aFrom;
$this->bkg_gradto = $aTo;
}
public function SetBackgroundCFlag( $aName, $aBgType = BGIMG_FILLPLOT, $aMix = 100 )
{
$this->background_cflag = $aName;
$this->background_cflag_type = $aBgType;
$this->background_cflag_mix = $aMix;
}
public function SetBackgroundCountryFlag( $aName, $aBgType = BGIMG_FILLPLOT, $aMix = 100 )
{
$this->background_cflag = $aName;
$this->background_cflag_type = $aBgType;
$this->background_cflag_mix = $aMix;
}
public function SetBackgroundImage( $aFileName, $aBgType = BGIMG_FILLPLOT, $aImgFormat = "auto" )
{
if ( !USE_TRUECOLOR )
{
JpGraphError::raisel( 25017 );
}
if ( $aImgFormat == "auto" )
{
$e = explode( ".", $aFileName );
if ( !$e )
{
JpGraphError::raisel( 25018, $aFileName );
}
$valid_formats = array( "png", "jpg", "gif" );
$aImgFormat = strtolower( $e[count( $e ) - 1] );
if ( $aImgFormat == "jpeg" )
{
$aImgFormat = "jpg";
}
else if ( !in_array( $aImgFormat, $valid_formats ) )
{
JpGraphError::raisel( 25019, $aImgFormat );
}
}
$this->background_image = $aFileName;
$this->background_image_type = $aBgType;
$this->background_image_format = $aImgFormat;
}
public function SetBackgroundImageMix( $aMix )
{
$this->background_image_mix = $aMix;
}
public function AdjBackgroundImage( $aBright, $aContr = 0, $aSat = 0 )
{
$this->background_image_bright = $aBright;
$this->background_image_contr = $aContr;
$this->background_image_sat = $aSat;
}
public function AdjImage( $aBright, $aContr = 0, $aSat = 0 )
{
$this->image_bright = $aBright;
$this->image_contr = $aContr;
$this->image_sat = $aSat;
}
public function SetAxisStyle( $aStyle )
{
$this->iAxisStyle = $aStyle;
}
public function SetBox( $aDrawPlotFrame = true, $aPlotFrameColor = array
(
0 => 0,
1 => 0,
2 => 0
), $aPlotFrameWeight = 1 )
{
$this->boxed = $aDrawPlotFrame;
$this->box_weight = $aPlotFrameWeight;
$this->box_color = $aPlotFrameColor;
}
public function SetColor( $aColor )
{
$this->plotarea_color = $aColor;
}
public function SetMarginColor( $aColor )
{
$this->margin_color = $aColor;
}
public function SetFrame( $aDrawImgFrame = true, $aImgFrameColor = array
(
0 => 0,
1 => 0,
2 => 0
), $aImgFrameWeight = 1 )
{
$this->doframe = $aDrawImgFrame;
$this->frame_color = $aImgFrameColor;
$this->frame_weight = $aImgFrameWeight;
}
public function SetFrameBevel( $aDepth = 3, $aBorder = false, $aBorderColor = "black", $aColor1 = "white@0.4", $aColor2 = "darkgray@0.4", $aFlg = true )
{
$this->framebevel = $aFlg;
$this->framebeveldepth = $aDepth;
$this->framebevelborder = $aBorder;
$this->framebevelbordercolor = $aBorderColor;
$this->framebevelcolor1 = $aColor1;
$this->framebevelcolor2 = $aColor2;
$this->doshadow = false;
}
public function SetShadow( $aShowShadow = true, $aShadowWidth = 5, $aShadowColor = array
(
0 => 102,
1 => 102,
2 => 102
) )
{
$this->doshadow = $aShowShadow;
$this->shadow_color = $aShadowColor;
$this->shadow_width = $aShadowWidth;
$this->footer['iBottomMargin'] += $aShadowWidth;
$this->footer['iRightMargin'] += $aShadowWidth;
}
public function SetScale( $aAxisType, $aYMin = 1, $aYMax = 1, $aXMin = 1, $aXMax = 1 )
{
$this->axtype = $aAxisType;
if ( $aYMax < $aYMin || $aXMax < $aXMin )
{
JpGraphError::raisel( 25020 );
}
$yt = substr( $aAxisType, -3, 3 );
if ( $yt == "lin" )
{
$this->yscale = new LinearScale( $aYMin, $aYMax );
}
else if ( $yt == "int" )
{
$this->yscale = new LinearScale( $aYMin, $aYMax );
$this->yscale->SetIntScale( );
}
else if ( $yt == "log" )
{
$this->yscale = new LogScale( $aYMin, $aYMax );
}
else
{
JpGraphError::raisel( 25021, $aAxisType );
}
$xt = substr( $aAxisType, 0, 3 );
if ( $xt == "lin" || $xt == "tex" )
{
$this->xscale = new LinearScale( $aXMin, $aXMax, "x" );
$this->xscale->textscale = $xt == "tex";
}
else if ( $xt == "int" )
{
$this->xscale = new LinearScale( $aXMin, $aXMax, "x" );
$this->xscale->SetIntScale( );
}
else if ( $xt == "dat" )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -