Skip to main content

BarSeries

Struct BarSeries 

Source
pub struct BarSeries {
    pub index: u32,
    pub order: u32,
    pub title: Option<SeriesTitle>,
    pub shape_properties: Option<ShapeProperties>,
    pub categories: Option<AxisDataSource>,
    pub values: Option<NumericDataSource>,
}
Expand description

A bar/column chart series (<c:ser> inside <c:barChart>, CT_BarSer).

Not modeled: invertIfNegative, pictureOptions (bar-as-image fills), dPt (per-point overrides), dLbls (data labels), trendline, errBars, shape (3D bar shapes — 3D itself is out of scope).

Fields§

§index: u32

<c:idx>EG_SerShared.

§order: u32

<c:order> — the series’ draw order, independent of index.

§title: Option<SeriesTitle>§shape_properties: Option<ShapeProperties>§categories: Option<AxisDataSource>§values: Option<NumericDataSource>

Implementations§

Source§

impl BarSeries

Source

pub fn new(index: u32, order: u32) -> BarSeries

Examples found in repository?
examples/docx_images_and_charts.rs (line 51)
41fn sample_chart_space() -> ChartSpace {
42    let categories = StringData::new()
43        .with_point(StringPoint::new(0, "Q1"))
44        .with_point(StringPoint::new(1, "Q2"))
45        .with_point(StringPoint::new(2, "Q3"));
46    let values = NumericData::new()
47        .with_point(NumericPoint::new(0, "1200"))
48        .with_point(NumericPoint::new(1, "1350"))
49        .with_point(NumericPoint::new(2, "980"));
50
51    let series = BarSeries::new(0, 0)
52        .with_categories(AxisDataSource::String(StringDataSource::literal(
53            categories,
54        )))
55        .with_values(NumericDataSource::literal(values));
56
57    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
58    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
59    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
60
61    let plot_area = PlotArea::new()
62        .with_chart(ChartType::Bar(bar_chart))
63        .with_axis(Axis::Category(category_axis))
64        .with_axis(Axis::Value(value_axis));
65
66    ChartSpace::new(Chart::new(plot_area))
67}
More examples
Hide additional examples
examples/pptx_media.rs (line 91)
81fn sample_chart_space() -> ChartSpace {
82    let categories = StringData::new()
83        .with_point(StringPoint::new(0, "Q1"))
84        .with_point(StringPoint::new(1, "Q2"))
85        .with_point(StringPoint::new(2, "Q3"));
86    let values = NumericData::new()
87        .with_point(NumericPoint::new(0, "1200"))
88        .with_point(NumericPoint::new(1, "1350"))
89        .with_point(NumericPoint::new(2, "980"));
90
91    let series = BarSeries::new(0, 0)
92        .with_categories(AxisDataSource::String(StringDataSource::literal(
93            categories,
94        )))
95        .with_values(NumericDataSource::literal(values));
96
97    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
98    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
99    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
100
101    let plot_area = PlotArea::new()
102        .with_chart(ChartType::Bar(bar_chart))
103        .with_axis(Axis::Category(category_axis))
104        .with_axis(Axis::Value(value_axis));
105
106    ChartSpace::new(Chart::new(plot_area))
107}
examples/xlsx_images_and_charts.rs (line 63)
53fn sample_chart_space() -> ChartSpace {
54    let categories = StringData::new()
55        .with_point(StringPoint::new(0, "Q1"))
56        .with_point(StringPoint::new(1, "Q2"))
57        .with_point(StringPoint::new(2, "Q3"));
58    let values = NumericData::new()
59        .with_point(NumericPoint::new(0, "1200"))
60        .with_point(NumericPoint::new(1, "1350"))
61        .with_point(NumericPoint::new(2, "980"));
62
63    let series = BarSeries::new(0, 0)
64        .with_categories(AxisDataSource::String(StringDataSource::literal(
65            categories,
66        )))
67        .with_values(NumericDataSource::literal(values));
68
69    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
70    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
71    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
72
73    let plot_area = PlotArea::new()
74        .with_chart(ChartType::Bar(bar_chart))
75        .with_axis(Axis::Category(category_axis))
76        .with_axis(Axis::Value(value_axis));
77
78    ChartSpace::new(Chart::new(plot_area))
79}
Source

pub fn with_title(self, title: SeriesTitle) -> BarSeries

Source

pub fn with_shape_properties(self, properties: ShapeProperties) -> BarSeries

Source

pub fn with_categories(self, categories: AxisDataSource) -> BarSeries

Examples found in repository?
examples/docx_images_and_charts.rs (lines 52-54)
41fn sample_chart_space() -> ChartSpace {
42    let categories = StringData::new()
43        .with_point(StringPoint::new(0, "Q1"))
44        .with_point(StringPoint::new(1, "Q2"))
45        .with_point(StringPoint::new(2, "Q3"));
46    let values = NumericData::new()
47        .with_point(NumericPoint::new(0, "1200"))
48        .with_point(NumericPoint::new(1, "1350"))
49        .with_point(NumericPoint::new(2, "980"));
50
51    let series = BarSeries::new(0, 0)
52        .with_categories(AxisDataSource::String(StringDataSource::literal(
53            categories,
54        )))
55        .with_values(NumericDataSource::literal(values));
56
57    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
58    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
59    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
60
61    let plot_area = PlotArea::new()
62        .with_chart(ChartType::Bar(bar_chart))
63        .with_axis(Axis::Category(category_axis))
64        .with_axis(Axis::Value(value_axis));
65
66    ChartSpace::new(Chart::new(plot_area))
67}
More examples
Hide additional examples
examples/pptx_media.rs (lines 92-94)
81fn sample_chart_space() -> ChartSpace {
82    let categories = StringData::new()
83        .with_point(StringPoint::new(0, "Q1"))
84        .with_point(StringPoint::new(1, "Q2"))
85        .with_point(StringPoint::new(2, "Q3"));
86    let values = NumericData::new()
87        .with_point(NumericPoint::new(0, "1200"))
88        .with_point(NumericPoint::new(1, "1350"))
89        .with_point(NumericPoint::new(2, "980"));
90
91    let series = BarSeries::new(0, 0)
92        .with_categories(AxisDataSource::String(StringDataSource::literal(
93            categories,
94        )))
95        .with_values(NumericDataSource::literal(values));
96
97    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
98    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
99    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
100
101    let plot_area = PlotArea::new()
102        .with_chart(ChartType::Bar(bar_chart))
103        .with_axis(Axis::Category(category_axis))
104        .with_axis(Axis::Value(value_axis));
105
106    ChartSpace::new(Chart::new(plot_area))
107}
examples/xlsx_images_and_charts.rs (lines 64-66)
53fn sample_chart_space() -> ChartSpace {
54    let categories = StringData::new()
55        .with_point(StringPoint::new(0, "Q1"))
56        .with_point(StringPoint::new(1, "Q2"))
57        .with_point(StringPoint::new(2, "Q3"));
58    let values = NumericData::new()
59        .with_point(NumericPoint::new(0, "1200"))
60        .with_point(NumericPoint::new(1, "1350"))
61        .with_point(NumericPoint::new(2, "980"));
62
63    let series = BarSeries::new(0, 0)
64        .with_categories(AxisDataSource::String(StringDataSource::literal(
65            categories,
66        )))
67        .with_values(NumericDataSource::literal(values));
68
69    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
70    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
71    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
72
73    let plot_area = PlotArea::new()
74        .with_chart(ChartType::Bar(bar_chart))
75        .with_axis(Axis::Category(category_axis))
76        .with_axis(Axis::Value(value_axis));
77
78    ChartSpace::new(Chart::new(plot_area))
79}
Source

pub fn with_values(self, values: NumericDataSource) -> BarSeries

Examples found in repository?
examples/docx_images_and_charts.rs (line 55)
41fn sample_chart_space() -> ChartSpace {
42    let categories = StringData::new()
43        .with_point(StringPoint::new(0, "Q1"))
44        .with_point(StringPoint::new(1, "Q2"))
45        .with_point(StringPoint::new(2, "Q3"));
46    let values = NumericData::new()
47        .with_point(NumericPoint::new(0, "1200"))
48        .with_point(NumericPoint::new(1, "1350"))
49        .with_point(NumericPoint::new(2, "980"));
50
51    let series = BarSeries::new(0, 0)
52        .with_categories(AxisDataSource::String(StringDataSource::literal(
53            categories,
54        )))
55        .with_values(NumericDataSource::literal(values));
56
57    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
58    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
59    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
60
61    let plot_area = PlotArea::new()
62        .with_chart(ChartType::Bar(bar_chart))
63        .with_axis(Axis::Category(category_axis))
64        .with_axis(Axis::Value(value_axis));
65
66    ChartSpace::new(Chart::new(plot_area))
67}
More examples
Hide additional examples
examples/pptx_media.rs (line 95)
81fn sample_chart_space() -> ChartSpace {
82    let categories = StringData::new()
83        .with_point(StringPoint::new(0, "Q1"))
84        .with_point(StringPoint::new(1, "Q2"))
85        .with_point(StringPoint::new(2, "Q3"));
86    let values = NumericData::new()
87        .with_point(NumericPoint::new(0, "1200"))
88        .with_point(NumericPoint::new(1, "1350"))
89        .with_point(NumericPoint::new(2, "980"));
90
91    let series = BarSeries::new(0, 0)
92        .with_categories(AxisDataSource::String(StringDataSource::literal(
93            categories,
94        )))
95        .with_values(NumericDataSource::literal(values));
96
97    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
98    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
99    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
100
101    let plot_area = PlotArea::new()
102        .with_chart(ChartType::Bar(bar_chart))
103        .with_axis(Axis::Category(category_axis))
104        .with_axis(Axis::Value(value_axis));
105
106    ChartSpace::new(Chart::new(plot_area))
107}
examples/xlsx_images_and_charts.rs (line 67)
53fn sample_chart_space() -> ChartSpace {
54    let categories = StringData::new()
55        .with_point(StringPoint::new(0, "Q1"))
56        .with_point(StringPoint::new(1, "Q2"))
57        .with_point(StringPoint::new(2, "Q3"));
58    let values = NumericData::new()
59        .with_point(NumericPoint::new(0, "1200"))
60        .with_point(NumericPoint::new(1, "1350"))
61        .with_point(NumericPoint::new(2, "980"));
62
63    let series = BarSeries::new(0, 0)
64        .with_categories(AxisDataSource::String(StringDataSource::literal(
65            categories,
66        )))
67        .with_values(NumericDataSource::literal(values));
68
69    let bar_chart = BarChart::new(BarDirection::Column, 1, 2).with_series(series);
70    let category_axis = CategoryAxis::new(1, AxisPosition::Bottom, 2);
71    let value_axis = ValueAxis::new(2, AxisPosition::Left, 1);
72
73    let plot_area = PlotArea::new()
74        .with_chart(ChartType::Bar(bar_chart))
75        .with_axis(Axis::Category(category_axis))
76        .with_axis(Axis::Value(value_axis));
77
78    ChartSpace::new(Chart::new(plot_area))
79}

Trait Implementations§

Source§

impl Clone for BarSeries

Source§

fn clone(&self) -> BarSeries

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BarSeries

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for BarSeries

Source§

fn default() -> BarSeries

Returns the “default value” for a type. Read more
Source§

impl PartialEq for BarSeries

Source§

fn eq(&self, other: &BarSeries) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BarSeries

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.