pub struct ChartSpec {
pub version: u32,
pub kind: ChartType,
pub title: String,
pub x: String,
pub series: Vec<ChartSeries>,
pub data: Vec<Map<String, Value>>,
pub unit: Option<String>,
pub stacked: bool,
}Expand description
A validated chart. Build it with validate; a spec read from disk or the wire should
be passed through validate again (see ChartSpec::from_json).
Fields§
§version: u32Always 1.
kind: ChartType§title: String§x: StringThe column along the bottom (pie: the slice names).
series: Vec<ChartSeries>§data: Vec<Map<String, Value>>Rows: x holds a string or number (scatter: a number or null); each series key a
number or null.
unit: Option<String>Shown with numbers, e.g. “€” or “kg”.
stacked: boolBars or areas on top of each other.
Implementations§
Source§impl ChartSpec
impl ChartSpec
Sourcepub fn from_json(text: &str) -> Result<ChartSpec, String>
pub fn from_json(text: &str) -> Result<ChartSpec, String>
Parse and re-validate an untrusted .chart.json (from disk, hob, or a peer).
pub fn to_json(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ChartSpec
impl<'de> Deserialize<'de> for ChartSpec
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChartSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ChartSpec, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for ChartSpec
impl Serialize for ChartSpec
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ChartSpec
Auto Trait Implementations§
impl Forget for ChartSpec
impl Freeze for ChartSpec
impl Move for ChartSpec
impl RefUnwindSafe for ChartSpec
impl Send for ChartSpec
impl Sync for ChartSpec
impl Unpin for ChartSpec
impl UnsafeUnpin for ChartSpec
impl UnwindSafe for ChartSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more