Object/Chart.pm untested

filter: Statementstmt 0.0% 0 / 117 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 26 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 158 CC 6 SCAR 14.3
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.2
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::Chart;
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::Axis;
39 use AsposeCellsCloud::Object::ChartArea;
40 use AsposeCellsCloud::Object::ChartDataTable;
41 use AsposeCellsCloud::Object::Floor;
42 use AsposeCellsCloud::Object::Legend;
43 use AsposeCellsCloud::Object::Link;
44 use AsposeCellsCloud::Object::LinkElement;
45 use AsposeCellsCloud::Object::PlotArea;
46 use AsposeCellsCloud::Object::SeriesItems;
47 use AsposeCellsCloud::Object::Walls;
48
49
50 use base ("Class::Accessor", "Class::Data::Inheritable");
51
52
53
54 __PACKAGE__->mk_classdata('attribute_map' => {});
55 __PACKAGE__->mk_classdata('swagger_types' => {});
56 __PACKAGE__->mk_classdata('method_documentation' => {});
57 __PACKAGE__->mk_classdata('class_documentation' => {});
58
59 # new object
60 sub new {
61 my ($class, %args) = @_;
62
63 my $self = bless {}, $class;
64
65 foreach my $attribute (keys %{$class->attribute_map}) {
66 my $args_key = $class->attribute_map->{$attribute};
67 $self->$attribute( $args{ $args_key } );
68 }
69
70 return $self;
71 }
72
73 # return perl hash
74 sub to_hash {
75 return decode_json(JSON->new->convert_blessed->encode( shift ));
76 }
77
78 # used by JSON for serialization
79 sub TO_JSON {
80 my $self = shift;
81 my $_data = {};
82 foreach my $_key (keys %{$self->attribute_map}) {
83 if (defined $self->{$_key}) {
84 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
85 }
86 }
87 return $_data;
88 }
89
90 # from Perl hashref
91 sub from_hash {
92 my ($self, $hash) = @_;
93
94 # loop through attributes and use swagger_types to deserialize the data
95 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
96 my $_json_attribute = $self->attribute_map->{$_key};
97 if ($_type =~ /^array\[/i) { # array
98 my $_subclass = substr($_type, 6, -1);
99 my @_array = ();
100 foreach my $_element (@{$hash->{$_json_attribute}}) {
101 push @_array, $self->_deserialize($_subclass, $_element);
102 }
103 $self->{$_key} = \@_array;
104 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
105 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
106 } else {
107 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
108 }
109 }
110
111 return $self;
112 }
113
114 # deserialize non-array data
115 sub _deserialize {
116 my ($self, $type, $data) = @_;
117 $log->debugf("deserializing %s with %s",Dumper($data), $type);
118
119 if ($type eq 'DateTime') {
120 return DateTime->from_epoch(epoch => str2time($data));
121 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
122 return $data;
123 } else { # hash(model)
124 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
125 return $_instance->from_hash($data);
126 }
127 }
128
129
130 __PACKAGE__->class_documentation({description => 'Encapsulates the object that represents a single Excel chart.',
131 class => 'Chart',
132 required => [], # TODO
133 } );
134
135
136 __PACKAGE__->method_documentation({
137 'auto_scaling' => {
138 datatype => 'boolean',
139 base_name => 'AutoScaling',
140 description => 'True if Microsoft Excel scales a 3-D chart so that it`s closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True.',
141 format => '',
142 read_only => '',
143 },
144 'back_wall' => {
145 datatype => 'Walls',
146 base_name => 'BackWall',
147 description => 'Returns a object that represents the back wall of a 3-D chart.',
148 format => '',
149 read_only => '',
150 },
151 'category_axis' => {
152 datatype => 'Axis',
153 base_name => 'CategoryAxis',
154 description => 'Gets the chart`s X axis.',
155 format => '',
156 read_only => '',
157 },
158 'chart_area' => {
159 datatype => 'ChartArea',
160 base_name => 'ChartArea',
161 description => 'Gets the chart area in the worksheet.',
162 format => '',
163 read_only => '',
164 },
165 'chart_data_table' => {
166 datatype => 'ChartDataTable',
167 base_name => 'ChartDataTable',
168 description => 'Represents the chart data table.',
169 format => '',
170 read_only => '',
171 },
172 'chart_object' => {
173 datatype => 'LinkElement',
174 base_name => 'ChartObject',
175 description => 'Represents the chartShape;',
176 format => '',
177 read_only => '',
178 },
179 'depth_percent' => {
180 datatype => 'int',
181 base_name => 'DepthPercent',
182 description => 'Represents the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent).',
183 format => '',
184 read_only => '',
185 },
186 'elevation' => {
187 datatype => 'int',
188 base_name => 'Elevation',
189 description => 'Represents the elevation of the 3-D chart view, in degrees.',
190 format => '',
191 read_only => '',
192 },
193 'first_slice_angle' => {
194 datatype => 'int',
195 base_name => 'FirstSliceAngle',
196 description => 'Gets or sets the angle of the first pie-chart or doughnut-chart slice, in degrees (clockwise from vertical). Applies only to pie, 3-D pie, and doughnut charts, 0 to 360.',
197 format => '',
198 read_only => '',
199 },
200 'floor' => {
201 datatype => 'Floor',
202 base_name => 'Floor',
203 description => 'Returns a object that represents the walls of a 3-D chart.',
204 format => '',
205 read_only => '',
206 },
207 'gap_depth' => {
208 datatype => 'int',
209 base_name => 'GapDepth',
210 description => 'Gets or sets the distance between the data series in a 3-D chart, as a percentage of the marker width. The value of this property must be between 0 and 500.',
211 format => '',
212 read_only => '',
213 },
214 'gap_width' => {
215 datatype => 'int',
216 base_name => 'GapWidth',
217 description => 'Returns or sets the space between bar or column clusters, as a percentage of the bar or column width. The value of this property must be between 0 and 500.',
218 format => '',
219 read_only => '',
220 },
221 'height_percent' => {
222 datatype => 'int',
223 base_name => 'HeightPercent',
224 description => 'Returns or sets the height of a 3-D chart as a percentage of the chart width (between 5 and 500 percent).',
225 format => '',
226 read_only => '',
227 },
228 'hide_pivot_field_buttons' => {
229 datatype => 'boolean',
230 base_name => 'HidePivotFieldButtons',
231 description => 'Indicates whether hide the pivot chart field buttons only when the chart is PivotChart.',
232 format => '',
233 read_only => '',
234 },
235 'is3_d' => {
236 datatype => 'boolean',
237 base_name => 'Is3D',
238 description => 'Indicates whether the chart is a 3d chart.',
239 format => '',
240 read_only => '',
241 },
242 'is_rectangular_cornered' => {
243 datatype => 'boolean',
244 base_name => 'IsRectangularCornered',
245 description => 'Gets or sets a value indicating whether the chart area is rectangular cornered. Default is true.',
246 format => '',
247 read_only => '',
248 },
249 'legend' => {
250 datatype => 'Legend',
251 base_name => 'Legend',
252 description => 'Gets the chart legend.',
253 format => '',
254 read_only => '',
255 },
256 'name' => {
257 datatype => 'string',
258 base_name => 'Name',
259 description => 'Represents chart name.',
260 format => '',
261 read_only => '',
262 },
263 'n_series' => {
264 datatype => 'SeriesItems',
265 base_name => 'NSeries',
266 description => 'Gets a collection representing the data series in the chart.',
267 format => '',
268 read_only => '',
269 },
270 'page_setup' => {
271 datatype => 'LinkElement',
272 base_name => 'PageSetup',
273 description => 'Represents the page setup description in this chart.',
274 format => '',
275 read_only => '',
276 },
277 'perspective' => {
278 datatype => 'int',
279 base_name => 'Perspective',
280 description => 'Returns or sets the perspective for the 3-D chart view. Must be between 0 and 100. This property is ignored if the RightAngleAxes property is True.',
281 format => '',
282 read_only => '',
283 },
284 'pivot_source' => {
285 datatype => 'string',
286 base_name => 'PivotSource',
287 description => 'The source is the data of the pivotTable. If PivotSource is not empty ,the chart is PivotChart.',
288 format => '',
289 read_only => '',
290 },
291 'placement' => {
292 datatype => 'string',
293 base_name => 'Placement',
294 description => 'Represents the way the chart is attached to the cells below it.',
295 format => '',
296 read_only => '',
297 },
298 'plot_area' => {
299 datatype => 'PlotArea',
300 base_name => 'PlotArea',
301 description => 'Gets the chart`s plot area which includes axis tick labels.',
302 format => '',
303 read_only => '',
304 },
305 'plot_empty_cells_type' => {
306 datatype => 'string',
307 base_name => 'PlotEmptyCellsType',
308 description => 'Gets and sets how to plot the empty cells.',
309 format => '',
310 read_only => '',
311 },
312 'plot_visible_cells' => {
313 datatype => 'boolean',
314 base_name => 'PlotVisibleCells',
315 description => 'Indicates whether only plot visible cells.',
316 format => '',
317 read_only => '',
318 },
319 'print_size' => {
320 datatype => 'string',
321 base_name => 'PrintSize',
322 description => 'Gets and sets the printed chart size.',
323 format => '',
324 read_only => '',
325 },
326 'right_angle_axes' => {
327 datatype => 'boolean',
328 base_name => 'RightAngleAxes',
329 description => 'True if the chart axes are at right angles. Applies only for 3-D charts(except Column3D and 3-D Pie Charts).',
330 format => '',
331 read_only => '',
332 },
333 'rotation_angle' => {
334 datatype => 'int',
335 base_name => 'RotationAngle',
336 description => 'Represents the rotation of the 3-D chart view (the rotation of the plot area around the z-axis, in degrees).',
337 format => '',
338 read_only => '',
339 },
340 'second_category_axis' => {
341 datatype => 'LinkElement',
342 base_name => 'SecondCategoryAxis',
343 description => 'Gets the chart`s second X axis.',
344 format => '',
345 read_only => '',
346 },
347 'second_value_axis' => {
348 datatype => 'LinkElement',
349 base_name => 'SecondValueAxis',
350 description => 'Gets the chart`s second Y axis.',
351 format => '',
352 read_only => '',
353 },
354 'series_axis' => {
355 datatype => 'LinkElement',
356 base_name => 'SeriesAxis',
357 description => 'Gets the chart`s series axis.',
358 format => '',
359 read_only => '',
360 },
361 'shapes' => {
362 datatype => 'LinkElement',
363 base_name => 'Shapes',
364 description => 'Returns all drawing shapes in this chart.',
365 format => '',
366 read_only => '',
367 },
368 'show_data_table' => {
369 datatype => 'boolean',
370 base_name => 'ShowDataTable',
371 description => 'Gets or sets a value indicating whether the chart displays a data table.',
372 format => '',
373 read_only => '',
374 },
375 'show_legend' => {
376 datatype => 'boolean',
377 base_name => 'ShowLegend',
378 description => 'Gets or sets a value indicating whether the chart legend will be displayed. Default is true.',
379 format => '',
380 read_only => '',
381 },
382 'side_wall' => {
383 datatype => 'LinkElement',
384 base_name => 'SideWall',
385 description => 'Returns a object that represents the side wall of a 3-D chart.',
386 format => '',
387 read_only => '',
388 },
389 'size_with_window' => {
390 datatype => 'boolean',
391 base_name => 'SizeWithWindow',
392 description => 'True if Microsoft Excel resizes the chart to match the size of the chart sheet window.',
393 format => '',
394 read_only => '',
395 },
396 'style' => {
397 datatype => 'int',
398 base_name => 'Style',
399 description => 'Gets and sets the builtin style.',
400 format => '',
401 read_only => '',
402 },
403 'title' => {
404 datatype => 'LinkElement',
405 base_name => 'Title',
406 description => 'Represents chart title.',
407 format => '',
408 read_only => '',
409 },
410 'type' => {
411 datatype => 'string',
412 base_name => 'Type',
413 description => 'Represents chart type.',
414 format => '',
415 read_only => '',
416 },
417 'value_axis' => {
418 datatype => 'Axis',
419 base_name => 'ValueAxis',
420 description => 'Gets the chart`s Y axis.',
421 format => '',
422 read_only => '',
423 },
424 'walls' => {
425 datatype => 'LinkElement',
426 base_name => 'Walls',
427 description => 'Returns a object that represents the walls of a 3-D chart.',
428 format => '',
429 read_only => '',
430 },
431 'walls_and_gridlines2_d' => {
432 datatype => 'boolean',
433 base_name => 'WallsAndGridlines2D',
434 description => 'True if gridlines are drawn two-dimensionally on a 3-D chart.',
435 format => '',
436 read_only => '',
437 },
438 'link' => {
439 datatype => 'Link',
440 base_name => 'link',
441 description => '',
442 format => '',
443 read_only => '',
444 },
445 });
446
447 __PACKAGE__->swagger_types( {
448 'auto_scaling' => 'boolean',
449 'back_wall' => 'Walls',
450 'category_axis' => 'Axis',
451 'chart_area' => 'ChartArea',
452 'chart_data_table' => 'ChartDataTable',
453 'chart_object' => 'LinkElement',
454 'depth_percent' => 'int',
455 'elevation' => 'int',
456 'first_slice_angle' => 'int',
457 'floor' => 'Floor',
458 'gap_depth' => 'int',
459 'gap_width' => 'int',
460 'height_percent' => 'int',
461 'hide_pivot_field_buttons' => 'boolean',
462 'is3_d' => 'boolean',
463 'is_rectangular_cornered' => 'boolean',
464 'legend' => 'Legend',
465 'name' => 'string',
466 'n_series' => 'SeriesItems',
467 'page_setup' => 'LinkElement',
468 'perspective' => 'int',
469 'pivot_source' => 'string',
470 'placement' => 'string',
471 'plot_area' => 'PlotArea',
472 'plot_empty_cells_type' => 'string',
473 'plot_visible_cells' => 'boolean',
474 'print_size' => 'string',
475 'right_angle_axes' => 'boolean',
476 'rotation_angle' => 'int',
477 'second_category_axis' => 'LinkElement',
478 'second_value_axis' => 'LinkElement',
479 'series_axis' => 'LinkElement',
480 'shapes' => 'LinkElement',
481 'show_data_table' => 'boolean',
482 'show_legend' => 'boolean',
483 'side_wall' => 'LinkElement',
484 'size_with_window' => 'boolean',
485 'style' => 'int',
486 'title' => 'LinkElement',
487 'type' => 'string',
488 'value_axis' => 'Axis',
489 'walls' => 'LinkElement',
490 'walls_and_gridlines2_d' => 'boolean',
491 'link' => 'Link'
492 } );
493
494 __PACKAGE__->attribute_map( {
495 'auto_scaling' => 'AutoScaling',
496 'back_wall' => 'BackWall',
497 'category_axis' => 'CategoryAxis',
498 'chart_area' => 'ChartArea',
499 'chart_data_table' => 'ChartDataTable',
500 'chart_object' => 'ChartObject',
501 'depth_percent' => 'DepthPercent',
502 'elevation' => 'Elevation',
503 'first_slice_angle' => 'FirstSliceAngle',
504 'floor' => 'Floor',
505 'gap_depth' => 'GapDepth',
506 'gap_width' => 'GapWidth',
507 'height_percent' => 'HeightPercent',
508 'hide_pivot_field_buttons' => 'HidePivotFieldButtons',
509 'is3_d' => 'Is3D',
510 'is_rectangular_cornered' => 'IsRectangularCornered',
511 'legend' => 'Legend',
512 'name' => 'Name',
513 'n_series' => 'NSeries',
514 'page_setup' => 'PageSetup',
515 'perspective' => 'Perspective',
516 'pivot_source' => 'PivotSource',
517 'placement' => 'Placement',
518 'plot_area' => 'PlotArea',
519 'plot_empty_cells_type' => 'PlotEmptyCellsType',
520 'plot_visible_cells' => 'PlotVisibleCells',
521 'print_size' => 'PrintSize',
522 'right_angle_axes' => 'RightAngleAxes',
523 'rotation_angle' => 'RotationAngle',
524 'second_category_axis' => 'SecondCategoryAxis',
525 'second_value_axis' => 'SecondValueAxis',
526 'series_axis' => 'SeriesAxis',
527 'shapes' => 'Shapes',
528 'show_data_table' => 'ShowDataTable',
529 'show_legend' => 'ShowLegend',
530 'side_wall' => 'SideWall',
531 'size_with_window' => 'SizeWithWindow',
532 'style' => 'Style',
533 'title' => 'Title',
534 'type' => 'Type',
535 'value_axis' => 'ValueAxis',
536 'walls' => 'Walls',
537 'walls_and_gridlines2_d' => 'WallsAndGridlines2D',
538 'link' => 'link'
539 } );
540
541 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
542
543
544 1;