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
use super::data_series_values::DataSeriesValues;
use std::collections::BTreeMap;

#[derive(Default, Debug)]
pub struct DataSeries {
    plot_type: String,
    plot_grouping: Option<String>,
    plot_direction: String,
    plot_style: String,
    plot_order: BTreeMap<i32, i32>,
    plot_label: BTreeMap<i32, DataSeriesValues>,
    plot_category: BTreeMap<i32, DataSeriesValues>,
    smooth_line: bool,
    plot_values: BTreeMap<i32, DataSeriesValues>,
}
impl DataSeries {
    pub const TYPE_BARCHART: &'static str = "barChart";
    pub const TYPE_BARCHART_3D: &'static str = "bar3DChart";
    pub const TYPE_LINECHART: &'static str = "lineChart";
    pub const TYPE_LINECHART_3D: &'static str = "line3DChart";
    pub const TYPE_AREACHART: &'static str = "areaChart";
    pub const TYPE_AREACHART_3D: &'static str = "area3DChart";
    pub const TYPE_PIECHART: &'static str = "pieChart";
    pub const TYPE_PIECHART_3D: &'static str = "pie3DChart";
    pub const TYPE_DOUGHNUTCHART: &'static str = "doughnutChart";
    pub const TYPE_DONUTCHART: &'static str = Self::TYPE_DOUGHNUTCHART; // Synonym

    pub const TYPE_SCATTERCHART: &'static str = "scatterChart";
    pub const TYPE_SURFACECHART: &'static str = "surfaceChart";
    pub const TYPE_SURFACECHART_3D: &'static str = "surface3DChart";
    pub const TYPE_RADARCHART: &'static str = "radarChart";
    pub const TYPE_BUBBLECHART: &'static str = "bubbleChart";
    pub const TYPE_STOCKCHART: &'static str = "stockChart";
    pub const TYPE_CANDLECHART: &'static str = Self::TYPE_STOCKCHART; // Synonym


    pub const GROUPING_CLUSTERED: &'static str = "clustered";
    pub const GROUPING_STACKED: &'static str = "stacked";
    pub const GROUPING_PERCENT_STACKED: &'static str = "percentStacked";
    pub const GROUPING_STANDARD: &'static str = "standard";

    pub const DIRECTION_BAR: &'static str = "bar";
    pub const DIRECTION_HORIZONTAL: &'static str = Self::DIRECTION_BAR;
    pub const DIRECTION_COL: &'static str = "col";
    pub const DIRECTION_COLUMN: &'static str = Self::DIRECTION_COL;
    pub const DIRECTION_VERTICAL: &'static str = Self::DIRECTION_COL;

    pub const STYLE_LINEMARKER: &'static str = "lineMarker";
    pub const STYLE_SMOOTHMARKER: &'static str = "smoothMarker";
    pub const STYLE_MARKER: &'static str = "marker";
    pub const STYLE_FILLED: &'static str = "filled";

    pub const EMPTY_AS_GAP: &'static str = "gap";
    pub const EMPTY_AS_ZERO: &'static str = "zero";
    pub const EMPTY_AS_SPAN: &'static str = "span";

    pub fn get_plot_type(&self)-> &str {
        &self.plot_type
    }
    pub(crate) fn set_plot_type<S: Into<String>>(&mut self, value:S) {
        self.plot_type = value.into();
    }
    pub fn get_plot_grouping(&self)-> &Option<String> {
        &self.plot_grouping
    }
    pub(crate) fn set_plot_grouping<S: Into<String>>(&mut self, value:S) {
        self.plot_grouping = Some(value.into());
    }
    pub fn get_plot_direction(&self)-> &str {
        &self.plot_direction
    }
    pub(crate) fn set_plot_direction<S: Into<String>>(&mut self, value:S) {
        self.plot_direction = value.into();
    }
    pub fn get_plot_style(&self)-> &str {
        &self.plot_style
    }
    pub(crate) fn set_plot_style<S: Into<String>>(&mut self, value:S) {
        self.plot_style = value.into();
    }
    pub fn get_plot_order(&self)-> &BTreeMap<i32, i32> {
        &self.plot_order
    }
    pub(crate) fn add_plot_order(&mut self, index:i32, value:i32) {
        self.plot_order.insert(index, value);
    }
    pub fn get_plot_label(&self)-> &BTreeMap<i32, DataSeriesValues>
    {
        &self.plot_label
    }
    pub(crate) fn add_plot_label(&mut self, index:i32, value:DataSeriesValues) {
        self.plot_label.insert(index, value);
    }
    pub fn get_plot_category(&self)-> &BTreeMap<i32, DataSeriesValues> {
        &self.plot_category
    }
    pub(crate) fn add_plot_category(&mut self, index:i32, value:DataSeriesValues) {
        self.plot_category.insert(index, value);
    }
    pub fn get_smooth_line(&self)-> &bool {
        &self.smooth_line
    }
    pub(crate) fn set_smooth_line(&mut self, value:bool) {
        self.smooth_line = value.into();
    }
    pub fn get_plot_values(&self)-> &BTreeMap<i32, DataSeriesValues> {
        &self.plot_values
    }
    pub(crate) fn add_plot_values(&mut self, index:i32, value:DataSeriesValues) {
        self.plot_values.insert(index, value);
    }
}