The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

—
use Moose;
use Moose::Util::TypeConstraints qw(enum union);
if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
Moose::Util::TypeConstraints::type('PDL');
}
our $VERSION = '0.042'; # VERSION
# ABSTRACT: This attribute is one of the possible options for the trace indicator.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta = $self->meta;
my %hash = %$self;
for my $name ( sort keys %hash ) {
my $attr = $meta->get_attribute($name);
if ( defined $attr ) {
my $value = $hash{$name};
my $type = $attr->type_constraint;
if ( $type && $type->equals('Bool') ) {
$hash{$name} = $value ? \1 : \0;
}
}
}
%hash = ( %hash, %$extra_args );
delete $hash{'extra_args'};
if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
$hash{type} = $self->type();
}
return \%hash;
}
has axis => ( is => "rw",
isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Axis", );
has bar => ( is => "rw",
isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Bar", );
has bgcolor => ( is => "rw",
isa => "Str",
documentation => "Sets the gauge background color.",
);
has bordercolor => ( is => "rw",
isa => "Str",
documentation => "Sets the color of the border enclosing the gauge.",
);
has borderwidth => ( is => "rw",
isa => "Num",
documentation => "Sets the width (in px) of the border enclosing the gauge.",
);
has description => ( is => "ro",
default => "The gauge of the Indicator plot.", );
has shape => ( is => "rw",
isa => enum( [ "angular", "bullet" ] ),
documentation => "Set the shape of the gauge",
);
has steps => ( is => "rw",
isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Indicator::Gauge::Step]", );
has threshold => ( is => "rw",
isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Threshold", );
__PACKAGE__->meta->make_immutable();
1;
__END__
=pod
=encoding utf-8
=head1 NAME
Chart::Plotly::Trace::Indicator::Gauge - This attribute is one of the possible options for the trace indicator.
=head1 VERSION
version 0.042
=head1 SYNOPSIS
use Chart::Plotly;
use Chart::Plotly::Plot;
use JSON;
use Chart::Plotly::Trace::Indicator;
my $trace1 = Chart::Plotly::Trace::Indicator->new({'domain' => {'column' => 0, 'row' => 0, }, 'gauge' => {'axis' => {'range' => [0, 200, ], 'visible' => JSON::false, }, }, 'delta' => {'reference' => 60, }, 'value' => 120, });
my $trace2 = Chart::Plotly::Trace::Indicator->new({'value' => 120, 'gauge' => {'axis' => {'visible' => JSON::false, 'range' => [-200, 200, ], }, 'shape' => 'bullet', }, 'domain' => {'y' => [0.15, 0.35, ], 'x' => [0.05, 0.5, ], }, });
my $trace3 = Chart::Plotly::Trace::Indicator->new({'domain' => {'column' => 1, 'row' => 0, }, 'value' => 120, 'mode' => 'number+delta', });
my $trace4 = Chart::Plotly::Trace::Indicator->new({'domain' => {'row' => 1, 'column' => 1, }, 'value' => 40, 'mode' => 'delta', });
my $plot = Chart::Plotly::Plot->new(
traces => [$trace1, $trace2, $trace3, $trace4, ],
layout =>
{'margin' => {'b' => 25, 'l' => 25, 'r' => 25, 't' => 25, }, 'template' => {'data' => {'indicator' => [{'mode' => 'number+delta+gauge', 'title' => {'text' => 'Title', }, 'delta' => {'reference' => 60, }, }, ], }, }, 'height' => 400, 'grid' => {'columns' => 2, 'pattern' => 'independent', 'rows' => 2, }, 'width' => 700, }
);
Chart::Plotly::show_plot($plot);
=head1 DESCRIPTION
This attribute is part of the possible options for the trace indicator.
This file has been autogenerated from the official plotly.js source.
If you like Plotly, please support them: L<https://plot.ly/>
=head1 DISCLAIMER
This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
But I think plotly.js is a great library and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head1 ATTRIBUTES
=over
=item * axis
=item * bar
=item * bgcolor
Sets the gauge background color.
=item * bordercolor
Sets the color of the border enclosing the gauge.
=item * borderwidth
Sets the width (in px) of the border enclosing the gauge.
=item * description
=item * shape
Set the shape of the gauge
=item * steps
=item * threshold
=back
=head1 AUTHOR
Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2022 by Pablo Rodríguez González.
This is free software, licensed under:
The MIT (X11) License
=cut