1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
#[allow(unused_imports)]
use serde::Serialize;

/// The ohlc (short for Open-High-Low-Close) is a style of financial chart describing open, high, low and close for a given `x` coordinate (most likely time). The tip of the lines represent the `low` and `high` values and the horizontal segments represent the `open` and `close` values. Sample points where the close value is higher (lower) then the open value are called increasing (decreasing). By default, increasing items are drawn in green whereas decreasing are drawn in red.
#[derive(Default, Serialize)]
pub struct Ohlc<'a> {
    #[serde(rename = "visible")]
    #[serde(skip_serializing_if = "Option::is_none")]
    visible: Option<Visible>,
    #[serde(rename = "showlegend")]
    #[serde(skip_serializing_if = "Option::is_none")]
    showlegend: Option<bool>,
    #[serde(rename = "legendgroup")]
    #[serde(skip_serializing_if = "Option::is_none")]
    legendgroup: Option<&'a str>,
    #[serde(rename = "opacity")]
    #[serde(skip_serializing_if = "Option::is_none")]
    opacity: Option<f64>,
    #[serde(rename = "name")]
    #[serde(skip_serializing_if = "Option::is_none")]
    name: Option<&'a str>,
    #[serde(rename = "uid")]
    #[serde(skip_serializing_if = "Option::is_none")]
    uid: Option<&'a str>,
    #[serde(rename = "ids")]
    #[serde(skip_serializing_if = "Option::is_none")]
    ids: Option<&'a [&'a str]>,
    #[serde(rename = "meta")]
    #[serde(skip_serializing_if = "Option::is_none")]
    meta: Option<crate::Any>,
    #[serde(rename = "selectedpoints")]
    #[serde(skip_serializing_if = "Option::is_none")]
    selectedpoints: Option<crate::Any>,
    #[serde(rename = "hoverinfo")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    hoverinfo: crate::IsEmpty<Hoverinfo>,
    #[serde(rename = "stream")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    stream: crate::IsEmpty<Stream<'a>>,
    #[serde(rename = "uirevision")]
    #[serde(skip_serializing_if = "Option::is_none")]
    uirevision: Option<crate::Any>,
    #[serde(rename = "x")]
    #[serde(skip_serializing_if = "Option::is_none")]
    x: Option<&'a [f64]>,
    #[serde(rename = "open")]
    #[serde(skip_serializing_if = "Option::is_none")]
    open: Option<&'a [f64]>,
    #[serde(rename = "high")]
    #[serde(skip_serializing_if = "Option::is_none")]
    high: Option<&'a [f64]>,
    #[serde(rename = "low")]
    #[serde(skip_serializing_if = "Option::is_none")]
    low: Option<&'a [f64]>,
    #[serde(rename = "close")]
    #[serde(skip_serializing_if = "Option::is_none")]
    close: Option<&'a [f64]>,
    #[serde(rename = "line")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    line: crate::IsEmpty<Line<'a>>,
    #[serde(rename = "increasing")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    increasing: crate::IsEmpty<Increasing<'a>>,
    #[serde(rename = "decreasing")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    decreasing: crate::IsEmpty<Decreasing<'a>>,
    #[serde(rename = "text")]
    #[serde(skip_serializing_if = "Option::is_none")]
    text: Option<&'a str>,
    #[serde(rename = "hovertext")]
    #[serde(skip_serializing_if = "Option::is_none")]
    hovertext: Option<&'a str>,
    #[serde(rename = "tickwidth")]
    #[serde(skip_serializing_if = "Option::is_none")]
    tickwidth: Option<f64>,
    #[serde(rename = "hoverlabel")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    hoverlabel: crate::IsEmpty<Hoverlabel<'a>>,
    #[serde(rename = "xcalendar")]
    #[serde(skip_serializing_if = "Option::is_none")]
    xcalendar: Option<Xcalendar>,
    #[serde(rename = "xaxis")]
    #[serde(skip_serializing_if = "Option::is_none")]
    xaxis: Option<&'a str>,
    #[serde(rename = "yaxis")]
    #[serde(skip_serializing_if = "Option::is_none")]
    yaxis: Option<&'a str>,
    #[serde(rename = "idssrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    idssrc: Option<&'a str>,
    #[serde(rename = "customdatasrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    customdatasrc: Option<&'a str>,
    #[serde(rename = "metasrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    metasrc: Option<&'a str>,
    #[serde(rename = "hoverinfosrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    hoverinfosrc: Option<&'a str>,
    #[serde(rename = "xsrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    xsrc: Option<&'a str>,
    #[serde(rename = "opensrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    opensrc: Option<&'a str>,
    #[serde(rename = "highsrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    highsrc: Option<&'a str>,
    #[serde(rename = "lowsrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    lowsrc: Option<&'a str>,
    #[serde(rename = "closesrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    closesrc: Option<&'a str>,
    #[serde(rename = "textsrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    textsrc: Option<&'a str>,
    #[serde(rename = "hovertextsrc")]
    #[serde(skip_serializing_if = "Option::is_none")]
    hovertextsrc: Option<&'a str>,
}

impl<'a> Ohlc<'a> {
    /// Determines whether or not this trace is visible. If *legendonly*, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).
    ///
    /// default: `true`
    pub fn visible(&mut self, visible: Visible) -> &mut Self {
        self.visible = Some(visible);
        self
    }
    /// Determines whether or not an item corresponding to this trace is shown in the legend.
    ///
    /// default: `true`
    pub fn showlegend(&mut self, showlegend: bool) -> &mut Self {
        self.showlegend = Some(showlegend);
        self
    }
    /// Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.
    ///
    /// default: ``
    pub fn legendgroup(&mut self, legendgroup: &'a str) -> &mut Self {
        self.legendgroup = Some(legendgroup);
        self
    }
    /// Sets the opacity of the trace.
    ///
    /// default: `1`
    pub fn opacity(&mut self, opacity: f64) -> &mut Self {
        self.opacity = Some(opacity);
        self
    }
    /// Sets the trace name. The trace name appear as the legend item and on hover.
    ///
    pub fn name(&mut self, name: &'a str) -> &mut Self {
        self.name = Some(name);
        self
    }
    /// Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
    ///
    pub fn uid(&mut self, uid: &'a str) -> &mut Self {
        self.uid = Some(uid);
        self
    }
    /// Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.
    ///
    pub fn ids(&mut self, ids: &'a [&'a str]) -> &mut Self {
        self.ids = Some(ids);
        self
    }
    /// Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.
    ///
    pub fn meta(&mut self, meta: crate::Any) -> &mut Self {
        self.meta = Some(meta);
        self
    }
    /// Array containing integer indices of selected points. Has an effect only for traces that support selections. Note that an empty array means an empty selection where the `unselected` are turned on for all points, whereas, any other non-array values means no selection all where the `selected` and `unselected` styles have no effect.
    ///
    pub fn selectedpoints(&mut self, selectedpoints: crate::Any) -> &mut Self {
        self.selectedpoints = Some(selectedpoints);
        self
    }
    /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.
    ///
    /// default: `all`
    pub fn hoverinfo(&mut self) -> &mut Hoverinfo {
        self.hoverinfo.is_empty = false;
        &mut self.hoverinfo.data
    }
    pub fn stream(&mut self) -> &mut Stream<'a> {
        self.stream.is_empty = false;
        &mut self.stream.data
    }
    /// Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves.
    ///
    pub fn uirevision(&mut self, uirevision: crate::Any) -> &mut Self {
        self.uirevision = Some(uirevision);
        self
    }
    /// Sets the x coordinates. If absent, linear coordinate will be generated.
    ///
    pub fn x(&mut self, x: &'a [f64]) -> &mut Self {
        self.x = Some(x);
        self
    }
    /// Sets the open values.
    ///
    pub fn open(&mut self, open: &'a [f64]) -> &mut Self {
        self.open = Some(open);
        self
    }
    /// Sets the high values.
    ///
    pub fn high(&mut self, high: &'a [f64]) -> &mut Self {
        self.high = Some(high);
        self
    }
    /// Sets the low values.
    ///
    pub fn low(&mut self, low: &'a [f64]) -> &mut Self {
        self.low = Some(low);
        self
    }
    /// Sets the close values.
    ///
    pub fn close(&mut self, close: &'a [f64]) -> &mut Self {
        self.close = Some(close);
        self
    }
    pub fn line(&mut self) -> &mut Line<'a> {
        self.line.is_empty = false;
        &mut self.line.data
    }
    pub fn increasing(&mut self) -> &mut Increasing<'a> {
        self.increasing.is_empty = false;
        &mut self.increasing.data
    }
    pub fn decreasing(&mut self) -> &mut Decreasing<'a> {
        self.decreasing.is_empty = false;
        &mut self.decreasing.data
    }
    /// Sets hover text elements associated with each sample point. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to this trace's sample points.
    ///
    /// default: ``
    pub fn text(&mut self, text: &'a str) -> &mut Self {
        self.text = Some(text);
        self
    }
    /// Same as `text`.
    ///
    /// default: ``
    pub fn hovertext(&mut self, hovertext: &'a str) -> &mut Self {
        self.hovertext = Some(hovertext);
        self
    }
    /// Sets the width of the open/close tick marks relative to the *x* minimal interval.
    ///
    /// default: `0.3`
    pub fn tickwidth(&mut self, tickwidth: f64) -> &mut Self {
        self.tickwidth = Some(tickwidth);
        self
    }
    pub fn hoverlabel(&mut self) -> &mut Hoverlabel<'a> {
        self.hoverlabel.is_empty = false;
        &mut self.hoverlabel.data
    }
    /// Sets the calendar system to use with `x` date data.
    ///
    /// default: `gregorian`
    pub fn xcalendar(&mut self, xcalendar: Xcalendar) -> &mut Self {
        self.xcalendar = Some(xcalendar);
        self
    }
    /// Sets a reference between this trace's x coordinates and a 2D cartesian x axis. If *x* (the default value), the x coordinates refer to `layout.xaxis`. If *x2*, the x coordinates refer to `layout.xaxis2`, and so on.
    ///
    /// default: `x`
    pub fn xaxis(&mut self, xaxis: &'a str) -> &mut Self {
        self.xaxis = Some(xaxis);
        self
    }
    /// Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If *y* (the default value), the y coordinates refer to `layout.yaxis`. If *y2*, the y coordinates refer to `layout.yaxis2`, and so on.
    ///
    /// default: `y`
    pub fn yaxis(&mut self, yaxis: &'a str) -> &mut Self {
        self.yaxis = Some(yaxis);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  ids .
    ///
    pub fn idssrc(&mut self, idssrc: &'a str) -> &mut Self {
        self.idssrc = Some(idssrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  customdata .
    ///
    pub fn customdatasrc(&mut self, customdatasrc: &'a str) -> &mut Self {
        self.customdatasrc = Some(customdatasrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  meta .
    ///
    pub fn metasrc(&mut self, metasrc: &'a str) -> &mut Self {
        self.metasrc = Some(metasrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  hoverinfo .
    ///
    pub fn hoverinfosrc(&mut self, hoverinfosrc: &'a str) -> &mut Self {
        self.hoverinfosrc = Some(hoverinfosrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  x .
    ///
    pub fn xsrc(&mut self, xsrc: &'a str) -> &mut Self {
        self.xsrc = Some(xsrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  open .
    ///
    pub fn opensrc(&mut self, opensrc: &'a str) -> &mut Self {
        self.opensrc = Some(opensrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  high .
    ///
    pub fn highsrc(&mut self, highsrc: &'a str) -> &mut Self {
        self.highsrc = Some(highsrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  low .
    ///
    pub fn lowsrc(&mut self, lowsrc: &'a str) -> &mut Self {
        self.lowsrc = Some(lowsrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  close .
    ///
    pub fn closesrc(&mut self, closesrc: &'a str) -> &mut Self {
        self.closesrc = Some(closesrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  text .
    ///
    pub fn textsrc(&mut self, textsrc: &'a str) -> &mut Self {
        self.textsrc = Some(textsrc);
        self
    }
    /// Sets the source reference on Chart Studio Cloud for  hovertext .
    ///
    pub fn hovertextsrc(&mut self, hovertextsrc: &'a str) -> &mut Self {
        self.hovertextsrc = Some(hovertextsrc);
        self
    }
}
pub enum Visible {
    True,
    False,
    Legendonly,
}
impl serde::Serialize for Visible {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        match self {
            Self::True => serializer.serialize_bool(true),
            Self::False => serializer.serialize_bool(false),
            Self::Legendonly => serializer.serialize_str("legendonly"),
        }
    }
}
#[derive(Default)]
pub struct HoverinfoFlags ([u8; 1]);
impl HoverinfoFlags {
    pub fn x(&mut self, v: bool) -> &mut Self {
        if v { self.0[0] |= 1 << 0; }
        else { self.0[0] &= !(1 << 0); }
        self
    }
    pub fn y(&mut self, v: bool) -> &mut Self {
        if v { self.0[0] |= 1 << 1; }
        else { self.0[0] &= !(1 << 1); }
        self
    }
    pub fn z(&mut self, v: bool) -> &mut Self {
        if v { self.0[0] |= 1 << 2; }
        else { self.0[0] &= !(1 << 2); }
        self
    }
    pub fn text(&mut self, v: bool) -> &mut Self {
        if v { self.0[0] |= 1 << 3; }
        else { self.0[0] &= !(1 << 3); }
        self
    }
    pub fn name(&mut self, v: bool) -> &mut Self {
        if v { self.0[0] |= 1 << 4; }
        else { self.0[0] &= !(1 << 4); }
        self
    }
}
impl serde::Serialize for HoverinfoFlags {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        #[allow(unused_mut)]
        let mut v: Vec<&str> = Vec::new();
        if (self.0[0] >> 0) & 0x1 == 1 {
            v.push("x");
        }
        if (self.0[0] >> 1) & 0x1 == 1 {
            v.push("y");
        }
        if (self.0[0] >> 2) & 0x1 == 1 {
            v.push("z");
        }
        if (self.0[0] >> 3) & 0x1 == 1 {
            v.push("text");
        }
        if (self.0[0] >> 4) & 0x1 == 1 {
            v.push("name");
        }
        serializer.serialize_str(&v.join("+"))
    }
}
pub enum Hoverinfo {
    Flags(HoverinfoFlags),
    All,
    None,
    Skip,
}
impl serde::Serialize for Hoverinfo {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        match self {
            Self::All => serializer.serialize_str("all"),
            Self::None => serializer.serialize_str("none"),
            Self::Skip => serializer.serialize_str("skip"),
            Self::Flags(v) => v.serialize(serializer),
        }
    }
}
impl Default for Hoverinfo {
    fn default() -> Self {
        Self::Flags(HoverinfoFlags::default())
    }
}
impl Hoverinfo {
    pub fn flags(&mut self) -> &mut HoverinfoFlags {
        *self = Self::Flags(HoverinfoFlags::default());
        match self {
            Self::Flags(v) => v,
            _ => unreachable!(),
        }
    }
    pub fn set(&mut self, v: Hoverinfo) {
        *self = v;
    }
}

#[derive(Default, Serialize)]
pub struct Stream<'a> {
    #[serde(rename = "token")]
    #[serde(skip_serializing_if = "Option::is_none")]
    token: Option<&'a str>,
    #[serde(rename = "maxpoints")]
    #[serde(skip_serializing_if = "Option::is_none")]
    maxpoints: Option<f64>,
}

impl<'a> Stream<'a> {
    /// The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
    ///
    pub fn token(&mut self, token: &'a str) -> &mut Self {
        self.token = Some(token);
        self
    }
    /// Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to *50*, only the newest 50 points will be displayed on the plot.
    ///
    /// default: `500`
    pub fn maxpoints(&mut self, maxpoints: f64) -> &mut Self {
        self.maxpoints = Some(maxpoints);
        self
    }
}

#[derive(Default, Serialize)]
pub struct Line<'a> {
    #[serde(rename = "width")]
    #[serde(skip_serializing_if = "Option::is_none")]
    width: Option<f64>,
    #[serde(rename = "dash")]
    #[serde(skip_serializing_if = "Option::is_none")]
    dash: Option<&'a str>,
}

impl<'a> Line<'a> {
    /// [object Object] Note that this style setting can also be set per direction via `increasing.line.width` and `decreasing.line.width`.
    ///
    /// default: `2`
    pub fn width(&mut self, width: f64) -> &mut Self {
        self.width = Some(width);
        self
    }
    /// 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*). Note that this style setting can also be set per direction via `increasing.line.dash` and `decreasing.line.dash`.
    ///
    /// default: `solid`
    pub fn dash(&mut self, dash: &'a str) -> &mut Self {
        self.dash = Some(dash);
        self
    }
}

#[derive(Default, Serialize)]
pub struct Increasing<'a> {
    #[serde(rename = "line")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    line: crate::IsEmpty<increasing::Line<'a>>,
}

impl<'a> Increasing<'a> {
    pub fn line(&mut self) -> &mut increasing::Line<'a> {
        self.line.is_empty = false;
        &mut self.line.data
    }
}
pub mod increasing {
#[allow(unused_imports)]
use serde::Serialize;

#[derive(Default, Serialize)]
pub struct Line<'a> {
    #[serde(rename = "color")]
    #[serde(skip_serializing_if = "Option::is_none")]
    color: Option<&'a str>,
    #[serde(rename = "width")]
    #[serde(skip_serializing_if = "Option::is_none")]
    width: Option<f64>,
    #[serde(rename = "dash")]
    #[serde(skip_serializing_if = "Option::is_none")]
    dash: Option<&'a str>,
}

impl<'a> Line<'a> {
    /// Sets the line color.
    ///
    /// default: `#3D9970`
    pub fn color(&mut self, color: &'a str) -> &mut Self {
        self.color = Some(color);
        self
    }
    /// Sets the line width (in px).
    ///
    /// default: `2`
    pub fn width(&mut self, width: f64) -> &mut Self {
        self.width = Some(width);
        self
    }
    /// 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*).
    ///
    /// default: `solid`
    pub fn dash(&mut self, dash: &'a str) -> &mut Self {
        self.dash = Some(dash);
        self
    }
}
}

#[derive(Default, Serialize)]
pub struct Decreasing<'a> {
    #[serde(rename = "line")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    line: crate::IsEmpty<decreasing::Line<'a>>,
}

impl<'a> Decreasing<'a> {
    pub fn line(&mut self) -> &mut decreasing::Line<'a> {
        self.line.is_empty = false;
        &mut self.line.data
    }
}
pub mod decreasing {
#[allow(unused_imports)]
use serde::Serialize;

#[derive(Default, Serialize)]
pub struct Line<'a> {
    #[serde(rename = "color")]
    #[serde(skip_serializing_if = "Option::is_none")]
    color: Option<&'a str>,
    #[serde(rename = "width")]
    #[serde(skip_serializing_if = "Option::is_none")]
    width: Option<f64>,
    #[serde(rename = "dash")]
    #[serde(skip_serializing_if = "Option::is_none")]
    dash: Option<&'a str>,
}

impl<'a> Line<'a> {
    /// Sets the line color.
    ///
    /// default: `#FF4136`
    pub fn color(&mut self, color: &'a str) -> &mut Self {
        self.color = Some(color);
        self
    }
    /// Sets the line width (in px).
    ///
    /// default: `2`
    pub fn width(&mut self, width: f64) -> &mut Self {
        self.width = Some(width);
        self
    }
    /// 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*).
    ///
    /// default: `solid`
    pub fn dash(&mut self, dash: &'a str) -> &mut Self {
        self.dash = Some(dash);
        self
    }
}
}

#[derive(Default, Serialize)]
pub struct Hoverlabel<'a> {
    #[serde(rename = "bgcolor")]
    #[serde(skip_serializing_if = "Option::is_none")]
    bgcolor: Option<&'a str>,
    #[serde(rename = "bordercolor")]
    #[serde(skip_serializing_if = "Option::is_none")]
    bordercolor: Option<&'a str>,
    #[serde(rename = "font")]
    #[serde(skip_serializing_if = "crate::IsEmpty::is_empty")]
    font: crate::IsEmpty<hoverlabel::Font<'a>>,
    #[serde(rename = "align")]
    #[serde(skip_serializing_if = "Option::is_none")]
    align: Option<hoverlabel::Align>,
    #[serde(rename = "namelength")]
    #[serde(skip_serializing_if = "Option::is_none")]
    namelength: Option<u64>,
    #[serde(rename = "split")]
    #[serde(skip_serializing_if = "Option::is_none")]
    split: Option<bool>,
}

impl<'a> Hoverlabel<'a> {
    /// Sets the background color of the hover labels for this trace
    ///
    pub fn bgcolor(&mut self, bgcolor: &'a str) -> &mut Self {
        self.bgcolor = Some(bgcolor);
        self
    }
    /// Sets the border color of the hover labels for this trace.
    ///
    pub fn bordercolor(&mut self, bordercolor: &'a str) -> &mut Self {
        self.bordercolor = Some(bordercolor);
        self
    }
    /// Sets the font used in hover labels.
    ///
    pub fn font(&mut self) -> &mut hoverlabel::Font<'a> {
        self.font.is_empty = false;
        &mut self.font.data
    }
    /// Sets the horizontal alignment of the text content within hover label box. Has an effect only if the hover label text spans more two or more lines
    ///
    /// default: `auto`
    pub fn align(&mut self, align: hoverlabel::Align) -> &mut Self {
        self.align = Some(align);
        self
    }
    /// Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it is longer, will truncate to `namelength - 3` characters and add an ellipsis.
    ///
    /// default: `15`
    pub fn namelength(&mut self, namelength: u64) -> &mut Self {
        self.namelength = Some(namelength);
        self
    }
    /// Show hover information (open, close, high, low) in separate labels.
    ///
    /// default: `false`
    pub fn split(&mut self, split: bool) -> &mut Self {
        self.split = Some(split);
        self
    }
}
pub mod hoverlabel {
#[allow(unused_imports)]
use serde::Serialize;

/// Sets the font used in hover labels.
#[derive(Default, Serialize)]
pub struct Font<'a> {
    #[serde(rename = "family")]
    #[serde(skip_serializing_if = "Option::is_none")]
    family: Option<&'a str>,
    #[serde(rename = "size")]
    #[serde(skip_serializing_if = "Option::is_none")]
    size: Option<f64>,
    #[serde(rename = "color")]
    #[serde(skip_serializing_if = "Option::is_none")]
    color: Option<&'a str>,
}

impl<'a> Font<'a> {
    /// HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.
    ///
    pub fn family(&mut self, family: &'a str) -> &mut Self {
        self.family = Some(family);
        self
    }
    pub fn size(&mut self, size: f64) -> &mut Self {
        self.size = Some(size);
        self
    }
    pub fn color(&mut self, color: &'a str) -> &mut Self {
        self.color = Some(color);
        self
    }
}
pub enum Align {
    Left,
    Right,
    Auto,
}
impl serde::Serialize for Align {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        match self {
            Self::Left => serializer.serialize_str("left"),
            Self::Right => serializer.serialize_str("right"),
            Self::Auto => serializer.serialize_str("auto"),
        }
    }
}
}
pub enum Xcalendar {
    Gregorian,
    Chinese,
    Coptic,
    Discworld,
    Ethiopian,
    Hebrew,
    Islamic,
    Julian,
    Mayan,
    Nanakshahi,
    Nepali,
    Persian,
    Jalali,
    Taiwan,
    Thai,
    Ummalqura,
}
impl serde::Serialize for Xcalendar {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        match self {
            Self::Gregorian => serializer.serialize_str("gregorian"),
            Self::Chinese => serializer.serialize_str("chinese"),
            Self::Coptic => serializer.serialize_str("coptic"),
            Self::Discworld => serializer.serialize_str("discworld"),
            Self::Ethiopian => serializer.serialize_str("ethiopian"),
            Self::Hebrew => serializer.serialize_str("hebrew"),
            Self::Islamic => serializer.serialize_str("islamic"),
            Self::Julian => serializer.serialize_str("julian"),
            Self::Mayan => serializer.serialize_str("mayan"),
            Self::Nanakshahi => serializer.serialize_str("nanakshahi"),
            Self::Nepali => serializer.serialize_str("nepali"),
            Self::Persian => serializer.serialize_str("persian"),
            Self::Jalali => serializer.serialize_str("jalali"),
            Self::Taiwan => serializer.serialize_str("taiwan"),
            Self::Thai => serializer.serialize_str("thai"),
            Self::Ummalqura => serializer.serialize_str("ummalqura"),
        }
    }
}