IUP

 view release on metacpan or  search on metacpan

examples/0-basic/plot_advanced.pl  view on Meta::CPAN

use strict;
use warnings;

use IUP ':all';

my $MAXPLOT = 6;
my @plot = ();        # Plot controls
my ($dial1, $dial2);  # dials for zooming
my ($tgg1, $tgg2);    # auto scale on|off toggles
my ($tgg3, $tgg4);    # grid show|hide toggles
my $tgg5;             # legend show|hide toggle
my $tabs;             # tabbed control

sub delete_cb {
  my ($self, $index, $sample_index, $x, $y) = @_;
  printf("DELETE_CB(%d, %d, %g, %g)\n", $index, $sample_index, $x, $y);
  return IUP_DEFAULT;
}

sub select_cb {
my ($self, $index, $sample_index, $x, $y, $select) = @_;

examples/0-basic/plot_advanced.pl  view on Meta::CPAN

    }
    # Y axis
    if ($plot[$ii]->GetAttribute("GRID") eq 'H') {
      $tgg4->VALUE("ON");
    }
    else {
      $tgg4->VALUE("OFF");
    }
  }

  # legend
  if ($plot[$ii]->GetAttribute("LEGENDSHOW")) {
    $tgg5->VALUE("ON");
  }
  else {
    $tgg5->VALUE("OFF");
  }

  return IUP_DEFAULT;
}

examples/0-basic/plot_advanced.pl  view on Meta::CPAN

      $plot[$ii]->SetAttribute("GRID", "VERTICAL");
    }
  }

  $plot[$ii]->SetAttribute("REDRAW", undef);

  return IUP_DEFAULT;
}


# show/hide legend
sub tgg5_cb {
  my ($self, $v) = @_;
  my $ii = tabs_get_index();

  $plot[$ii]->SetAttribute("LEGENDSHOW", $v ? "YES" : "NO");
  $plot[$ii]->SetAttribute("REDRAW", undef);

  return IUP_DEFAULT;
}

examples/1-apps/app-plot-demo.pl  view on Meta::CPAN

use strict;
use warnings;

use IUP ':all';

my $mainplot;
my $mainfunc;
my ($dial1, $dial2);  # dials for zooming
my ($tgg1, $tgg2);    # auto scale on|off toggles
my ($tgg3, $tgg4);    # grid show|hide toggles
my $tgg5;             # legend show|hide toggle

sub delete_cb {
  my ($self, $index, $sample_index, $x, $y) = @_;
  printf STDERR "DELETE_CB(%d, %d, %g, %g)\n", $index, $sample_index, $x, $y;
  return IUP_DEFAULT;
}

sub select_cb {
  my ($self, $index, $sample_index, $x, $y, $select) = @_;
  printf STDERR "SELECT_CB(%d, %d, %g, %g, %d)\n", $index, $sample_index, $x, $y, $select;

examples/1-apps/app-plot-demo.pl  view on Meta::CPAN

    $mainplot->GRID( ($tgg3->VALUE eq 'ON') ? "YES" : "HORIZONTAL" );
  }
  else {
    #unchecked
    $mainplot->GRID( ($tgg3->VALUE eq 'OFF') ? "NO" : "VERTICAL" );
  }
  $mainplot->REDRAW(1);
  return IUP_DEFAULT;
}

# show/hide legend
sub tgg5_cb {
  my ($self, $v) = @_;
  $mainplot->LEGENDSHOW($v ? "YES" : "NO");
  $mainplot->REDRAW(1);
  return IUP_DEFAULT;
}

# autoscale Y
sub tgg1_cb {
  my ($self, $v) = @_;

lib/IUP/MglPlot.pod  view on Meta::CPAN

 $plot = IUP::MglPlot->new( TITLE=>"Simple Data", GRID=>"YES" );

B<Returns:> the identifier of the created element, or C<undef> if an error occurs.

NOTE: You can pass to C<new()> other C<ATTRIBUTE=E<gt>'value'> or C<CALLBACKNAME=E<gt>\&func> pairs relevant
to this element - see L<IUP::Manual::02_Elements|IUP::Manual::02_Elements/"new()">.

=head2 Guide

Each plot can contain 2 or 3 B<axes> (X and Y and/or Z), a B<title>, a
B< legend> B<box>, a B<colorbar>, a B<grid>, a B<dataset> B<area> and
as many B<datasets> you want.

Each dataset is added using the L<PlotAdd1D|/PlotAdd1D>, L<PlotAdd2D|/PlotAdd2D>, L<PlotAdd3D|/PlotAdd3D>, 
L<PlotInsert1D|/PlotInsert1D>, L<PlotInsert2D|/PlotInsert2D>, L<PlotInsert3D|/PlotInsert3D>
L<PlotSet1D|/PlotSet1D>, L<PlotSet2D|/PlotSet2D> and L<PlotSet3D|/PlotSet3D> functions. All other plot
parameters are configured by attributes.

If no attribute is set, the default values were selected to best
display the plot.

B<IMPORTANT>: When setting attributes the plot is NOT redrawn until the
REDRAW attribute is set or a redraw event occurs.

The B<dataset area> is delimited by the min/max axis attributes. Data
is only plotted inside the dataset area. This area defines the 2D or 3D
plot coordinate space. The screen area is a 2D pixels coordinate space.
And finally the dataset also defines a normalized space, that means
min/max is converted to 0-1.

The B<legend box> is a list of the dataset names, each one drawn with
the same color of the correspondent dataset. The box is located in one
of the four corners of the dataset area.

The B<colorbar> is an additional axis showing the the colors used to
pseudo color the data for some plot modes.

The B<grid> is automatically spaced accordingly the current axis
displayed values.

The B<title> is always centered in the top of the plot.

lib/IUP/MglPlot.pod  view on Meta::CPAN


the background color. Default: "255 255 255".

=item B<ERRORMESSAGE>

I<(read-only)(non inheritable)> If not C<undef> returns the last error message reported by MathGL.

=item L<FONT|IUP::Manual::03_Attributes/FONT>

the default font used in all text
elements of the plot: title, legend and labels. Font support is done
using the libraries Freetype and FTGL, so TrueType (*.ttf) and OpenType
(*.otf) font files can be loaded. If the font is not located in the
system, then it will try to find the font file in the current
directory, or in the path from the "IUP_MGLFONTS" environment variable,
or in the path from the "MGLFONTS" global attribute, or in a system
folder. The font name will be combined with the path to compose a file
name. A full path can also be used. If the font load fail, an internal
MathGL font is used.

=item L<FGCOLOR|IUP::Manual::03_Attributes/FGCOLOR>

the default color used in all
text elements of the plot: title, legend and labels. Default: "0 0 0".

=item B<OPENGL>

L<(non inheritable)> Enable or disable the rendering in OpenGL.
Default: No. When NO the rendering is slower, but when Yes some
features does not behave as expected. See L<Known Issues|/"Known Issues">.

=item B<REDRAW>

I<(write-only)(non inheritable)> redraw the plot and update the

lib/IUP/MglPlot.pod  view on Meta::CPAN

Style can be "PLAIN", "BOLD", "ITALIC" or "BOLDITALIC".

=back

=head3 Legend Configuration (non inheritable)

=over

=item B<LEGEND>

shows or hides the legend box. Can be YES or NO. Default: NO. LEGENDSHOW is also accepted.

=item B<LEGENDBOX>

draws a box around the legend area. Default: YES.

=item B<LEGENDCOLOR>

title color. Default: FGCOLOR.

=item B<LEGENDFONTSIZE>

legend font size factor. It is a multiple of the
FONT size. Default: 0.8

=item B<LEGENDFONTSTYLE>

legend font style. If not defined the FONT
attribute will be used instead. Set to C<undef>, to use the FONT attribute
values. Style can be "PLAIN", "BOLD", "ITALIC" or "BOLDITALIC".

=item B<LEGENDPOS>

legend box position. Can be: "TOPLEFT", "TOPRIGHT",
"BOTTOMLEFT", or "BOTTOMRIGHT. Default: "TOPRIGHT".

=back

=head3 Colorbar Configuration (non inheritable)

=over

=item B<COLORBAR>

lib/IUP/MglPlot.pod  view on Meta::CPAN

I<(write-only)> removes a dataset given its index.

=back

=head3 Dataset Configuration (non inheritable)

=over

=item B<DS_COLOR>

color of the current dataset and it legend text. Default
is dynamically generated for the 6 first datasets, others are default
to black "0 0 0". The first 6 are: 0="255 0 0", 1="0 0 255", 2="0 255
0", 3="0 255 255", 4="255 0 255", 5="255 255 0".

=item B<DS_COUNT>

I<(read-only)> returns the number of samples of the current
dataset. For planar or volumetric datasets returns count_x * count_y * count_z.

=item B<DS_DIMENSION>

I<(read-only)> returns the number of dimensions of the
data: 1, 2 or 3. For planar and volumetric datasets returns the actual
size of each dimension C<count_x x count_y x count_z>, for example
"600x400x1" (planar) or "512x512x512" (volumetric).

=item B<DS_LEGEND>

legend text of the current dataset. Default is
dynamically generated: "plot 0", "plot 1", "plot 2", ...

=item B<DS_LINESTYLE>

line style of the current dataset. Can be:
"CONTINUOUS", "LONGDASHED", "DASHED", "SMALLDASHED", "DOTTED",
"DASH_DOT", "SMALLDASH_DOT". Default is "CONTINUOUS".

=item B<DS_LINEWIDTH>

lib/IUP/PPlot.pod  view on Meta::CPAN


 $pplot = IUP::PPlot->new( TITLE=>"Simple Data", GRID=>"YES" );

B<Returns:> the identifier of the created element, or C<undef> if an error occurs.

NOTE: You can pass to C<new()> other C<ATTRIBUTE=E<gt>'value'> or C<CALLBACKNAME=E<gt>\&func> pairs relevant
to this element - see L<IUP::Manual::02_Elements|IUP::Manual::02_Elements/"new()">.

=head2 Guide

Each plot can contain 2 B<axis> (X and Y), a B<title>, a B<legend>
B<box>, a B<grid>, a B<dataset> B<area> and as many B<datasets> you
want.

Each data set is added using the L<IUP::PPlotAdd |IUP::PPlotAdd> function. All other plot
parameters are configured by attributes.

If no attribute is set, the default values were selected to best
display the plot.

When setting attributes the plot is NOT redrawn until the REDRAW
attribute is set or a redraw event occurs.

The B<dataset area> is delimited by a margin. Data is only plotted
inside the dataset area. Axis and main title are positioned independent
of this margin. It is very important to set the margins when using axis
automatic scaling or the axis maybe hidden.

The B<legend box> is a list of the dataset names, each one drawn with
the same color of the correspondent dataset. The box is located in one
of the four corners of the dataset area.

The B<grid> is automatically spaced accordingly the current axis
displayed values.

The B<title> is always centered in the top of the plot.

The B<axis> are always positioned at the origin, except when
CrossOrigin is disabled, then it is positioned at the left-bottom. If

lib/IUP/PPlot.pod  view on Meta::CPAN

=item B<USE_GDI+>

I<[Windows Only] (non inheritable)> Defines if the double
buffer will use GDI+ (YES) for drawing or standard GDI (NO). Default:
NO. The GDI+ driver has anti-aliasing which can improve the line
drawing.

=item B<L<FONT|IUP::Manual::03_Attributes/FONT>>

The font used in all text elements
of the plot: title, legend and labels.

=item B<L<BGCOLOR|IUP::Manual::03_Attributes/BGCOLOR>>

The background color. The
default value is white "255 255 255".

=item B<L<FGCOLOR|IUP::Manual::03_Attributes/FGCOLOR>>

The title color. The default
value is black "0 0 0".

lib/IUP/PPlot.pod  view on Meta::CPAN

must be set so the plot is not cropped. Default: "15", "15", "30", "15".

=back

=head3 Legend Configuration (non inheritable)

=over

=item B<LEGENDSHOW>

Shows or hides the legend box. Can be YES or NO.
Default: NO.

=item B<LEGENDPOS>

Legend box position. Can be: "TOPLEFT", "TOPRIGHT",
"BOTTOMLEFT", or "BOTTOMRIGHT. Default: "TOPRIGHT".

=item B<LEGENDFONTSIZE, LEGENDFONTSTYLE>

The legend box text font size and style.

=back

=head3 Grid Configuration (non inheritable)

=over

=item B<GRIDLINESTYLE>

Line style of the grid. Can be: "CONTINUOUS",

lib/IUP/PPlot.pod  view on Meta::CPAN

added it becomes the current dataset. The index starts at 0. All "DS_*"
attributes are dependent on this value.

=item B<DS_LEGEND>

Legend text of the current dataset. Default is
dynamically generated: "plot 0", "plot 1", "plot 2", ...

=item B<DS_COLOR>

Color of the current dataset and it legend text. Default
is dynamically generated for the 6 first datasets, others are default
to black "0 0 0". The first 6 are: 0="255 0 0", 1="0 0 255", 2="0 255
0", 3="0 255 255", 4="255 0 255", 5="255 255 0".

=item B<DS_MODE>

Drawing mode of the current dataset. Can be: "LINE", "BAR",
"MARK" or "MARKLINE". Default: "LINE". This must be set before other
"DS_*" attributes.



( run in 1.021 second using v1.01-cache-2.11-cpan-49f99fa48dc )