Exemplo n.º 1
0
        // Will suppress the label
        $max_indexes[] = $max_index;
    }
    return $max_indexes;
}
# Custom label formatting function: Return an empty string, unless this is
# the largest value in the row.
function fmt_label($value, $maxes, $row, $column)
{
    if ($maxes[$row] == $column) {
        return $value;
    }
    return "";
}
# Get the data array with 11 rows, 6 values per row:
$data = make_data_array(11, 6);
# Process the data array to find the largest Y per row:
$max_indexes = find_max_indexes($data);
# Now plot the data:
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
// For presentation in the manual
$plot->SetPlotType('linepoints');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetTitle('Linepoints plot with only max Y values labeled');
$plot->SetYDataLabelPos('plotin');
$plot->SetYDataLabelType('custom', 'fmt_label', $max_indexes);
$plot->SetLineStyles('solid');
$plot->SetYTickIncrement(100);
$plot->DrawGraph();
Exemplo n.º 2
0
        }
    }
    return "{$result}[{$passthru}]";
}
$plot = new PHPlot(800, 600);
$plot->SetDataType($data_type);
$plot->SetDataValues(make_data_array($plot_type, $data_type, $nx, $ny, $max));
$plot->SetPlotType($plot_type);
$plot->SetTitle($title);
$plot->SetXTitle('X Axis Title Here');
$plot->SetYTitle('Y Axis Title Here');
# Use the same custom formatting function for both label types:
#   Vertical plots:   X axis data labels, Y data value labels
#   Horizontal plots: X data value labels, Y axis data labels
$plot->SetXDataLabelType('custom', 'fmtdl', 'X');
$plot->SetYDataLabelType('custom', 'fmtdl', 'Y');
# Turn off ticks on independent axis, and turn on data value labels. This
# depends on the plot type and data type (horizontal or vertical):
$label_pos = $plot_type == 'stackedbars' ? 'plotstack' : 'plotin';
if ($data_type == 'text-data-yx' || $data_type == 'data-data-yx') {
    // Horizontal plot: configure X data value labels
    $plot->SetYTickPos('none');
    $plot->SetXDataLabelPos($label_pos);
    $plot->SetPlotAreaWorld(0, 0, NULL, $nx);
    $plot->SetXTickIncrement(1);
} else {
    // Vertical plot: configure Y data value labels
    $plot->SetXTickPos('none');
    $plot->SetYDataLabelPos($label_pos);
    $plot->SetPlotAreaWorld(0, 0, $nx, NULL);
    $plot->SetYTickIncrement(1);
Exemplo n.º 3
0
    $theta += $d_theta;
}
$p = new PHPlot(800, 600);
$p->SetTitle($title . $suffix);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetImageBorderType('solid');
$p->SetYDataLabelPos('plotin');
if (isset($yd_angle)) {
    $p->SetYDataLabelAngle($yd_angle);
}
if (isset($y_type)) {
    $p->SetYLabelType($y_type, $y_type_arg);
}
if (isset($yd_type)) {
    $p->SetYDataLabelType($yd_type, $yd_type_arg);
}
if (isset($y_label_font)) {
    if (isset($y_label_font_ttfsize)) {
        $p->SetFontTTF('y_label', $y_label_font, $y_label_font_ttfsize);
    } else {
        $p->SetFontGD('y_label', $y_label_font);
    }
}
$p->SetXLabelType('data', 3);
$p->SetPlotType($plot_type);
if (isset($dvl_angle)) {
    $p->data_value_label_angle = $dvl_angle;
}
if (isset($dvl_dist)) {
    $p->data_value_label_distance = $dvl_dist;
Exemplo n.º 4
0
$plot->SetXDataLabelPos('plotup');
$plot->SetXTickLabelPos('plotdown');
$plot->SetPlotBorderType('full');
// Plot #1:
$plot->SetPlotAreaPixels(NULL, 80, NULL, 305);
if (isset($fmt[1]['x'])) {
    $plot->SetXLabelType('printf', $fmt[1]['x']);
}
if (isset($fmt[1]['y'])) {
    $plot->SetYLabelType('printf', $fmt[1]['y']);
}
if (isset($fmt[1]['xd'])) {
    $plot->SetXDataLabelType('printf', $fmt[1]['xd']);
}
if (isset($fmt[1]['yd'])) {
    $plot->SetYDataLabelType('printf', $fmt[1]['yd']);
}
$plot->DrawGraph();
// Plot #2:
$plot->SetPlotAreaPixels(NULL, 345, NULL, 570);
if (isset($fmt[2]['x'])) {
    $plot->SetXLabelType('printf', $fmt[2]['x']);
}
if (isset($fmt[2]['y'])) {
    $plot->SetYLabelType('printf', $fmt[2]['y']);
}
if (isset($fmt[2]['xd'])) {
    $plot->SetXDataLabelType('printf', $fmt[2]['xd']);
}
if (isset($fmt[2]['yd'])) {
    $plot->SetYDataLabelType('printf', $fmt[2]['yd']);
Exemplo n.º 5
0
    $p->SetXDataLabelAngle($tp['xd_angle']);
}
if (isset($tp['x_type'])) {
    $p->SetXLabelType($tp['x_type'], $tp['x_type_arg']);
}
if (isset($tp['xd_type'])) {
    $p->SetXDataLabelType($tp['xd_type'], $tp['xd_type_arg']);
}
if (isset($tp['xt_pos'])) {
    $p->SetXTickLabelPos($tp['xt_pos']);
}
if (isset($tp['xd_pos'])) {
    $p->SetXDataLabelPos($tp['xd_pos']);
}
# Options: Y
if (isset($tp['y_angle'])) {
    $p->SetYLabelAngle($tp['y_angle']);
}
if (isset($tp['yd_angle'])) {
    $p->SetYDataLabelAngle($tp['yd_angle']);
}
if (isset($tp['y_type'])) {
    $p->SetYLabelType($tp['y_type'], $tp['y_type_arg']);
}
if (isset($tp['yd_type'])) {
    $p->SetYDataLabelType($tp['yd_type'], $tp['yd_type_arg']);
}
if (isset($tp['yt_pos'])) {
    $p->SetYTickLabelPos($tp['yt_pos']);
}
$p->DrawGraph();