Object/Trendline.pm untested

filter: Statementstmt 0.0% 0 / 105 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 22 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 142 CC 6 SCAR 15.1
CC
6
Cov
0%
from_hash
12.0
_deserialize
12.0
TO_JSON
6.0
CRAP 4.5
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::Trendline;
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::Color;
39 use AsposeCellsCloud::Object::DataLabels;
40 use AsposeCellsCloud::Object::GradientFill;
41 use AsposeCellsCloud::Object::LegendEntry;
42 use AsposeCellsCloud::Object::Line;
43 use AsposeCellsCloud::Object::Link;
44
45
46 use base ("Class::Accessor", "Class::Data::Inheritable");
47
48
49
50 __PACKAGE__->mk_classdata('attribute_map' => {});
51 __PACKAGE__->mk_classdata('swagger_types' => {});
52 __PACKAGE__->mk_classdata('method_documentation' => {});
53 __PACKAGE__->mk_classdata('class_documentation' => {});
54
55 # new object
56 sub new {
57 my ($class, %args) = @_;
58
59 my $self = bless {}, $class;
60
61 foreach my $attribute (keys %{$class->attribute_map}) {
62 my $args_key = $class->attribute_map->{$attribute};
63 $self->$attribute( $args{ $args_key } );
64 }
65
66 return $self;
67 }
68
69 # return perl hash
70 sub to_hash {
71 return decode_json(JSON->new->convert_blessed->encode( shift ));
72 }
73
74 # used by JSON for serialization
75 sub TO_JSON {
76 my $self = shift;
77 my $_data = {};
78 foreach my $_key (keys %{$self->attribute_map}) {
79 if (defined $self->{$_key}) {
80 $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
81 }
82 }
83 return $_data;
84 }
85
86 # from Perl hashref
87 sub from_hash {
88 my ($self, $hash) = @_;
89
90 # loop through attributes and use swagger_types to deserialize the data
91 while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
92 my $_json_attribute = $self->attribute_map->{$_key};
93 if ($_type =~ /^array\[/i) { # array
94 my $_subclass = substr($_type, 6, -1);
95 my @_array = ();
96 foreach my $_element (@{$hash->{$_json_attribute}}) {
97 push @_array, $self->_deserialize($_subclass, $_element);
98 }
99 $self->{$_key} = \@_array;
100 } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
101 $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
102 } else {
103 $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
104 }
105 }
106
107 return $self;
108 }
109
110 # deserialize non-array data
111 sub _deserialize {
112 my ($self, $type, $data) = @_;
113 $log->debugf("deserializing %s with %s",Dumper($data), $type);
114
115 if ($type eq 'DateTime') {
116 return DateTime->from_epoch(epoch => str2time($data));
117 } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
118 return $data;
119 } else { # hash(model)
120 my $_instance = eval "AsposeCellsCloud::Object::$type->new()";
121 return $_instance->from_hash($data);
122 }
123 }
124
125
126 __PACKAGE__->class_documentation({description => 'Represents a trendline in a chart.',
127 class => 'Trendline',
128 required => [], # TODO
129 } );
130
131
132 __PACKAGE__->method_documentation({
133 'link' => {
134 datatype => 'Link',
135 base_name => 'link',
136 description => 'The class has a property named "link" of type "Link" that can be accessed and modified.',
137 format => '',
138 read_only => '',
139 },
140 'backward' => {
141 datatype => 'double',
142 base_name => 'Backward',
143 description => 'Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. The number of periods must be greater than or equal to zero. If the chart type is column ,the number of periods must be between 0 and 0.5',
144 format => '',
145 read_only => '',
146 },
147 'data_labels' => {
148 datatype => 'DataLabels',
149 base_name => 'DataLabels',
150 description => 'Represents the DataLabels object for the specified series.',
151 format => '',
152 read_only => '',
153 },
154 'display_equation' => {
155 datatype => 'boolean',
156 base_name => 'DisplayEquation',
157 description => 'Represents if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Setting this property to True automatically turns on data labels.',
158 format => '',
159 read_only => '',
160 },
161 'display_r_squared' => {
162 datatype => 'boolean',
163 base_name => 'DisplayRSquared',
164 description => 'Represents if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Setting this property to True automatically turns on data labels.',
165 format => '',
166 read_only => '',
167 },
168 'forward' => {
169 datatype => 'double',
170 base_name => 'Forward',
171 description => 'Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. The number of periods must be greater than or equal to zero.',
172 format => '',
173 read_only => '',
174 },
175 'intercept' => {
176 datatype => 'double',
177 base_name => 'Intercept',
178 description => 'Returns or sets the point where the trendline crosses the value axis.',
179 format => '',
180 read_only => '',
181 },
182 'is_name_auto' => {
183 datatype => 'boolean',
184 base_name => 'IsNameAuto',
185 description => 'Returns if Microsoft Excel automatically determines the name of the trendline.',
186 format => '',
187 read_only => '',
188 },
189 'legend_entry' => {
190 datatype => 'LegendEntry',
191 base_name => 'LegendEntry',
192 description => 'Gets the legend entry according to this trendline',
193 format => '',
194 read_only => '',
195 },
196 'name' => {
197 datatype => 'string',
198 base_name => 'Name',
199 description => 'Returns the name of the trendline.',
200 format => '',
201 read_only => '',
202 },
203 'order' => {
204 datatype => 'int',
205 base_name => 'Order',
206 description => 'Returns or sets the trendline order (an integer greater than 1) when the trendline type is Polynomial. The order must be between 2 and 6.',
207 format => '',
208 read_only => '',
209 },
210 'period' => {
211 datatype => 'int',
212 base_name => 'Period',
213 description => 'Returns or sets the period for the moving-average trendline.',
214 format => '',
215 read_only => '',
216 },
217 'type' => {
218 datatype => 'string',
219 base_name => 'Type',
220 description => 'Returns the trendline type.',
221 format => '',
222 read_only => '',
223 },
224 'begin_arrow_length' => {
225 datatype => 'string',
226 base_name => 'BeginArrowLength',
227 description => '',
228 format => '',
229 read_only => '',
230 },
231 'begin_arrow_width' => {
232 datatype => 'string',
233 base_name => 'BeginArrowWidth',
234 description => '',
235 format => '',
236 read_only => '',
237 },
238 'begin_type' => {
239 datatype => 'string',
240 base_name => 'BeginType',
241 description => '',
242 format => '',
243 read_only => '',
244 },
245 'cap_type' => {
246 datatype => 'string',
247 base_name => 'CapType',
248 description => '',
249 format => '',
250 read_only => '',
251 },
252 'color' => {
253 datatype => 'Color',
254 base_name => 'Color',
255 description => '',
256 format => '',
257 read_only => '',
258 },
259 'compound_type' => {
260 datatype => 'string',
261 base_name => 'CompoundType',
262 description => '',
263 format => '',
264 read_only => '',
265 },
266 'dash_type' => {
267 datatype => 'string',
268 base_name => 'DashType',
269 description => '',
270 format => '',
271 read_only => '',
272 },
273 'end_arrow_length' => {
274 datatype => 'string',
275 base_name => 'EndArrowLength',
276 description => '',
277 format => '',
278 read_only => '',
279 },
280 'end_arrow_width' => {
281 datatype => 'string',
282 base_name => 'EndArrowWidth',
283 description => '',
284 format => '',
285 read_only => '',
286 },
287 'end_type' => {
288 datatype => 'string',
289 base_name => 'EndType',
290 description => '',
291 format => '',
292 read_only => '',
293 },
294 'gradient_fill' => {
295 datatype => 'GradientFill',
296 base_name => 'GradientFill',
297 description => '',
298 format => '',
299 read_only => '',
300 },
301 'is_auto' => {
302 datatype => 'boolean',
303 base_name => 'IsAuto',
304 description => '',
305 format => '',
306 read_only => '',
307 },
308 'is_automatic_color' => {
309 datatype => 'boolean',
310 base_name => 'IsAutomaticColor',
311 description => '',
312 format => '',
313 read_only => '',
314 },
315 'is_visible' => {
316 datatype => 'boolean',
317 base_name => 'IsVisible',
318 description => '',
319 format => '',
320 read_only => '',
321 },
322 'join_type' => {
323 datatype => 'string',
324 base_name => 'JoinType',
325 description => '',
326 format => '',
327 read_only => '',
328 },
329 'style' => {
330 datatype => 'string',
331 base_name => 'Style',
332 description => '',
333 format => '',
334 read_only => '',
335 },
336 'transparency' => {
337 datatype => 'double',
338 base_name => 'Transparency',
339 description => '',
340 format => '',
341 read_only => '',
342 },
343 'weight' => {
344 datatype => 'string',
345 base_name => 'Weight',
346 description => '',
347 format => '',
348 read_only => '',
349 },
350 'weight_pt' => {
351 datatype => 'double',
352 base_name => 'WeightPt',
353 description => '',
354 format => '',
355 read_only => '',
356 },
357 });
358
359 __PACKAGE__->swagger_types( {
360 'link' => 'Link',
361 'backward' => 'double',
362 'data_labels' => 'DataLabels',
363 'display_equation' => 'boolean',
364 'display_r_squared' => 'boolean',
365 'forward' => 'double',
366 'intercept' => 'double',
367 'is_name_auto' => 'boolean',
368 'legend_entry' => 'LegendEntry',
369 'name' => 'string',
370 'order' => 'int',
371 'period' => 'int',
372 'type' => 'string',
373 'begin_arrow_length' => 'string',
374 'begin_arrow_width' => 'string',
375 'begin_type' => 'string',
376 'cap_type' => 'string',
377 'color' => 'Color',
378 'compound_type' => 'string',
379 'dash_type' => 'string',
380 'end_arrow_length' => 'string',
381 'end_arrow_width' => 'string',
382 'end_type' => 'string',
383 'gradient_fill' => 'GradientFill',
384 'is_auto' => 'boolean',
385 'is_automatic_color' => 'boolean',
386 'is_visible' => 'boolean',
387 'join_type' => 'string',
388 'style' => 'string',
389 'transparency' => 'double',
390 'weight' => 'string',
391 'weight_pt' => 'double'
392 } );
393
394 __PACKAGE__->attribute_map( {
395 'link' => 'link',
396 'backward' => 'Backward',
397 'data_labels' => 'DataLabels',
398 'display_equation' => 'DisplayEquation',
399 'display_r_squared' => 'DisplayRSquared',
400 'forward' => 'Forward',
401 'intercept' => 'Intercept',
402 'is_name_auto' => 'IsNameAuto',
403 'legend_entry' => 'LegendEntry',
404 'name' => 'Name',
405 'order' => 'Order',
406 'period' => 'Period',
407 'type' => 'Type',
408 'begin_arrow_length' => 'BeginArrowLength',
409 'begin_arrow_width' => 'BeginArrowWidth',
410 'begin_type' => 'BeginType',
411 'cap_type' => 'CapType',
412 'color' => 'Color',
413 'compound_type' => 'CompoundType',
414 'dash_type' => 'DashType',
415 'end_arrow_length' => 'EndArrowLength',
416 'end_arrow_width' => 'EndArrowWidth',
417 'end_type' => 'EndType',
418 'gradient_fill' => 'GradientFill',
419 'is_auto' => 'IsAuto',
420 'is_automatic_color' => 'IsAutomaticColor',
421 'is_visible' => 'IsVisible',
422 'join_type' => 'JoinType',
423 'style' => 'Style',
424 'transparency' => 'Transparency',
425 'weight' => 'Weight',
426 'weight_pt' => 'WeightPt'
427 } );
428
429 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
430
431
432 1;