Object/Axis.pm untested

filter: Statementstmt 0.0% 0 / 108 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 23 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 146 CC 6 SCAR 14.9
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.4
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::Axis;
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::Area;
39 use AsposeCellsCloud::Object::DisplayUnitLabel;
40 use AsposeCellsCloud::Object::Line;
41 use AsposeCellsCloud::Object::Link;
42 use AsposeCellsCloud::Object::LinkElement;
43 use AsposeCellsCloud::Object::TickLabels;
44 use AsposeCellsCloud::Object::Title;
45
46
47 use base ("Class::Accessor", "Class::Data::Inheritable");
48
49
50
51 __PACKAGE__->mk_classdata('attribute_map' => {});
52 __PACKAGE__->mk_classdata('swagger_types' => {});
53 __PACKAGE__->mk_classdata('method_documentation' => {});
54 __PACKAGE__->mk_classdata('class_documentation' => {});
55
56 # new object
57 sub new {
58 my ($class, %args) = @_;
59
60 my $self = bless {}, $class;
61
62 foreach my $attribute (keys %{$class->attribute_map}) {
63 my $args_key = $class->attribute_map->{$attribute};
64 $self->$attribute( $args{ $args_key } );
65 }
66
67 return $self;
68 }
69
70 # return perl hash
71 sub to_hash {
72 return decode_json(JSON->new->convert_blessed->encode( shift ));
73 }
74
75 # used by JSON for serialization
76 sub TO_JSON {
77 my $self = shift;
78 my $_data = {};
79 foreach my $_key (keys %{$self->attribute_map}) {
80 if (defined $self->{$_key}) {
81 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
82 }
83 }
84 return $_data;
85 }
86
87 # from Perl hashref
88 sub from_hash {
89 my ($self, $hash) = @_;
90
91 # loop through attributes and use swagger_types to deserialize the data
92 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
93 my $_json_attribute = $self->attribute_map->{$_key};
94 if ($_type =~ /^array\[/i) { # array
95 my $_subclass = substr($_type, 6, -1);
96 my @_array = ();
97 foreach my $_element (@{$hash->{$_json_attribute}}) {
98 push @_array, $self->_deserialize($_subclass, $_element);
99 }
100 $self->{$_key} = \@_array;
101 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
102 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
103 } else {
104 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
105 }
106 }
107
108 return $self;
109 }
110
111 # deserialize non-array data
112 sub _deserialize {
113 my ($self, $type, $data) = @_;
114 $log->debugf("deserializing %s with %s",Dumper($data), $type);
115
116 if ($type eq 'DateTime') {
117 return DateTime->from_epoch(epoch => str2time($data));
118 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
119 return $data;
120 } else { # hash(model)
121 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
122 return $_instance->from_hash($data);
123 }
124 }
125
126
127 __PACKAGE__->class_documentation({description => 'Encapsulates the object that represents an axis of chart.',
128 class => 'Axis',
129 required => [], # TODO
130 } );
131
132
133 __PACKAGE__->method_documentation({
134 'area' => {
135 datatype => 'Area',
136 base_name => 'Area',
137 description => 'Gets the .',
138 format => '',
139 read_only => '',
140 },
141 'axis_between_categories' => {
142 datatype => 'boolean',
143 base_name => 'AxisBetweenCategories',
144 description => 'Represents if the value axis crosses the category axis between categories.',
145 format => '',
146 read_only => '',
147 },
148 'axis_line' => {
149 datatype => 'Line',
150 base_name => 'AxisLine',
151 description => 'Gets the appearance of an Axis.',
152 format => '',
153 read_only => '',
154 },
155 'base_unit_scale' => {
156 datatype => 'string',
157 base_name => 'BaseUnitScale',
158 description => 'Represents the base unit scale for the category axis.',
159 format => '',
160 read_only => '',
161 },
162 'category_type' => {
163 datatype => 'string',
164 base_name => 'CategoryType',
165 description => 'Represents the category axis type.',
166 format => '',
167 read_only => '',
168 },
169 'cross_at' => {
170 datatype => 'double',
171 base_name => 'CrossAt',
172 description => 'Represents the point on the value axis where the category axis crosses it.',
173 format => '',
174 read_only => '',
175 },
176 'cross_type' => {
177 datatype => 'string',
178 base_name => 'CrossType',
179 description => 'Represents the on the specified axis where the other axis crosses.',
180 format => '',
181 read_only => '',
182 },
183 'display_unit' => {
184 datatype => 'string',
185 base_name => 'DisplayUnit',
186 description => 'Represents the unit label for the specified axis.',
187 format => '',
188 read_only => '',
189 },
190 'display_unit_label' => {
191 datatype => 'DisplayUnitLabel',
192 base_name => 'DisplayUnitLabel',
193 description => 'Represents a unit label on an axis in the specified chart. Unit labels are useful for charting large values— for example, in the millions or billions.',
194 format => '',
195 read_only => '',
196 },
197 'has_multi_level_labels' => {
198 datatype => 'boolean',
199 base_name => 'HasMultiLevelLabels',
200 description => 'Indicates whether the labels shall be shown as multi level.',
201 format => '',
202 read_only => '',
203 },
204 'is_automatic_major_unit' => {
205 datatype => 'boolean',
206 base_name => 'IsAutomaticMajorUnit',
207 description => 'Indicates whether the major unit of the axis is automatically assigned.',
208 format => '',
209 read_only => '',
210 },
211 'is_automatic_max_value' => {
212 datatype => 'boolean',
213 base_name => 'IsAutomaticMaxValue',
214 description => 'Indicates whether the max value is automatically assigned.',
215 format => '',
216 read_only => '',
217 },
218 'is_automatic_minor_unit' => {
219 datatype => 'boolean',
220 base_name => 'IsAutomaticMinorUnit',
221 description => 'Indicates whether the minor unit of the axis is automatically assigned.',
222 format => '',
223 read_only => '',
224 },
225 'is_automatic_min_value' => {
226 datatype => 'boolean',
227 base_name => 'IsAutomaticMinValue',
228 description => 'Indicates whether the min value is automatically assigned.',
229 format => '',
230 read_only => '',
231 },
232 'is_display_unit_label_shown' => {
233 datatype => 'boolean',
234 base_name => 'IsDisplayUnitLabelShown',
235 description => 'Represents if the display unit label is shown on the specified axis.',
236 format => '',
237 read_only => '',
238 },
239 'is_logarithmic' => {
240 datatype => 'boolean',
241 base_name => 'IsLogarithmic',
242 description => 'Represents if the value axis scale type is logarithmic or not.',
243 format => '',
244 read_only => '',
245 },
246 'is_plot_order_reversed' => {
247 datatype => 'boolean',
248 base_name => 'IsPlotOrderReversed',
249 description => 'Represents if Microsoft Excel plots data points from last to first.',
250 format => '',
251 read_only => '',
252 },
253 'is_visible' => {
254 datatype => 'boolean',
255 base_name => 'IsVisible',
256 description => 'Represents if the axis is visible.',
257 format => '',
258 read_only => '',
259 },
260 'log_base' => {
261 datatype => 'double',
262 base_name => 'LogBase',
263 description => 'Represents the logarithmic base. Default value is 10.Only applies for Excel2007.',
264 format => '',
265 read_only => '',
266 },
267 'major_grid_lines' => {
268 datatype => 'Line',
269 base_name => 'MajorGridLines',
270 description => 'Represents major gridlines on a chart axis.',
271 format => '',
272 read_only => '',
273 },
274 'major_tick_mark' => {
275 datatype => 'string',
276 base_name => 'MajorTickMark',
277 description => 'Represents the type of major tick mark for the specified axis.',
278 format => '',
279 read_only => '',
280 },
281 'major_unit' => {
282 datatype => 'double',
283 base_name => 'MajorUnit',
284 description => 'Represents the major units for the axis.',
285 format => '',
286 read_only => '',
287 },
288 'major_unit_scale' => {
289 datatype => 'string',
290 base_name => 'MajorUnitScale',
291 description => 'Represents the major unit scale for the category axis.',
292 format => '',
293 read_only => '',
294 },
295 'max_value' => {
296 datatype => 'double',
297 base_name => 'MaxValue',
298 description => 'Represents the maximum value on the value axis.',
299 format => '',
300 read_only => '',
301 },
302 'minor_grid_lines' => {
303 datatype => 'Line',
304 base_name => 'MinorGridLines',
305 description => 'Represents minor gridlines on a chart axis.',
306 format => '',
307 read_only => '',
308 },
309 'minor_tick_mark' => {
310 datatype => 'string',
311 base_name => 'MinorTickMark',
312 description => 'Represents the type of minor tick mark for the specified axis.',
313 format => '',
314 read_only => '',
315 },
316 'minor_unit' => {
317 datatype => 'double',
318 base_name => 'MinorUnit',
319 description => 'Represents the minor units for the axis.',
320 format => '',
321 read_only => '',
322 },
323 'minor_unit_scale' => {
324 datatype => 'string',
325 base_name => 'MinorUnitScale',
326 description => 'Represents the major unit scale for the category axis.',
327 format => '',
328 read_only => '',
329 },
330 'min_value' => {
331 datatype => 'double',
332 base_name => 'MinValue',
333 description => 'Represents the minimum value on the value axis.',
334 format => '',
335 read_only => '',
336 },
337 'tick_label_position' => {
338 datatype => 'string',
339 base_name => 'TickLabelPosition',
340 description => 'Represents the position of tick-mark labels on the specified axis.',
341 format => '',
342 read_only => '',
343 },
344 'tick_labels' => {
345 datatype => 'TickLabels',
346 base_name => 'TickLabels',
347 description => 'Returns a object that represents the tick-mark labels for the specified axis.',
348 format => '',
349 read_only => '',
350 },
351 'tick_label_spacing' => {
352 datatype => 'int',
353 base_name => 'TickLabelSpacing',
354 description => 'Represents the number of categories or series between tick-mark labels. Applies only to category and series axes.',
355 format => '',
356 read_only => '',
357 },
358 'tick_mark_spacing' => {
359 datatype => 'int',
360 base_name => 'TickMarkSpacing',
361 description => 'Returns or sets the number of categories or series between tick marks. Applies only to category and series axes.',
362 format => '',
363 read_only => '',
364 },
365 'title' => {
366 datatype => 'Title',
367 base_name => 'Title',
368 description => 'Gets the axis` title.',
369 format => '',
370 read_only => '',
371 },
372 'link' => {
373 datatype => 'Link',
374 base_name => 'link',
375 description => '',
376 format => '',
377 read_only => '',
378 },
379 });
380
381 __PACKAGE__->swagger_types( {
382 'area' => 'Area',
383 'axis_between_categories' => 'boolean',
384 'axis_line' => 'Line',
385 'base_unit_scale' => 'string',
386 'category_type' => 'string',
387 'cross_at' => 'double',
388 'cross_type' => 'string',
389 'display_unit' => 'string',
390 'display_unit_label' => 'DisplayUnitLabel',
391 'has_multi_level_labels' => 'boolean',
392 'is_automatic_major_unit' => 'boolean',
393 'is_automatic_max_value' => 'boolean',
394 'is_automatic_minor_unit' => 'boolean',
395 'is_automatic_min_value' => 'boolean',
396 'is_display_unit_label_shown' => 'boolean',
397 'is_logarithmic' => 'boolean',
398 'is_plot_order_reversed' => 'boolean',
399 'is_visible' => 'boolean',
400 'log_base' => 'double',
401 'major_grid_lines' => 'Line',
402 'major_tick_mark' => 'string',
403 'major_unit' => 'double',
404 'major_unit_scale' => 'string',
405 'max_value' => 'double',
406 'minor_grid_lines' => 'Line',
407 'minor_tick_mark' => 'string',
408 'minor_unit' => 'double',
409 'minor_unit_scale' => 'string',
410 'min_value' => 'double',
411 'tick_label_position' => 'string',
412 'tick_labels' => 'TickLabels',
413 'tick_label_spacing' => 'int',
414 'tick_mark_spacing' => 'int',
415 'title' => 'Title',
416 'link' => 'Link'
417 } );
418
419 __PACKAGE__->attribute_map( {
420 'area' => 'Area',
421 'axis_between_categories' => 'AxisBetweenCategories',
422 'axis_line' => 'AxisLine',
423 'base_unit_scale' => 'BaseUnitScale',
424 'category_type' => 'CategoryType',
425 'cross_at' => 'CrossAt',
426 'cross_type' => 'CrossType',
427 'display_unit' => 'DisplayUnit',
428 'display_unit_label' => 'DisplayUnitLabel',
429 'has_multi_level_labels' => 'HasMultiLevelLabels',
430 'is_automatic_major_unit' => 'IsAutomaticMajorUnit',
431 'is_automatic_max_value' => 'IsAutomaticMaxValue',
432 'is_automatic_minor_unit' => 'IsAutomaticMinorUnit',
433 'is_automatic_min_value' => 'IsAutomaticMinValue',
434 'is_display_unit_label_shown' => 'IsDisplayUnitLabelShown',
435 'is_logarithmic' => 'IsLogarithmic',
436 'is_plot_order_reversed' => 'IsPlotOrderReversed',
437 'is_visible' => 'IsVisible',
438 'log_base' => 'LogBase',
439 'major_grid_lines' => 'MajorGridLines',
440 'major_tick_mark' => 'MajorTickMark',
441 'major_unit' => 'MajorUnit',
442 'major_unit_scale' => 'MajorUnitScale',
443 'max_value' => 'MaxValue',
444 'minor_grid_lines' => 'MinorGridLines',
445 'minor_tick_mark' => 'MinorTickMark',
446 'minor_unit' => 'MinorUnit',
447 'minor_unit_scale' => 'MinorUnitScale',
448 'min_value' => 'MinValue',
449 'tick_label_position' => 'TickLabelPosition',
450 'tick_labels' => 'TickLabels',
451 'tick_label_spacing' => 'TickLabelSpacing',
452 'tick_mark_spacing' => 'TickMarkSpacing',
453 'title' => 'Title',
454 'link' => 'link'
455 } );
456
457 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
458
459
460 1;