Chart/Plotly/Trace/Densitymapbox.pm untested

filter: Statementstmt 0.0% 0 / 96 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 / 133 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::Densitymapbox;
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::Densitymapbox::Colorbar;
10 use Chart::Plotly::Trace::Densitymapbox::Hoverlabel;
11 use Chart::Plotly::Trace::Densitymapbox::Legendgrouptitle;
12 use Chart::Plotly::Trace::Densitymapbox::Stream;
13 use Chart::Plotly::Trace::Densitymapbox::Transform;
14  
15 our $VERSION = '0.042'; # VERSION
16  
17 # ABSTRACT: Draws a bivariate kernel density estimation with a Gaussian kernel from `lon` and `lat` coordinates and optional `z` values using a colorscale.
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 below => (
59 is => "rw",
60 isa => "Str",
61 documentation =>
62 "Determines if the densitymapbox trace will be inserted before the layer with the specified ID. By default, densitymapbox traces are placed below the first layer of type symbol If set to '', the layer will be inserted above every existing layer.",
63 );
64  
65 has coloraxis => (
66 is => "rw",
67 documentation =>
68 "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.",
69 );
70  
71 has colorbar => ( is => "rw",
72 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Densitymapbox::Colorbar", );
73  
74 has colorscale => (
75 is => "rw",
76 documentation =>
77 "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.",
78 );
79  
80 has customdata => (
81 is => "rw",
82 isa => "ArrayRef|PDL",
83 documentation =>
84 "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",
85 );
86  
87 has customdatasrc => ( is => "rw",
88 isa => "Str",
89 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
90 );
91  
92 has hoverinfo => (
93 is => "rw",
94 isa => "Str|ArrayRef[Str]",
95 documentation =>
96 "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.",
97 );
98  
99 has hoverinfosrc => ( is => "rw",
100 isa => "Str",
101 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
102 );
103  
104 has hoverlabel => ( is => "rw",
105 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Densitymapbox::Hoverlabel", );
106  
107 has hovertemplate => (
108 is => "rw",
109 isa => "Str|ArrayRef[Str]",
110 documentation =>
111 "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:\$.2f}\". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example \"Day: %{2019-01-01|%A}\". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `<extra>` is displayed in the secondary box, for example \"<extra>{fullData.name}</extra>\". To hide the secondary box completely, use an empty tag `<extra></extra>`.",
112 );
113  
114 has hovertemplatesrc => ( is => "rw",
115 isa => "Str",
116 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
117 );
118  
119 has hovertext => (
120 is => "rw",
121 isa => "Str|ArrayRef[Str]",
122 documentation =>
123 "Sets hover text elements associated with each (lon,lat) pair If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (lon,lat) coordinates. To be seen, trace `hoverinfo` must contain a *text* flag.",
124 );
125  
126 has hovertextsrc => ( is => "rw",
127 isa => "Str",
128 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
129 );
130  
131 has ids => (
132 is => "rw",
133 isa => "ArrayRef|PDL",
134 documentation =>
135 "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.",
136 );
137  
138 has idssrc => ( is => "rw",
139 isa => "Str",
140 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
141 );
142  
143 has lat => ( is => "rw",
144 isa => "ArrayRef|PDL",
145 documentation => "Sets the latitude coordinates (in degrees North).",
146 );
147  
148 has latsrc => ( is => "rw",
149 isa => "Str",
150 documentation => "Sets the source reference on Chart Studio Cloud for `lat`.",
151 );
152  
153 has legendgroup => (
154 is => "rw",
155 isa => "Str",
156 documentation =>
157 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
158 );
159  
160 has legendgrouptitle => ( is => "rw",
161 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Densitymapbox::Legendgrouptitle", );
162  
163 has legendrank => (
164 is => "rw",
165 isa => "Num",
166 documentation =>
167 "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.",
168 );
169  
170 has lon => ( is => "rw",
171 isa => "ArrayRef|PDL",
172 documentation => "Sets the longitude coordinates (in degrees East).",
173 );
174  
175 has lonsrc => ( is => "rw",
176 isa => "Str",
177 documentation => "Sets the source reference on Chart Studio Cloud for `lon`.",
178 );
179  
180 has pmeta => (
181 is => "rw",
182 isa => "Any|ArrayRef[Any]",
183 documentation =>
184 "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.",
185 );
186  
187 has metasrc => ( is => "rw",
188 isa => "Str",
189 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
190 );
191  
192 has name => ( is => "rw",
193 isa => "Str",
194 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
195 );
196  
197 has opacity => ( is => "rw",
198 isa => "Num",
199 documentation => "Sets the opacity of the trace.",
200 );
201  
202 has radius => (
203 is => "rw",
204 isa => "Num|ArrayRef[Num]",
205 documentation =>
206 "Sets the radius of influence of one `lon` / `lat` point in pixels. Increasing the value makes the densitymapbox trace smoother, but less detailed.",
207 );
208  
209 has radiussrc => ( is => "rw",
210 isa => "Str",
211 documentation => "Sets the source reference on Chart Studio Cloud for `radius`.",
212 );
213  
214 has reversescale => (
215 is => "rw",
216 isa => "Bool",
217 documentation =>
218 "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.",
219 );
220  
221 has showlegend => (
222 is => "rw",
223 isa => "Bool",
224 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
225 );
226  
227 has showscale => ( is => "rw",
228 isa => "Bool",
229 documentation => "Determines whether or not a colorbar is displayed for this trace.",
230 );
231  
232 has stream => ( is => "rw",
233 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Densitymapbox::Stream", );
234  
235 has subplot => (
236 is => "rw",
237 documentation =>
238 "Sets a reference between this trace's data coordinates and a mapbox subplot. If *mapbox* (the default value), the data refer to `layout.mapbox`. If *mapbox2*, the data refer to `layout.mapbox2`, and so on.",
239 );
240  
241 has text => (
242 is => "rw",
243 isa => "Str|ArrayRef[Str]",
244 documentation =>
245 "Sets text elements associated with each (lon,lat) pair If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (lon,lat) coordinates. If trace `hoverinfo` contains a *text* flag and *hovertext* is not set, these elements will be seen in the hover labels.",
246 );
247  
248 has textsrc => ( is => "rw",
249 isa => "Str",
250 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
251 );
252  
253 has transforms => ( is => "rw",
254 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Densitymapbox::Transform]", );
255  
256 has uid => (
257 is => "rw",
258 isa => "Str",
259 documentation =>
260 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
261 );
262  
263 has uirevision => (
264 is => "rw",
265 isa => "Any",
266 documentation =>
267 "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.",
268 );
269  
270 has visible => (
271 is => "rw",
272 documentation =>
273 "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).",
274 );
275  
276 has z => (
277 is => "rw",
278 isa => "ArrayRef|PDL",
279 documentation =>
280 "Sets the points' weight. For example, a value of 10 would be equivalent to having 10 points of weight 1 in the same spot",
281 );
282  
283 has zauto => (
284 is => "rw",
285 isa => "Bool",
286 documentation =>
287 "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.",
288 );
289  
290 has zmax => (
291 is => "rw",
292 isa => "Num",
293 documentation =>
294 "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.",
295 );
296  
297 has zmid => (
298 is => "rw",
299 isa => "Num",
300 documentation =>
301 "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`.",
302 );
303  
304 has zmin => (
305 is => "rw",
306 isa => "Num",
307 documentation =>
308 "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.",
309 );
310  
311 has zsrc => ( is => "rw",
312 isa => "Str",
313 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
314 );
315  
316 __PACKAGE__->meta->make_immutable();
317 1;
318  
319 __END__