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
use chrono::NaiveDateTime;
use crate::{
color::Color,
coord::{Arc, Axes, Stick, Vector},
};
/// This trait allows to create a label axes for the chart
pub trait ScaleLabel {
// fn labels(&self) -> Vec<String>;
fn colors(&self) -> Vec<Color>;
fn scale(&self, value: f64) -> f64;
fn scale_index(&self, label: String) -> usize;
// fn get_intervale(&self, len: f64) -> f64;
// fn gen_sticks_label_step(&self) -> (Vec<String>, f64);
fn gen_axes(&self) -> Axes;
// To stick for series
fn to_stick(&self) -> Vec<Stick>;
}
/// This trait allows to create a number axes for the chart
pub trait ScaleNumber {
// min, max
fn domain(&self) -> (f64, f64);
fn scale(&self, value: f64) -> f64;
fn count_distance_step(&self) -> (f64, f64, f64);
fn to_percent(&self) -> Vec<f64>;
// For Pie
fn gen_pie(&self) -> Vec<Arc>;
fn to_percent_radar(&self) -> Vec<f64>;
// fn get_intervale(&self, len: f64) -> f64;
// fn gen_sticks_label_step(&self) -> (Vec<String>, f64);
fn gen_axes(&self) -> Axes;
// To stick for series
fn to_stick(&self) -> Vec<Stick>;
// For Radar
fn gen_radar_grid(&self, count: usize) -> Vec<Vector>;
}
/// This trait allows to create a time axes for the chart
pub trait ScaleTime {
fn domain(&self) -> (NaiveDateTime, NaiveDateTime);
fn domain_unix(&self) -> (f64, f64);
fn scale(&self, value: NaiveDateTime) -> f64;
// fn domain_unit(&self) -> (NaiveDateTime, NaiveDateTime);
// fn count_distance_step(&self) -> (f64, f64);
// fn get_intervale(&self, len: f64) -> f64;
// fn scale_intervale(&self, value: NaiveDateTime) -> f64;
fn gen_axes(&self) -> Axes;
// To stick for series
fn to_stick(&self) -> Vec<Stick>;
}