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
use crate::{
datatype::CompositeValue,
element::{
AxisLabel, AxisLine, AxisPointer, AxisTick, AxisType, BoundaryGap, NameLocation, SplitArea,
SplitLine, TextStyle,
},
};
use charming_macros::CharmingSetters;
use serde::{Deserialize, Serialize};
/// Axis in cartesian coordinate.
#[serde_with::apply(
Option => #[serde(skip_serializing_if = "Option::is_none")],
Vec => #[serde(default, skip_serializing_if = "Vec::is_empty")]
)]
#[derive(Serialize, Deserialize, CharmingSetters, Debug, PartialEq, Clone)]
#[serde(rename_all = "camelCase")]
pub struct Axis {
/// Type of axis.
#[serde(rename = "type")]
type_: Option<AxisType>,
/// Id of axis.
id: Option<String>,
/// Whether to show the axis.
show: Option<bool>,
/// Index of grid which is used to place this axis.
grid_index: Option<f64>,
/// Offset of this axis relative to default position.
offset: Option<f64>,
/// Name of axis.
name: Option<String>,
/// Location of axis name.
name_location: Option<NameLocation>,
/// Text style of axis name.
name_text_style: Option<TextStyle>,
/// Gap between axis name and axis line.
name_gap: Option<f64>,
/// Rotation of axis name
name_rotation: Option<f64>,
/// Set this to `true` to invert the axis.
inverse: Option<bool>,
align_ticks: Option<bool>,
/// The boundary gap on both sides of a coordinate axis.
boundary_gap: Option<BoundaryGap>,
position: Option<CompositeValue>,
/// The mimimum value of axis.
min: Option<CompositeValue>,
/// The maximum value of axis.
max: Option<CompositeValue>,
scale: Option<bool>,
/// Number of segments that the axis is split into.
split_number: Option<f64>,
/// Minimum gap between split lines.
min_interval: Option<f64>,
/// Maximum gap between split lines.
max_interval: Option<f64>,
/// Compulsively set segmentation interval for axis.
interval: Option<f64>,
/// Base of logarithm, which is valid only for numeric axes with `log` type.
log_base: Option<f64>,
start_value: Option<f64>,
/// Value of all graphical elements in x axis.
z_level: Option<f64>,
/// Value of all graphical elements in x axis, which controls order of drawing graphical components.
z: Option<f64>,
/// Settings related to axis label.
axis_label: Option<AxisLabel>,
/// Settings related to axis tick.
axis_tick: Option<AxisTick>,
/// Settings related to axis line.
axis_line: Option<AxisLine>,
/// Settings related to axis pointer.
axis_pointer: Option<AxisPointer>,
/// Settings related to split area.
split_area: Option<SplitArea>,
/// Settings related to split line.
split_line: Option<SplitLine>,
#[charming_set_vec]
data: Vec<String>,
}