Object/SparklineGroup.pm untested

filter: Statementstmt 0.0% 0 / 93 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 126 CC 6 SCAR 16.0
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 5.0
1 =begin comment
2
3 Copyright (c) 2026 Aspose.Cells Cloud
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21
22 =end comment
23
24 =cut
25
26 package AsposeCellsCloud::Object::SparklineGroup;
27
28 require 5.6.0;
29 use strict;
30 use warnings;
31 use utf8;
32 use JSON qw(decode_json);
33 use Data::Dumper;
34 use Module::Runtime qw(use_module);
35 use Log::Any qw($log);
36 use Date::Parse;
37 use DateTime;
38 use AsposeCellsCloud::Object::CellsColor;
39 use AsposeCellsCloud::Object::Sparkline;
40
41
42 use base ("Class::Accessor", "Class::Data::Inheritable");
43
44
45
46 __PACKAGE__->mk_classdata('attribute_map' => {});
47 __PACKAGE__->mk_classdata('swagger_types' => {});
48 __PACKAGE__->mk_classdata('method_documentation' => {});
49 __PACKAGE__->mk_classdata('class_documentation' => {});
50
51 # new object
52 sub new {
53 my ($class, %args) = @_;
54
55 my $self = bless {}, $class;
56
57 foreach my $attribute (keys %{$class->attribute_map}) {
58 my $args_key = $class->attribute_map->{$attribute};
59 $self->$attribute( $args{ $args_key } );
60 }
61
62 return $self;
63 }
64
65 # return perl hash
66 sub to_hash {
67 return decode_json(JSON->new->convert_blessed->encode( shift ));
68 }
69
70 # used by JSON for serialization
71 sub TO_JSON {
72 my $self = shift;
73 my $_data = {};
74 foreach my $_key (keys %{$self->attribute_map}) {
75 if (defined $self->{$_key}) {
76 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
77 }
78 }
79 return $_data;
80 }
81
82 # from Perl hashref
83 sub from_hash {
84 my ($self, $hash) = @_;
85
86 # loop through attributes and use swagger_types to deserialize the data
87 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
88 my $_json_attribute = $self->attribute_map->{$_key};
89 if ($_type =~ /^array\[/i) { # array
90 my $_subclass = substr($_type, 6, -1);
91 my @_array = ();
92 foreach my $_element (@{$hash->{$_json_attribute}}) {
93 push @_array, $self->_deserialize($_subclass, $_element);
94 }
95 $self->{$_key} = \@_array;
96 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
97 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
98 } else {
99 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
100 }
101 }
102
103 return $self;
104 }
105
106 # deserialize non-array data
107 sub _deserialize {
108 my ($self, $type, $data) = @_;
109 $log->debugf("deserializing %s with %s",Dumper($data), $type);
110
111 if ($type eq 'DateTime') {
112 return DateTime->from_epoch(epoch => str2time($data));
113 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
114 return $data;
115 } else { # hash(model)
116 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
117 return $_instance->from_hash($data);
118 }
119 }
120
121
122 __PACKAGE__->class_documentation({description => ' is organized into sparkline group. A SparklineGroup contains a variable number of sparkline items. A sparkline group specifies the type, display settings and axis settings for the sparklines. ',
123 class => 'SparklineGroup',
124 required => [], # TODO
125 } );
126
127
128 __PACKAGE__->method_documentation({
129 'display_hidden' => {
130 datatype => 'boolean',
131 base_name => 'DisplayHidden',
132 description => 'Indicates whether to show data in hidden rows and columns. ',
133 format => '',
134 read_only => '',
135 },
136 'first_point_color' => {
137 datatype => 'CellsColor',
138 base_name => 'FirstPointColor',
139 description => 'Gets and sets the color of the first point of data in the sparkline group. ',
140 format => '',
141 read_only => '',
142 },
143 'high_point_color' => {
144 datatype => 'CellsColor',
145 base_name => 'HighPointColor',
146 description => 'Gets and sets the color of the highest points of data in the sparkline group. ',
147 format => '',
148 read_only => '',
149 },
150 'horizontal_axis_color' => {
151 datatype => 'CellsColor',
152 base_name => 'HorizontalAxisColor',
153 description => 'Gets and sets the color of the horizontal axis in the sparkline group. ',
154 format => '',
155 read_only => '',
156 },
157 'horizontal_axis_date_range' => {
158 datatype => 'string',
159 base_name => 'HorizontalAxisDateRange',
160 description => 'Represents the range that contains the date values for the sparkline data. ',
161 format => '',
162 read_only => '',
163 },
164 'last_point_color' => {
165 datatype => 'CellsColor',
166 base_name => 'LastPointColor',
167 description => 'Gets and sets the color of the last point of data in the sparkline group. ',
168 format => '',
169 read_only => '',
170 },
171 'line_weight' => {
172 datatype => 'double',
173 base_name => 'LineWeight',
174 description => 'Gets and sets the line weight in each line sparkline in the sparkline group, in the unit of points. ',
175 format => '',
176 read_only => '',
177 },
178 'low_point_color' => {
179 datatype => 'CellsColor',
180 base_name => 'LowPointColor',
181 description => 'Gets and sets the color of the lowest points of data in the sparkline group. ',
182 format => '',
183 read_only => '',
184 },
185 'markers_color' => {
186 datatype => 'CellsColor',
187 base_name => 'MarkersColor',
188 description => 'Gets and sets the color of points in each line sparkline in the sparkline group. ',
189 format => '',
190 read_only => '',
191 },
192 'negative_points_color' => {
193 datatype => 'CellsColor',
194 base_name => 'NegativePointsColor',
195 description => 'Gets and sets the color of the negative values on the sparkline group. ',
196 format => '',
197 read_only => '',
198 },
199 'plot_empty_cells_type' => {
200 datatype => 'string',
201 base_name => 'PlotEmptyCellsType',
202 description => 'Indicates how to plot empty cells. ',
203 format => '',
204 read_only => '',
205 },
206 'plot_right_to_left' => {
207 datatype => 'boolean',
208 base_name => 'PlotRightToLeft',
209 description => 'Indicates whether the plot data is right to left. ',
210 format => '',
211 read_only => '',
212 },
213 'preset_style' => {
214 datatype => 'string',
215 base_name => 'PresetStyle',
216 description => 'Gets and sets the preset style type of the sparkline group. ',
217 format => '',
218 read_only => '',
219 },
220 'series_color' => {
221 datatype => 'CellsColor',
222 base_name => 'SeriesColor',
223 description => 'Gets and sets the color of the sparklines in the sparkline group. ',
224 format => '',
225 read_only => '',
226 },
227 'show_first_point' => {
228 datatype => 'boolean',
229 base_name => 'ShowFirstPoint',
230 description => 'Indicates whether to highlight the first point of data in the sparkline group. ',
231 format => '',
232 read_only => '',
233 },
234 'show_high_point' => {
235 datatype => 'boolean',
236 base_name => 'ShowHighPoint',
237 description => 'Indicates whether to highlight the highest points of data in the sparkline group. ',
238 format => '',
239 read_only => '',
240 },
241 'show_horizontal_axis' => {
242 datatype => 'boolean',
243 base_name => 'ShowHorizontalAxis',
244 description => 'Indicates whether to show the sparkline horizontal axis. The horizontal axis appears if the sparkline has data that crosses the zero axis. ',
245 format => '',
246 read_only => '',
247 },
248 'show_last_point' => {
249 datatype => 'boolean',
250 base_name => 'ShowLastPoint',
251 description => 'Indicates whether to highlight the last point of data in the sparkline group. ',
252 format => '',
253 read_only => '',
254 },
255 'show_low_point' => {
256 datatype => 'boolean',
257 base_name => 'ShowLowPoint',
258 description => 'Indicates whether to highlight the lowest points of data in the sparkline group. ',
259 format => '',
260 read_only => '',
261 },
262 'show_markers' => {
263 datatype => 'boolean',
264 base_name => 'ShowMarkers',
265 description => 'Indicates whether to highlight each point in each line sparkline in the sparkline group. ',
266 format => '',
267 read_only => '',
268 },
269 'show_negative_points' => {
270 datatype => 'boolean',
271 base_name => 'ShowNegativePoints',
272 description => 'Indicates whether to highlight the negative values on the sparkline group with a different color or marker. ',
273 format => '',
274 read_only => '',
275 },
276 'sparkline_collection' => {
277 datatype => 'ARRAY[Sparkline]',
278 base_name => 'SparklineCollection',
279 description => 'Gets the collection of object. ',
280 format => '',
281 read_only => '',
282 },
283 'type' => {
284 datatype => 'string',
285 base_name => 'Type',
286 description => 'Indicates the sparkline type of the sparkline group. ',
287 format => '',
288 read_only => '',
289 },
290 'vertical_axis_max_value' => {
291 datatype => 'double',
292 base_name => 'VerticalAxisMaxValue',
293 description => 'Gets and sets the custom maximum value for the vertical axis. ',
294 format => '',
295 read_only => '',
296 },
297 'vertical_axis_max_value_type' => {
298 datatype => 'string',
299 base_name => 'VerticalAxisMaxValueType',
300 description => 'Represents the vertical axis maximum value type. ',
301 format => '',
302 read_only => '',
303 },
304 'vertical_axis_min_value' => {
305 datatype => 'double',
306 base_name => 'VerticalAxisMinValue',
307 description => 'Gets and sets the custom minimum value for the vertical axis. ',
308 format => '',
309 read_only => '',
310 },
311 'vertical_axis_min_value_type' => {
312 datatype => 'string',
313 base_name => 'VerticalAxisMinValueType',
314 description => 'Represents the vertical axis minimum value type. ',
315 format => '',
316 read_only => '',
317 },
318 });
319
320 __PACKAGE__->swagger_types( {
321 'display_hidden' => 'boolean',
322 'first_point_color' => 'CellsColor',
323 'high_point_color' => 'CellsColor',
324 'horizontal_axis_color' => 'CellsColor',
325 'horizontal_axis_date_range' => 'string',
326 'last_point_color' => 'CellsColor',
327 'line_weight' => 'double',
328 'low_point_color' => 'CellsColor',
329 'markers_color' => 'CellsColor',
330 'negative_points_color' => 'CellsColor',
331 'plot_empty_cells_type' => 'string',
332 'plot_right_to_left' => 'boolean',
333 'preset_style' => 'string',
334 'series_color' => 'CellsColor',
335 'show_first_point' => 'boolean',
336 'show_high_point' => 'boolean',
337 'show_horizontal_axis' => 'boolean',
338 'show_last_point' => 'boolean',
339 'show_low_point' => 'boolean',
340 'show_markers' => 'boolean',
341 'show_negative_points' => 'boolean',
342 'sparkline_collection' => 'ARRAY[Sparkline]',
343 'type' => 'string',
344 'vertical_axis_max_value' => 'double',
345 'vertical_axis_max_value_type' => 'string',
346 'vertical_axis_min_value' => 'double',
347 'vertical_axis_min_value_type' => 'string'
348 } );
349
350 __PACKAGE__->attribute_map( {
351 'display_hidden' => 'DisplayHidden',
352 'first_point_color' => 'FirstPointColor',
353 'high_point_color' => 'HighPointColor',
354 'horizontal_axis_color' => 'HorizontalAxisColor',
355 'horizontal_axis_date_range' => 'HorizontalAxisDateRange',
356 'last_point_color' => 'LastPointColor',
357 'line_weight' => 'LineWeight',
358 'low_point_color' => 'LowPointColor',
359 'markers_color' => 'MarkersColor',
360 'negative_points_color' => 'NegativePointsColor',
361 'plot_empty_cells_type' => 'PlotEmptyCellsType',
362 'plot_right_to_left' => 'PlotRightToLeft',
363 'preset_style' => 'PresetStyle',
364 'series_color' => 'SeriesColor',
365 'show_first_point' => 'ShowFirstPoint',
366 'show_high_point' => 'ShowHighPoint',
367 'show_horizontal_axis' => 'ShowHorizontalAxis',
368 'show_last_point' => 'ShowLastPoint',
369 'show_low_point' => 'ShowLowPoint',
370 'show_markers' => 'ShowMarkers',
371 'show_negative_points' => 'ShowNegativePoints',
372 'sparkline_collection' => 'SparklineCollection',
373 'type' => 'Type',
374 'vertical_axis_max_value' => 'VerticalAxisMaxValue',
375 'vertical_axis_max_value_type' => 'VerticalAxisMaxValueType',
376 'vertical_axis_min_value' => 'VerticalAxisMinValue',
377 'vertical_axis_min_value_type' => 'VerticalAxisMinValueType'
378 } );
379
380 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
381
382
383 1;