Quiq::Gd::Component::Grid - Gitter eines XY-Plot
Quiq::Gd::Component
Ein Objekt der Klasse definiert ein Gitter für den Hintergrund (oder Vordergrund, je nach Reihenfolge beim Zeichnen) eines XY-Plot. Das Gitter besteht aus gepunkteten Linien an den Haupt-Ticks der X- und der Y-Achse.
Fett hervorgehobene Attribute sind Pflicht-Attribute. Sie müssen beim Konstruktoraufruf immer angegeben werden.
X-Achse (Subklasse von Quiq::Axis).
Y-Achse (Subklasse von Quiq::Axis).
Farbe der Gitterlinien.
Code:
use Quiq::Gd::Image; use Quiq::Gd::Component::Grid; use Quiq::Axis::Numeric; use Quiq::Axis::Time; my ($width,$height) = (500,200); # Achsen definieren my $ax = Quiq::Axis::Numeric->new( orientation => 'x', font => Quiq::Gd::Font->new('gdSmallFont'), length => $width, min => 0, max => 20, ); my $gAx = Quiq::Gd::Component::Axis->new( axis => $ax, tickDirection => 'u', ); my $ay = Quiq::Axis::Time->new( orientation => 'y', font => Quiq::Gd::Font->new('gdSmallFont'), length => $height, min => Quiq::Epoch->new('2019-11-08 08:00:00')->epoch, max => Quiq::Epoch->new('2019-11-08 16:00:00')->epoch, debug => 0, ); my $gAy = Quiq::Gd::Component::Axis->new( axis => $ay, reverse => 1, ); # Gitter definieren my $grid = Quiq::Gd::Component::Grid->new( xAxis => $ax, yAxis => $ay, color => '#ff0000', ); # Rasterbild erzeugen my $axHeight = $gAx->height; my $ayWidth = $gAy->width; my $img = Quiq::Gd::Image->new( $width + 2*$ayWidth, $height + 2*$axHeight, # $width, # $height, ); $img->background('#ffffff'); # Grid und Achsen zeichnen $grid->render($img,$ayWidth,$axHeight); $gAx->render($img,$ayWidth,$axHeight); $gAx->render($img,$ayWidth,$axHeight+$height-1,tickDirection=>'d'); $gAy->render($img,$ayWidth,$axHeight); $gAy->render($img,$ayWidth+$width-1,$axHeight,tickDirection=>'r');
Grafik:
[Grafik: Gitter eines XY-Plot]
$g = $class->new(@keyVal);
Instantiiere ein Grafik-Objekt mit den Eigenschaften @keyVal (s. Abschnitt ATTRIBUTES) und liefere eine Referenz auf das Objekt zurück.
$g->render($img); $g->render($img,$x,$y,@keyVal); $class->render($img,$x,$y,@keyVal);
Zeichne das Gitter in Bild $img an Position ($x,$y).
siehe BASE CLASS
1.166
Frank Seitz, http://fseitz.de/
Copyright (C) 2019 Frank Seitz
This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Quiq, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Quiq
CPAN shell
perl -MCPAN -e shell install Quiq
For more information on module installation, please visit the detailed CPAN module installation guide.