Chart/Plotly/Trace/Indicator/Gauge/Axis.pm untested

filter: Statementstmt 0.0% 0 / 76 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 106 CC 5 SCAR 27.7
CC
5
Cov
0%
TO_JSON
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 16.0
1 package Chart::Plotly::Trace::Indicator::Gauge::Axis;
2 use Moose;
3 use MooseX::ExtraArgs;
4 use Moose::Util::TypeConstraints qw(enum union);
5 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6 Moose::Util::TypeConstraints::type('PDL');
7 }
8  
9 use Chart::Plotly::Trace::Indicator::Gauge::Axis::Tickfont;
10 use Chart::Plotly::Trace::Indicator::Gauge::Axis::Tickformatstop;
11  
12 our $VERSION = '0.042'; # VERSION
13  
14 # ABSTRACT: This attribute is one of the possible options for the trace indicator.
15  
16 sub TO_JSON {
17 my $self = shift;
18 my $extra_args = $self->extra_args // {};
19 my $meta = $self->meta;
20 my %hash = %$self;
21 for my $name ( sort keys %hash ) {
22 my $attr = $meta->get_attribute($name);
23 if ( defined $attr ) {
24 my $value = $hash{$name};
25 my $type = $attr->type_constraint;
26 if ( $type && $type->equals('Bool') ) {
27 $hash{$name} = $value ? \1 : \0;
28 }
29 }
30 }
31 %hash = ( %hash, %$extra_args );
32 delete $hash{'extra_args'};
33 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
34 $hash{type} = $self->type();
35 }
36 return \%hash;
37 }
38  
39 has dtick => (
40 is => "rw",
41 isa => "Any",
42 documentation =>
43 "Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L<f>*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *n* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*",
44 );
45  
46 has exponentformat => (
47 is => "rw",
48 isa => enum( [ "none", "e", "E", "power", "SI", "B" ] ),
49 documentation =>
50 "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B.",
51 );
52  
53 has minexponent => (
54 is => "rw",
55 isa => "Num",
56 documentation =>
57 "Hide SI prefix for 10^n if |n| is below this number. This only has an effect when `tickformat` is *SI* or *B*.",
58 );
59  
60 has nticks => (
61 is => "rw",
62 isa => "Int",
63 documentation =>
64 "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.",
65 );
66  
67 has range => ( is => "rw",
68 isa => "ArrayRef|PDL",
69 documentation => "Sets the range of this axis.",
70 );
71  
72 has separatethousands => ( is => "rw",
73 isa => "Bool",
74 documentation => "If \"true\", even 4-digit integers are separated",
75 );
76  
77 has showexponent => (
78 is => "rw",
79 isa => enum( [ "all", "first", "last", "none" ] ),
80 documentation =>
81 "If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.",
82 );
83  
84 has showticklabels => ( is => "rw",
85 isa => "Bool",
86 documentation => "Determines whether or not the tick labels are drawn.",
87 );
88  
89 has showtickprefix => (
90 is => "rw",
91 isa => enum( [ "all", "first", "last", "none" ] ),
92 documentation =>
93 "If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.",
94 );
95  
96 has showticksuffix => ( is => "rw",
97 isa => enum( [ "all", "first", "last", "none" ] ),
98 documentation => "Same as `showtickprefix` but for tick suffixes.",
99 );
100  
101 has tick0 => (
102 is => "rw",
103 isa => "Any",
104 documentation =>
105 "Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is *log*, then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L<f>* (see `dtick` for more info). If the axis `type` is *date*, it should be a date string, like date data. If the axis `type` is *category*, it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears.",
106 );
107  
108 has tickangle => (
109 is => "rw",
110 documentation =>
111 "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.",
112 );
113  
114 has tickcolor => ( is => "rw",
115 isa => "Str",
116 documentation => "Sets the tick color.",
117 );
118  
119 has tickfont => ( is => "rw",
120 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Axis::Tickfont", );
121  
122 has tickformat => (
123 is => "rw",
124 isa => "Str",
125 documentation =>
126 "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: *%h* for half of the year as a decimal number as well as *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*",
127 );
128  
129 has tickformatstops => ( is => "rw",
130 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Indicator::Gauge::Axis::Tickformatstop]", );
131  
132 has ticklabelstep => (
133 is => "rw",
134 isa => "Int",
135 documentation =>
136 "Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. `tick0` determines which labels are shown. Not implemented for axes with `type` *log* or *multicategory*, or when `tickmode` is *array*.",
137 );
138  
139 has ticklen => ( is => "rw",
140 isa => "Num",
141 documentation => "Sets the tick length (in px).",
142 );
143  
144 has tickmode => (
145 is => "rw",
146 isa => enum( [ "auto", "linear", "array" ] ),
147 documentation =>
148 "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).",
149 );
150  
151 has tickprefix => ( is => "rw",
152 isa => "Str",
153 documentation => "Sets a tick label prefix.",
154 );
155  
156 has ticks => (
157 is => "rw",
158 isa => enum( [ "outside", "inside", "" ] ),
159 documentation =>
160 "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.",
161 );
162  
163 has ticksuffix => ( is => "rw",
164 isa => "Str",
165 documentation => "Sets a tick label suffix.",
166 );
167  
168 has ticktext => (
169 is => "rw",
170 isa => "ArrayRef|PDL",
171 documentation =>
172 "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.",
173 );
174  
175 has ticktextsrc => ( is => "rw",
176 isa => "Str",
177 documentation => "Sets the source reference on Chart Studio Cloud for `ticktext`.",
178 );
179  
180 has tickvals => (
181 is => "rw",
182 isa => "ArrayRef|PDL",
183 documentation =>
184 "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.",
185 );
186  
187 has tickvalssrc => ( is => "rw",
188 isa => "Str",
189 documentation => "Sets the source reference on Chart Studio Cloud for `tickvals`.",
190 );
191  
192 has tickwidth => ( is => "rw",
193 isa => "Num",
194 documentation => "Sets the tick width (in px).",
195 );
196  
197 has visible => (
198 is => "rw",
199 isa => "Bool",
200 documentation =>
201 "A single toggle to hide the axis while preserving interaction like dragging. Default is true when a cheater plot is present on the axis, otherwise false",
202 );
203  
204 __PACKAGE__->meta->make_immutable();
205 1;
206  
207 __END__