pub struct CategoryAxis {
pub id: u32,
pub position: AxisPosition,
pub cross_axis_id: u32,
pub log_base: Option<f64>,
pub min: Option<f64>,
pub max: Option<f64>,
pub reversed: bool,
pub major_gridlines: bool,
pub minor_gridlines: bool,
pub title: Option<Title>,
}Expand description
The category axis (<c:catAx>, CT_CatAx) — paired with a ValueAxis for bar/line charts.
Pie/Pie3D/Doughnut charts have no axes at all: confirmed structurally against the schema,
CT_PieChart’s EG_PieChartShared group has no axId element whatsoever, unlike
CT_BarChart/CT_LineChart which each require exactly two (axId minOccurs="2" maxOccurs="2").
Not modeled: delete, crosses/crossesAt (the axis-crossing-point choice, distinct from
crossAxisId which only says which axis this one crosses, not where), numFmt,
majorTickMark/minorTickMark/ tickLblPos (tick-mark cosmetics), lblAlgn/lblOffset/
tickLblSkip/tickMarkSkip/noMultiLvlLbl (category-axis-specific label placement details),
spPr/txPr (axis line/text formatting — txPr specifically deferred everywhere in this
crate, see lib.rs’s doc comment on why).
Fields§
§id: u32§position: AxisPosition§cross_axis_id: u32<c:crossAx> — the id of the axis this one crosses (a ValueAxis in bar/line charts).
log_base: Option<f64><c:scaling><c:logBase val=".."/></c:scaling> — 2.=1000.
min: Option<f64>§max: Option<f64>§reversed: bool<c:scaling><c:orientation val="maxMin"/></c:scaling> — true reverses the axis
(maxMin); false/absent is the schema default (minMax).
major_gridlines: bool§minor_gridlines: bool§title: Option<Title>Implementations§
Source§impl CategoryAxis
impl CategoryAxis
Sourcepub fn new(id: u32, position: AxisPosition, cross_axis_id: u32) -> CategoryAxis
pub fn new(id: u32, position: AxisPosition, cross_axis_id: u32) -> CategoryAxis
Examples found in repository?
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
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}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}pub fn with_min(self, min: f64) -> CategoryAxis
pub fn with_max(self, max: f64) -> CategoryAxis
pub fn with_log_base(self, log_base: f64) -> CategoryAxis
pub fn with_reversed(self, reversed: bool) -> CategoryAxis
pub fn with_major_gridlines(self, show: bool) -> CategoryAxis
pub fn with_minor_gridlines(self, show: bool) -> CategoryAxis
pub fn with_title(self, title: Title) -> CategoryAxis
Trait Implementations§
Source§impl Clone for CategoryAxis
impl Clone for CategoryAxis
Source§fn clone(&self) -> CategoryAxis
fn clone(&self) -> CategoryAxis
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more