Struct charts::BaseChart [−][src]
pub struct BaseChart<C, E, M, D, O> where
C: CanvasContext,
E: Entity,
M: Display,
D: Display + Copy,
O: BaseOption, { pub props: RefCell<BaseChartProperties>, pub data: DataStream<M, D>, pub options: O, pub context: Option<C>, pub channels: RefCell<Vec<ChartChannel<E>>>, }
Base class for all charts.
Fields
props: RefCell<BaseChartProperties>
data: DataStream<M, D>
The data table that stores chart data Row 0 contains column names. Column 0 contains x-axis/pie labels. Column 1..n - 1 contain channel data.
options: O
The drawing options initialized in the constructor.
context: Option<C>
The main rendering context.
channels: RefCell<Vec<ChartChannel<E>>>
The rendering context for the axes. The rendering context for the channel. The precalcuated datas A ChartChannel keep track of the visibility of the channel.
Implementations
impl<C, E, M, D, O> BaseChart<C, E, M, D, O> where
C: CanvasContext,
E: Entity,
M: Display,
D: Display + Copy,
O: BaseOption,
[src]
impl<C, E, M, D, O> BaseChart<C, E, M, D, O> where
C: CanvasContext,
E: Entity,
M: Display,
D: Display + Copy,
O: BaseOption,
[src]pub fn new(options: O) -> Self
[src]
Creates a chart given a container.
If the CSS position of [container] is “static”, it will be changed to “relative”.
pub fn change_fill_alpha(&self, value: &Fill, alpha: f64) -> Fill
[src]
Creates a new color by combining the R, G, B components of [color] with [alpha] from 0 to 1. TODO: There are question about set the alpha or change from existing alpha
pub fn get_fill(&self, index: usize) -> Fill
[src]
pub fn get_highlight_color(&self, value: &Fill) -> Fill
[src]
pub fn animation_end(&self)
[src]
Called when the animation ends.
pub fn data_cell_changed(&self, record: DataCellChangeRecord<D>)
[src]
Event handler for [DataTable.onCellChanged].
NOTE: This method only handles the case when [record.columnIndex] >= 1;
pub fn data_rows_changed(&self, record: DataCollectionChangeRecord)
[src]
Event handler for [DataTable.onRowsChanged].
pub fn data_columns_changed(&self, record: DataCollectionChangeRecord)
[src]
Event handler for [DataTable.onColumnsChanged].
pub fn update_channel_visible(
&self,
index: usize,
removed_count: usize,
added_count: usize
)
[src]
&self,
index: usize,
removed_count: usize,
added_count: usize
)
pub fn draw_title(&self, ctx: &C)
[src]
Draws the chart title using the main rendering context.
pub fn initialize_legend(&self)
[src]
pub fn position_legend(&self)
[src]
This must be called after [calculate_drawing_sizes] as we need to know where the title is in order to position the legend correctly.
pub fn update_legend_content(&self)
[src]
pub fn get_legend_labels(&self) -> Vec<String>
[src]
pub fn legend_item_click(&self, e: MouseEvent)
[src]
pub fn legend_item_mouse_over(&self, e: MouseEvent)
[src]
pub fn legend_item_mouse_out(&self, e: MouseEvent)
[src]
pub fn channel_visibility_changed(&self, index: usize)
[src]
Called when the visibility of a channel is changed.
[index] is the index of the affected channel.
pub fn get_entity_group_index(&self, x: f64, y: f64) -> i64
[src]
Returns the index of the point group/bar group/pie/… near the position specified by [x] and [y].
pub fn mouse_move(&self, e: MouseEvent)
[src]
Handles mousemove
or touchstart
events to highlight appropriate
points/bars/pies/… as well as update the tooltip.
pub fn initialize_tooltip(&self)
[src]
pub fn update_tooltip_content(&self)
[src]
pub fn create_tooltip_or_legend(
&self,
style: HashMap<String, String>
) -> Option<bool>
[src]
&self,
style: HashMap<String, String>
) -> Option<bool>
Creates an absolute positioned div with styles specified by [style].
pub fn create_tooltip_or_legend_item(
&self,
color: String,
text: String
) -> Option<bool>
[src]
&self,
color: String,
text: String
) -> Option<bool>
pub fn start_animation(&self)
[src]
pub fn stop_animation(&self)
[src]
pub fn animating(&self) -> bool
[src]
pub fn is_animating(&self) -> bool
[src]
Whether the chart is animating.
pub fn is_interactive(&self) -> bool
[src]
Whether the chart is interactive.
This property returns false
if the chart is animating or there are no
channel to draw.
pub fn dispose(&self)
[src]
Disposes of resources used by this chart. The chart will become unusable until [draw] is called again.
Be sure to call this method when the chart is no longer used to afn any memory leaks.
@mustCallSuper
pub fn calculate_percent(&self, time: Option<i64>) -> f64
[src]
Trait Implementations
impl<C, E, M, D, O> Chart<C, M, D, E> for BaseChart<C, E, M, D, O> where
C: CanvasContext,
E: Entity,
M: Display,
D: Display + Copy,
O: BaseOption,
[src]
impl<C, E, M, D, O> Chart<C, M, D, E> for BaseChart<C, E, M, D, O> where
C: CanvasContext,
E: Entity,
M: Display,
D: Display + Copy,
O: BaseOption,
[src]fn calculate_drawing_sizes(&self, ctx: &C)
[src]
Calculates various drawing sizes.
Overriding methods must call this method first to have [area] calculated.
fn set_stream(&mut self, stream: DataStream<M, D>)
[src]
fn draw(&self, ctx: &C)
[src]
Draws the chart given a data table [dataTable] and an optional set of options [options].
fn resize(&self, w: f64, h: f64)
[src]
Resizes just only change size state for chart and do not resize the container/canvas.
fn draw_axes_and_grid(&self, ctx: &C)
[src]
Draws the axes and the grid.
fn update_channel(&self, _: usize)
[src]
Updates the channel at index [index]. If [index] is null
, updates all
channel.
fn draw_frame(&self, ctx: &C, time: Option<i64>)
[src]
Draws the current animation frame.
If [time] is null
, draws the last frame (i.e. no animation).
fn draw_channels(&self, ctx: &C, percent: f64) -> bool
[src]
Draws the channel given the current animation percent [percent].
If this method returns false
, the animation is continued until [percent]
reaches 1.0.
If this method returns true
, the animation is stopped immediately.
This is useful as there are cases where no animation is expected.
In those cases, the overriding method will return true
to stop the
animation.
fn create_entity(
&self,
channel_index: usize,
entity_index: usize,
value: Option<D>,
color: Fill,
highlight_color: Fill
) -> E
[src]
&self,
channel_index: usize,
entity_index: usize,
value: Option<D>,
color: Fill,
highlight_color: Fill
) -> E
fn create_entities(
&self,
channel_index: usize,
start: usize,
end: usize,
color: Fill,
highlight: Fill
) -> Vec<E>
[src]
&self,
channel_index: usize,
start: usize,
end: usize,
color: Fill,
highlight: Fill
) -> Vec<E>
fn create_channels(&self, start: usize, end: usize)
[src]
fn get_tooltip_position(
&self,
tooltip_width: f64,
tooltip_height: f64
) -> Point<f64>
[src]
&self,
tooltip_width: f64,
tooltip_height: f64
) -> Point<f64>
Auto Trait Implementations
impl<C, E, M, D, O> !RefUnwindSafe for BaseChart<C, E, M, D, O>
impl<C, E, M, D, O> !RefUnwindSafe for BaseChart<C, E, M, D, O>
impl<C, E, M, D, O> Send for BaseChart<C, E, M, D, O> where
C: Send,
D: Send,
E: Send,
M: Send,
O: Send,
impl<C, E, M, D, O> Send for BaseChart<C, E, M, D, O> where
C: Send,
D: Send,
E: Send,
M: Send,
O: Send,
impl<C, E, M, D, O> Unpin for BaseChart<C, E, M, D, O> where
C: Unpin,
D: Unpin,
E: Unpin,
M: Unpin,
O: Unpin,
impl<C, E, M, D, O> Unpin for BaseChart<C, E, M, D, O> where
C: Unpin,
D: Unpin,
E: Unpin,
M: Unpin,
O: Unpin,
impl<C, E, M, D, O> UnwindSafe for BaseChart<C, E, M, D, O> where
C: UnwindSafe,
D: UnwindSafe,
E: UnwindSafe,
M: UnwindSafe,
O: UnwindSafe,
impl<C, E, M, D, O> UnwindSafe for BaseChart<C, E, M, D, O> where
C: UnwindSafe,
D: UnwindSafe,
E: UnwindSafe,
M: UnwindSafe,
O: UnwindSafe,
Blanket Implementations
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
pub fn into_color(self) -> To
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,