Object/ChartPoint.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::ChartPoint;
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::DataLabels;
40 use AsposeCellsCloud::Object::Line;
41 use AsposeCellsCloud::Object::Link;
42 use AsposeCellsCloud::Object::LinkElement;
43 use AsposeCellsCloud::Object::Marker;
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 single point in a series in a chart.',
127 class => 'ChartPoint',
128 required => [], # TODO
129 } );
130
131
132 __PACKAGE__->method_documentation({
133 'area' => {
134 datatype => 'Area',
135 base_name => 'Area',
136 description => 'Gets the area.',
137 format => '',
138 read_only => '',
139 },
140 'border' => {
141 datatype => 'Line',
142 base_name => 'Border',
143 description => 'Gets the border.',
144 format => '',
145 read_only => '',
146 },
147 'data_labels' => {
148 datatype => 'DataLabels',
149 base_name => 'DataLabels',
150 description => 'Returns a DataLabels object that represents the data label associated with the point.',
151 format => '',
152 read_only => '',
153 },
154 'explosion' => {
155 datatype => 'int',
156 base_name => 'Explosion',
157 description => 'The distance of an open pie slice from the center of the pie chart is expressed as a percentage of the pie diameter.',
158 format => '',
159 read_only => '',
160 },
161 'marker' => {
162 datatype => 'Marker',
163 base_name => 'Marker',
164 description => 'Gets the marker.',
165 format => '',
166 read_only => '',
167 },
168 'shadow' => {
169 datatype => 'boolean',
170 base_name => 'Shadow',
171 description => 'True if the chartpoint has a shadow.',
172 format => '',
173 read_only => '',
174 },
175 'x_value' => {
176 datatype => 'string',
177 base_name => 'XValue',
178 description => 'Gets or sets the X value of the chart point.',
179 format => '',
180 read_only => '',
181 },
182 'y_value' => {
183 datatype => 'string',
184 base_name => 'YValue',
185 description => 'Gets or sets the Y value of the chart point.',
186 format => '',
187 read_only => '',
188 },
189 'is_in_secondary_plot' => {
190 datatype => 'boolean',
191 base_name => 'IsInSecondaryPlot',
192 description => 'Gets or sets a value indicates whether this data points is in the second pie or bar on a pie of pie or bar of pie chart.',
193 format => '',
194 read_only => '',
195 },
196 'link' => {
197 datatype => 'Link',
198 base_name => 'link',
199 description => '',
200 format => '',
201 read_only => '',
202 },
203 });
204
205 __PACKAGE__->swagger_types( {
206 'area' => 'Area',
207 'border' => 'Line',
208 'data_labels' => 'DataLabels',
209 'explosion' => 'int',
210 'marker' => 'Marker',
211 'shadow' => 'boolean',
212 'x_value' => 'string',
213 'y_value' => 'string',
214 'is_in_secondary_plot' => 'boolean',
215 'link' => 'Link'
216 } );
217
218 __PACKAGE__->attribute_map( {
219 'area' => 'Area',
220 'border' => 'Border',
221 'data_labels' => 'DataLabels',
222 'explosion' => 'Explosion',
223 'marker' => 'Marker',
224 'shadow' => 'Shadow',
225 'x_value' => 'XValue',
226 'y_value' => 'YValue',
227 'is_in_secondary_plot' => 'IsInSecondaryPlot',
228 'link' => 'link'
229 } );
230
231 __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
232
233
234 1;