MCPcopy Create free account
hub / github.com/angular-rust/ux-charts / create_entity

Method create_entity

src/bar.rs:962–1011  ·  view source on GitHub ↗
(
        &self,
        channel_index: usize,
        entity_index: usize,
        value: Option<D>,
        color: Color,
        highlight_color: Color,
    )

Source from the content-addressed store, hash-verified

960 }
961
962 fn create_entity(
963 &self,
964 channel_index: usize,
965 entity_index: usize,
966 value: Option<D>,
967 color: Color,
968 highlight_color: Color,
969 ) -> BarEntity<D> {
970 let props = self.props.borrow();
971 let baseprops = self.base.props.borrow();
972 let channels = self.base.channels.borrow();
973
974 let left = self.get_bar_left(channel_index, entity_index) + props.xlabel_hop / 2.;
975 let old_left = left;
976 let height = self.value_to_bar_height(value);
977
978 // Animate width.
979 let mut old_height = height;
980 let mut old_width = 0.;
981
982 if channels.len() == 0 {
983 // Data table changed. Animate height.
984 old_height = 0.;
985 old_width = props.bar_width;
986 }
987
988 let formatted_value = match value {
989 Some(value) => match baseprops.entity_value_formatter {
990 Some(formatter) => formatter(value.into()),
991 None => default_value_formatter(value.into()),
992 },
993 None => "".into(),
994 };
995
996 BarEntity {
997 index: entity_index,
998 old_value: None,
999 value,
1000 formatted_value,
1001 color,
1002 highlight_color,
1003 bottom: props.xaxis_top,
1004 old_left,
1005 left,
1006 old_height,
1007 height,
1008 old_width,
1009 width: props.bar_width,
1010 }
1011 }
1012
1013 fn create_channels(&self, start: usize, end: usize) {
1014 let mut start = start;

Callers 1

create_entitiesMethod · 0.45

Calls 3

default_value_formatterFunction · 0.85
get_bar_leftMethod · 0.80
value_to_bar_heightMethod · 0.80

Tested by

no test coverage detected