Chart/Plotly/Trace/Heatmapgl.pm untested

filter: Statementstmt 0.0% 0 / 100 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 137 CC 6 SCAR 28.9
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 18.0
1 package Chart::Plotly::Trace::Heatmapgl;
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::Heatmapgl::Colorbar;
10 use Chart::Plotly::Trace::Heatmapgl::Hoverlabel;
11 use Chart::Plotly::Trace::Heatmapgl::Legendgrouptitle;
12 use Chart::Plotly::Trace::Heatmapgl::Stream;
13 use Chart::Plotly::Trace::Heatmapgl::Transform;
14  
15 our $VERSION = '0.042'; # VERSION
16  
17 # ABSTRACT: *heatmapgl* trace is deprecated! Please consider switching to the *heatmap* or *image* trace types. Alternatively you could contribute/sponsor rewriting this trace type based on cartesian features and using regl framework. WebGL version of the heatmap trace type.
18  
19 sub TO_JSON {
20 my $self = shift;
21 my $extra_args = $self->extra_args // {};
22 my $meta = $self->meta;
23 my %hash = %$self;
24 for my $name ( sort keys %hash ) {
25 my $attr = $meta->get_attribute($name);
26 if ( defined $attr ) {
27 my $value = $hash{$name};
28 my $type = $attr->type_constraint;
29 if ( $type && $type->equals('Bool') ) {
30 $hash{$name} = $value ? \1 : \0;
31 }
32 }
33 }
34 my $plotly_meta = delete $hash{'pmeta'};
35 if ( defined $plotly_meta ) {
36 $hash{'meta'} = $plotly_meta;
37 }
38 %hash = ( %hash, %$extra_args );
39 delete $hash{'extra_args'};
40 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
41 $hash{type} = $self->type();
42 }
43 return \%hash;
44 }
45  
46 sub type {
47 my @components = split( /::/, __PACKAGE__ );
48 return lc( $components[-1] );
49 }
50  
51 has autocolorscale => (
52 is => "rw",
53 isa => "Bool",
54 documentation =>
55 "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `colorscale`. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.",
56 );
57  
58 has coloraxis => (
59 is => "rw",
60 documentation =>
61 "Sets a reference to a shared color axis. References to these shared color axes are *coloraxis*, *coloraxis2*, *coloraxis3*, etc. Settings for these shared color axes are set in the layout, under `layout.coloraxis`, `layout.coloraxis2`, etc. Note that multiple color scales can be linked to the same color axis.",
62 );
63  
64 has colorbar => ( is => "rw",
65 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Heatmapgl::Colorbar", );
66  
67 has colorscale => (
68 is => "rw",
69 documentation =>
70 "Sets the colorscale. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use `zmin` and `zmax`. Alternatively, `colorscale` may be a palette name string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd.",
71 );
72  
73 has customdata => (
74 is => "rw",
75 isa => "ArrayRef|PDL",
76 documentation =>
77 "Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, *scatter* traces also appends customdata items in the markers DOM elements",
78 );
79  
80 has customdatasrc => ( is => "rw",
81 isa => "Str",
82 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
83 );
84  
85 has dx => ( is => "rw",
86 isa => "Num",
87 documentation => "Sets the x coordinate step. See `x0` for more info.",
88 );
89  
90 has dy => ( is => "rw",
91 isa => "Num",
92 documentation => "Sets the y coordinate step. See `y0` for more info.",
93 );
94  
95 has hoverinfo => (
96 is => "rw",
97 isa => "Str|ArrayRef[Str]",
98 documentation =>
99 "Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.",
100 );
101  
102 has hoverinfosrc => ( is => "rw",
103 isa => "Str",
104 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
105 );
106  
107 has hoverlabel => ( is => "rw",
108 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Heatmapgl::Hoverlabel", );
109  
110 has ids => (
111 is => "rw",
112 isa => "ArrayRef|PDL",
113 documentation =>
114 "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.",
115 );
116  
117 has idssrc => ( is => "rw",
118 isa => "Str",
119 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
120 );
121  
122 has legendgrouptitle => ( is => "rw",
123 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Heatmapgl::Legendgrouptitle", );
124  
125 has legendrank => (
126 is => "rw",
127 isa => "Num",
128 documentation =>
129 "Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with `*reversed* `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items.",
130 );
131  
132 has pmeta => (
133 is => "rw",
134 isa => "Any|ArrayRef[Any]",
135 documentation =>
136 "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.",
137 );
138  
139 has metasrc => ( is => "rw",
140 isa => "Str",
141 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
142 );
143  
144 has name => ( is => "rw",
145 isa => "Str",
146 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
147 );
148  
149 has opacity => ( is => "rw",
150 isa => "Num",
151 documentation => "Sets the opacity of the trace.",
152 );
153  
154 has reversescale => (
155 is => "rw",
156 isa => "Bool",
157 documentation =>
158 "Reverses the color mapping if true. If true, `zmin` will correspond to the last color in the array and `zmax` will correspond to the first color.",
159 );
160  
161 has showscale => ( is => "rw",
162 isa => "Bool",
163 documentation => "Determines whether or not a colorbar is displayed for this trace.",
164 );
165  
166 has stream => ( is => "rw",
167 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Heatmapgl::Stream", );
168  
169 has text => ( is => "rw",
170 isa => "ArrayRef|PDL",
171 documentation => "Sets the text elements associated with each z value.",
172 );
173  
174 has textsrc => ( is => "rw",
175 isa => "Str",
176 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
177 );
178  
179 has transforms => ( is => "rw",
180 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Heatmapgl::Transform]", );
181  
182 has transpose => ( is => "rw",
183 isa => "Bool",
184 documentation => "Transposes the z data.",
185 );
186  
187 has uid => (
188 is => "rw",
189 isa => "Str",
190 documentation =>
191 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
192 );
193  
194 has uirevision => (
195 is => "rw",
196 isa => "Any",
197 documentation =>
198 "Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves.",
199 );
200  
201 has visible => (
202 is => "rw",
203 documentation =>
204 "Determines whether or not this trace is visible. If *legendonly*, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).",
205 );
206  
207 has x => ( is => "rw",
208 isa => "ArrayRef|PDL",
209 documentation => "Sets the x coordinates.",
210 );
211  
212 has x0 => (
213 is => "rw",
214 isa => "Any",
215 documentation =>
216 "Alternate to `x`. Builds a linear space of x coordinates. Use with `dx` where `x0` is the starting coordinate and `dx` the step.",
217 );
218  
219 has xaxis => (
220 is => "rw",
221 documentation =>
222 "Sets a reference between this trace's x coordinates and a 2D cartesian x axis. If *x* (the default value), the x coordinates refer to `layout.xaxis`. If *x2*, the x coordinates refer to `layout.xaxis2`, and so on.",
223 );
224  
225 has xsrc => ( is => "rw",
226 isa => "Str",
227 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
228 );
229  
230 has xtype => (
231 is => "rw",
232 isa => enum( [ "array", "scaled" ] ),
233 documentation =>
234 "If *array*, the heatmap's x coordinates are given by *x* (the default behavior when `x` is provided). If *scaled*, the heatmap's x coordinates are given by *x0* and *dx* (the default behavior when `x` is not provided).",
235 );
236  
237 has y => ( is => "rw",
238 isa => "ArrayRef|PDL",
239 documentation => "Sets the y coordinates.",
240 );
241  
242 has y0 => (
243 is => "rw",
244 isa => "Any",
245 documentation =>
246 "Alternate to `y`. Builds a linear space of y coordinates. Use with `dy` where `y0` is the starting coordinate and `dy` the step.",
247 );
248  
249 has yaxis => (
250 is => "rw",
251 documentation =>
252 "Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If *y* (the default value), the y coordinates refer to `layout.yaxis`. If *y2*, the y coordinates refer to `layout.yaxis2`, and so on.",
253 );
254  
255 has ysrc => ( is => "rw",
256 isa => "Str",
257 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
258 );
259  
260 has ytype => (
261 is => "rw",
262 isa => enum( [ "array", "scaled" ] ),
263 documentation =>
264 "If *array*, the heatmap's y coordinates are given by *y* (the default behavior when `y` is provided) If *scaled*, the heatmap's y coordinates are given by *y0* and *dy* (the default behavior when `y` is not provided)",
265 );
266  
267 has z => ( is => "rw",
268 isa => "ArrayRef|PDL",
269 documentation => "Sets the z data.",
270 );
271  
272 has zauto => (
273 is => "rw",
274 isa => "Bool",
275 documentation =>
276 "Determines whether or not the color domain is computed with respect to the input data (here in `z`) or the bounds set in `zmin` and `zmax` Defaults to `false` when `zmin` and `zmax` are set by the user.",
277 );
278  
279 has zmax => (
280 is => "rw",
281 isa => "Num",
282 documentation =>
283 "Sets the upper bound of the color domain. Value should have the same units as in `z` and if set, `zmin` must be set as well.",
284 );
285  
286 has zmid => (
287 is => "rw",
288 isa => "Num",
289 documentation =>
290 "Sets the mid-point of the color domain by scaling `zmin` and/or `zmax` to be equidistant to this point. Value should have the same units as in `z`. Has no effect when `zauto` is `false`.",
291 );
292  
293 has zmin => (
294 is => "rw",
295 isa => "Num",
296 documentation =>
297 "Sets the lower bound of the color domain. Value should have the same units as in `z` and if set, `zmax` must be set as well.",
298 );
299  
300 has zsmooth => ( is => "rw",
301 documentation => "Picks a smoothing algorithm use to smooth `z` data.", );
302  
303 has zsrc => ( is => "rw",
304 isa => "Str",
305 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
306 );
307  
308 __PACKAGE__->meta->make_immutable();
309 1;
310  
311 __END__