| 1 | package Chart::Plotly::Trace::Carpet::Baxis; | ||
| 2 | use Moose; | ||
| 3 | use MooseX::ExtraArgs; | ||
| 4 | use Moose::Util::TypeConstraints qw(enum union); | ||
| 5 | if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) { | ||
| 6 | Moose::Util::TypeConstraints::type('PDL'); | ||
| 7 | } | ||
| 8 | |||
| 9 | use Chart::Plotly::Trace::Carpet::Baxis::Tickfont; | ||
| 10 | use Chart::Plotly::Trace::Carpet::Baxis::Tickformatstop; | ||
| 11 | use Chart::Plotly::Trace::Carpet::Baxis::Title; | ||
| 12 | |||
| 13 | our $VERSION = '0.042'; # VERSION | ||
| 14 | |||
| 15 | # ABSTRACT: This attribute is one of the possible options for the trace carpet. | ||
| 16 | |||
| 17 | sub TO_JSON { | ||
| 18 | my $self = shift; | ||
| 19 | my $extra_args = $self->extra_args // {}; | ||
| 20 | my $meta = $self->meta; | ||
| 21 | my %hash = %$self; | ||
| 22 | for my $name ( sort keys %hash ) { | ||
| 23 | my $attr = $meta->get_attribute($name); | ||
| 24 | if ( defined $attr ) { | ||
| 25 | my $value = $hash{$name}; | ||
| 26 | my $type = $attr->type_constraint; | ||
| 27 | if ( $type && $type->equals('Bool') ) { | ||
| 28 | $hash{$name} = $value ? \1 : \0; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | } | ||
| 32 | %hash = ( %hash, %$extra_args ); | ||
| 33 | delete $hash{'extra_args'}; | ||
| 34 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 35 | $hash{type} = $self->type(); | ||
| 36 | } | ||
| 37 | return \%hash; | ||
| 38 | } | ||
| 39 | |||
| 40 | has arraydtick => ( is => "rw", | ||
| 41 | isa => "Int", | ||
| 42 | documentation => "The stride between grid lines along the axis", | ||
| 43 | ); | ||
| 44 | |||
| 45 | has arraytick0 => ( is => "rw", | ||
| 46 | isa => "Int", | ||
| 47 | documentation => "The starting index of grid lines along the axis", | ||
| 48 | ); | ||
| 49 | |||
| 50 | has autorange => ( | ||
| 51 | is => "rw", | ||
| 52 | documentation => | ||
| 53 | "Determines whether or not the range of this axis is computed in relation to the input data. See `rangemode` for more info. If `range` is provided, then `autorange` is set to *false*.", | ||
| 54 | ); | ||
| 55 | |||
| 56 | has autotypenumbers => ( | ||
| 57 | is => "rw", | ||
| 58 | isa => enum( [ "convert types", "strict" ] ), | ||
| 59 | documentation => | ||
| 60 | "Using *strict* a numeric string in trace data is not converted to a number. Using *convert types* a numeric string in trace data may be treated as a number during automatic axis `type` detection. Defaults to layout.autotypenumbers.", | ||
| 61 | ); | ||
| 62 | |||
| 63 | has categoryarray => ( | ||
| 64 | is => "rw", | ||
| 65 | isa => "ArrayRef|PDL", | ||
| 66 | documentation => | ||
| 67 | "Sets the order in which categories on this axis appear. Only has an effect if `categoryorder` is set to *array*. Used with `categoryorder`.", | ||
| 68 | ); | ||
| 69 | |||
| 70 | has categoryarraysrc => ( is => "rw", | ||
| 71 | isa => "Str", | ||
| 72 | documentation => "Sets the source reference on Chart Studio Cloud for `categoryarray`.", | ||
| 73 | ); | ||
| 74 | |||
| 75 | has categoryorder => ( | ||
| 76 | is => "rw", | ||
| 77 | isa => enum( [ "trace", "category ascending", "category descending", "array" ] ), | ||
| 78 | documentation => | ||
| 79 | "Specifies the ordering logic for the case of categorical variables. By default, plotly uses *trace*, which specifies the order that is present in the data supplied. Set `categoryorder` to *category ascending* or *category descending* if order should be determined by the alphanumerical order of the category names. Set `categoryorder` to *array* to derive the ordering from the attribute `categoryarray`. If a category is not found in the `categoryarray` array, the sorting behavior for that attribute will be identical to the *trace* mode. The unspecified categories will follow the categories in `categoryarray`.", | ||
| 80 | ); | ||
| 81 | |||
| 82 | has cheatertype => ( is => "rw", | ||
| 83 | isa => enum( [ "index", "value" ] ), ); | ||
| 84 | |||
| 85 | has color => ( | ||
| 86 | is => "rw", | ||
| 87 | isa => "Str", | ||
| 88 | documentation => | ||
| 89 | "Sets default for all colors associated with this axis all at once: line, font, tick, and grid colors. Grid color is lightened by blending this with the plot background Individual pieces can override this.", | ||
| 90 | ); | ||
| 91 | |||
| 92 | has dtick => ( is => "rw", | ||
| 93 | isa => "Num", | ||
| 94 | documentation => "The stride between grid lines along the axis", | ||
| 95 | ); | ||
| 96 | |||
| 97 | has endline => ( | ||
| 98 | is => "rw", | ||
| 99 | isa => "Bool", | ||
| 100 | documentation => | ||
| 101 | "Determines whether or not a line is drawn at along the final value of this axis. If *true*, the end line is drawn on top of the grid lines.", | ||
| 102 | ); | ||
| 103 | |||
| 104 | has endlinecolor => ( is => "rw", | ||
| 105 | isa => "Str", | ||
| 106 | documentation => "Sets the line color of the end line.", | ||
| 107 | ); | ||
| 108 | |||
| 109 | has endlinewidth => ( is => "rw", | ||
| 110 | isa => "Num", | ||
| 111 | documentation => "Sets the width (in px) of the end line.", | ||
| 112 | ); | ||
| 113 | |||
| 114 | has exponentformat => ( | ||
| 115 | is => "rw", | ||
| 116 | isa => enum( [ "none", "e", "E", "power", "SI", "B" ] ), | ||
| 117 | documentation => | ||
| 118 | "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B.", | ||
| 119 | ); | ||
| 120 | |||
| 121 | has fixedrange => (is => "rw", | ||
| 122 | isa => "Bool", | ||
| 123 | documentation => "Determines whether or not this axis is zoom-able. If true, then zoom is disabled.", | ||
| 124 | ); | ||
| 125 | |||
| 126 | has gridcolor => ( is => "rw", | ||
| 127 | isa => "Str", | ||
| 128 | documentation => "Sets the axis line color.", | ||
| 129 | ); | ||
| 130 | |||
| 131 | has griddash => ( | ||
| 132 | is => "rw", | ||
| 133 | isa => "Str", | ||
| 134 | documentation => | ||
| 135 | "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*).", | ||
| 136 | ); | ||
| 137 | |||
| 138 | has gridwidth => ( is => "rw", | ||
| 139 | isa => "Num", | ||
| 140 | documentation => "Sets the width (in px) of the axis line.", | ||
| 141 | ); | ||
| 142 | |||
| 143 | has labelpadding => ( is => "rw", | ||
| 144 | isa => "Int", | ||
| 145 | documentation => "Extra padding between label and the axis", | ||
| 146 | ); | ||
| 147 | |||
| 148 | has labelprefix => ( is => "rw", | ||
| 149 | isa => "Str", | ||
| 150 | documentation => "Sets a axis label prefix.", | ||
| 151 | ); | ||
| 152 | |||
| 153 | has labelsuffix => ( is => "rw", | ||
| 154 | isa => "Str", | ||
| 155 | documentation => "Sets a axis label suffix.", | ||
| 156 | ); | ||
| 157 | |||
| 158 | has linecolor => ( is => "rw", | ||
| 159 | isa => "Str", | ||
| 160 | documentation => "Sets the axis line color.", | ||
| 161 | ); | ||
| 162 | |||
| 163 | has linewidth => ( is => "rw", | ||
| 164 | isa => "Num", | ||
| 165 | documentation => "Sets the width (in px) of the axis line.", | ||
| 166 | ); | ||
| 167 | |||
| 168 | has minexponent => ( is => "rw", | ||
| 169 | isa => "Num", | ||
| 170 | documentation => "Hide SI prefix for 10^n if |n| is below this number", | ||
| 171 | ); | ||
| 172 | |||
| 173 | has minorgridcolor => ( is => "rw", | ||
| 174 | isa => "Str", | ||
| 175 | documentation => "Sets the color of the grid lines.", | ||
| 176 | ); | ||
| 177 | |||
| 178 | has minorgridcount => ( is => "rw", | ||
| 179 | isa => "Int", | ||
| 180 | documentation => "Sets the number of minor grid ticks per major grid tick", | ||
| 181 | ); | ||
| 182 | |||
| 183 | has minorgriddash => ( | ||
| 184 | is => "rw", | ||
| 185 | isa => "Str", | ||
| 186 | documentation => | ||
| 187 | "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*).", | ||
| 188 | ); | ||
| 189 | |||
| 190 | has minorgridwidth => ( is => "rw", | ||
| 191 | isa => "Num", | ||
| 192 | documentation => "Sets the width (in px) of the grid lines.", | ||
| 193 | ); | ||
| 194 | |||
| 195 | has nticks => ( | ||
| 196 | is => "rw", | ||
| 197 | isa => "Int", | ||
| 198 | documentation => | ||
| 199 | "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.", | ||
| 200 | ); | ||
| 201 | |||
| 202 | has range => ( | ||
| 203 | is => "rw", | ||
| 204 | isa => "ArrayRef|PDL", | ||
| 205 | documentation => | ||
| 206 | "Sets the range of this axis. If the axis `type` is *log*, then you must take the log of your desired range (e.g. to set the range from 1 to 100, set the range from 0 to 2). If the axis `type` is *date*, it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis `type` is *category*, it should be numbers, using the scale where each category is assigned a serial number from zero in the order it appears.", | ||
| 207 | ); | ||
| 208 | |||
| 209 | has rangemode => ( | ||
| 210 | is => "rw", | ||
| 211 | isa => enum( [ "normal", "tozero", "nonnegative" ] ), | ||
| 212 | documentation => | ||
| 213 | "If *normal*, the range is computed in relation to the extrema of the input data. If *tozero*`, the range extends to 0, regardless of the input data If *nonnegative*, the range is non-negative, regardless of the input data.", | ||
| 214 | ); | ||
| 215 | |||
| 216 | has separatethousands => ( is => "rw", | ||
| 217 | isa => "Bool", | ||
| 218 | documentation => "If \"true\", even 4-digit integers are separated", | ||
| 219 | ); | ||
| 220 | |||
| 221 | has showexponent => ( | ||
| 222 | is => "rw", | ||
| 223 | isa => enum( [ "all", "first", "last", "none" ] ), | ||
| 224 | documentation => | ||
| 225 | "If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.", | ||
| 226 | ); | ||
| 227 | |||
| 228 | has showgrid => ( | ||
| 229 | is => "rw", | ||
| 230 | isa => "Bool", | ||
| 231 | documentation => | ||
| 232 | "Determines whether or not grid lines are drawn. If *true*, the grid lines are drawn at every tick mark.", | ||
| 233 | ); | ||
| 234 | |||
| 235 | has showline => ( is => "rw", | ||
| 236 | isa => "Bool", | ||
| 237 | documentation => "Determines whether or not a line bounding this axis is drawn.", | ||
| 238 | ); | ||
| 239 | |||
| 240 | has showticklabels => ( | ||
| 241 | is => "rw", | ||
| 242 | isa => enum( [ "start", "end", "both", "none" ] ), | ||
| 243 | documentation => | ||
| 244 | "Determines whether axis labels are drawn on the low side, the high side, both, or neither side of the axis.", | ||
| 245 | ); | ||
| 246 | |||
| 247 | has showtickprefix => ( | ||
| 248 | is => "rw", | ||
| 249 | isa => enum( [ "all", "first", "last", "none" ] ), | ||
| 250 | documentation => | ||
| 251 | "If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.", | ||
| 252 | ); | ||
| 253 | |||
| 254 | has showticksuffix => ( is => "rw", | ||
| 255 | isa => enum( [ "all", "first", "last", "none" ] ), | ||
| 256 | documentation => "Same as `showtickprefix` but for tick suffixes.", | ||
| 257 | ); | ||
| 258 | |||
| 259 | has smoothing => ( is => "rw", | ||
| 260 | isa => "Num", ); | ||
| 261 | |||
| 262 | has startline => ( | ||
| 263 | is => "rw", | ||
| 264 | isa => "Bool", | ||
| 265 | documentation => | ||
| 266 | "Determines whether or not a line is drawn at along the starting value of this axis. If *true*, the start line is drawn on top of the grid lines.", | ||
| 267 | ); | ||
| 268 | |||
| 269 | has startlinecolor => ( is => "rw", | ||
| 270 | isa => "Str", | ||
| 271 | documentation => "Sets the line color of the start line.", | ||
| 272 | ); | ||
| 273 | |||
| 274 | has startlinewidth => ( is => "rw", | ||
| 275 | isa => "Num", | ||
| 276 | documentation => "Sets the width (in px) of the start line.", | ||
| 277 | ); | ||
| 278 | |||
| 279 | has tick0 => ( is => "rw", | ||
| 280 | isa => "Num", | ||
| 281 | documentation => "The starting index of grid lines along the axis", | ||
| 282 | ); | ||
| 283 | |||
| 284 | has tickangle => ( | ||
| 285 | is => "rw", | ||
| 286 | documentation => | ||
| 287 | "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.", | ||
| 288 | ); | ||
| 289 | |||
| 290 | has tickfont => ( is => "rw", | ||
| 291 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Baxis::Tickfont", ); | ||
| 292 | |||
| 293 | has tickformat => ( | ||
| 294 | is => "rw", | ||
| 295 | isa => "Str", | ||
| 296 | documentation => | ||
| 297 | "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: *%h* for half of the year as a decimal number as well as *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*", | ||
| 298 | ); | ||
| 299 | |||
| 300 | has tickformatstops => ( is => "rw", | ||
| 301 | isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Carpet::Baxis::Tickformatstop]", ); | ||
| 302 | |||
| 303 | has tickmode => ( is => "rw", | ||
| 304 | isa => enum( [ "linear", "array" ] ), ); | ||
| 305 | |||
| 306 | has tickprefix => ( is => "rw", | ||
| 307 | isa => "Str", | ||
| 308 | documentation => "Sets a tick label prefix.", | ||
| 309 | ); | ||
| 310 | |||
| 311 | has ticksuffix => ( is => "rw", | ||
| 312 | isa => "Str", | ||
| 313 | documentation => "Sets a tick label suffix.", | ||
| 314 | ); | ||
| 315 | |||
| 316 | has ticktext => ( | ||
| 317 | is => "rw", | ||
| 318 | isa => "ArrayRef|PDL", | ||
| 319 | documentation => | ||
| 320 | "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.", | ||
| 321 | ); | ||
| 322 | |||
| 323 | has ticktextsrc => ( is => "rw", | ||
| 324 | isa => "Str", | ||
| 325 | documentation => "Sets the source reference on Chart Studio Cloud for `ticktext`.", | ||
| 326 | ); | ||
| 327 | |||
| 328 | has tickvals => ( | ||
| 329 | is => "rw", | ||
| 330 | isa => "ArrayRef|PDL", | ||
| 331 | documentation => | ||
| 332 | "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.", | ||
| 333 | ); | ||
| 334 | |||
| 335 | has tickvalssrc => ( is => "rw", | ||
| 336 | isa => "Str", | ||
| 337 | documentation => "Sets the source reference on Chart Studio Cloud for `tickvals`.", | ||
| 338 | ); | ||
| 339 | |||
| 340 | has title => ( is => "rw", | ||
| 341 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Baxis::Title", ); | ||
| 342 | |||
| 343 | __PACKAGE__->meta->make_immutable(); | ||
| 344 | 1; | ||
| 345 | |||
| 346 | __END__ |