App-Widget-ChartDirector

 view release on metacpan or  search on metacpan

lib/App/Widget/ChartDirector.pm  view on Meta::CPAN


    $plot_area->setBackground(hex($plot_bgcolor), hex($plot_bgcolor));

    $c->addTitle($spec->{title}, "arialbd.ttf", 12, hex($titlecolor)) if ($spec->{title});

    if ($y_max_zero == 0) {
        $c->yAxis()->setMargin($top_margin_adjusted + 15);
    }

    #Add a legend box at (55, 22) using horizontal layout, with transparent
    #background
    my $legend;
    if ($spec->{y_labels}) {
        my $x_adj = 0;
        my $y_adj = -2;
        if ($spec->{"3D"}) {
            $x_adj += 5;
            $y_adj += -5;
        }
        
        if (($#{$spec->{y_labels}} > 0) && ($legend_pos eq "top" || $legend_pos eq "bottom")) { 

lib/App/Widget/ChartDirector.pm  view on Meta::CPAN

        else {
            $x_title = $spec->{y_labels}[0];
        }
    }
    if ($x_title) {
        $c->addText($center_x, $center_y+18, $x_title,
            "arialbd.ttf", 10, $perlchartdir::TextColor, $perlchartdir::Center);
    }

    #Add a text box at the top right corner of the meter showing the value formatted
    #to 2 decimal places, using white text on a black background, and with 1 pixel
    #3D depressed border
    $c->addText($center_x + int($radius * 0.7), $center_y - int($radius * 1.0),
        $c->formatValue($value, "2"),
        "arial.ttf", 8, 0xffffff)->setBackground(0x0, 0, -1);

    #Add a semi-transparent blue (40666699) pointer with black border at the
    #specified value
    $value = $y_max if ($value > $y_max);
    $value = 0 if ($value < 0);
    $c->addPointer($value, 0x40666699, 0x0);

lib/App/Widget/ChartDirector.pm  view on Meta::CPAN

#$c->set3D();
##Set the pie data and the pie labels
#$c->setData($data, $labels);

# TODO: This one doesn't work yet
sub write_step_graph_image_step {
    &App::sub_entry if ($App::trace);
    my ($self, $spec) = @_;
    require "perlchartdir.pm";
    #Create a XYChart object of size 500 x 270 pixels, with a pale blue (0xe0e0ff)
    #background, a light blue (0xccccff) border, and 1 pixel 3D border effect.
    my $c = new XYChart(600, 350, 0xe0e0ff, 0xccccff, 1);  #800
    #Set the plotarea at (50, 50) and of size 420 x 180 pixels, using white
    #(0xffffff) as the plot area background color. Turn on both horizontal and
    #vertical grid lines with light grey color (0xc0c0c0)

    $c->setPlotArea(50, 50, 320, 260, 0xffffff)->setGridColor(0xc0c0c0, 0xc0c0c0); #720

    #Add a legend box at (55, 25) (top of the chart) with horizontal layout. Use 10
    #pts Arial Bold Italic font. Set the background and border color to Transparent.
    $c->addLegend(55, 20, 0, "arialbi.ttf", 10)->setBackground($perlchartdir::Transparent);

    #Add a title to the chart using 14 points Times Bold Itatic font, using blue
    #(0x9999ff) as the background color
    $c->addTitle("Rate History", "arialbi.ttf", 12)->setBackground(0x9999ff);

    #Set the y axis label format to display a percentage sign
    #$c->yAxis()->setLabelFormat("{value}%");

    my $labels = $spec->{labels} || [ "Unknown" ];
    my $default_colors =
        [ 0x0000ff, 0x00ff00, 0xff0000, 0x00ffff, 0xff00ff, 0xffff00,
          0x111199, 0x119911, 0x991111, 0x119999, 0x991199, 0x999911,
          0x3333dd, 0x33dd33, 0xdd3333, 0x33dddd, 0xdd33dd, 0xdddd33,



( run in 0.647 second using v1.01-cache-2.11-cpan-f56aa216473 )