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,
pub source: Option<Box<ChartSource>>,
}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.
source: Option<Box<ChartSource>>Where the rows come from when the chart is drawn from a spreadsheet: it is drawn again
from there whenever the sheet changes (the sheets plugin’s chart_sheet).
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 ChartSpecwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<ChartSeries>: Freeze,
PhantomData<Map<String, Value>>: Freeze,
*const ChartSource is !null: Freeze,
PhantomData<ChartSource>: Freeze,
impl Move for ChartSpec
impl RefUnwindSafe for ChartSpec
impl Send for ChartSpec
impl Sync for ChartSpec
impl Unpin for ChartSpec
impl UnsafeUnpin for ChartSpecwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<ChartSeries>: UnsafeUnpin,
PhantomData<Map<String, Value>>: UnsafeUnpin,
*const ChartSource is !null: UnsafeUnpin,
PhantomData<ChartSource>: UnsafeUnpin,
impl UnwindSafe for ChartSpecwhere
RawVecInner: UnwindSafe,
BTreeMap<String, Value>: UnwindSafe,
BoxRaw<ChartSource>: UnwindSafe,
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