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

Method get_tooltip_position

src/line.rs:1254–1271  ·  view source on GitHub ↗
(&self, tooltip_width: f64, tooltip_height: f64)

Source from the content-addressed store, hash-verified

1252 }
1253
1254 fn get_tooltip_position(&self, tooltip_width: f64, tooltip_height: f64) -> Point<f64> {
1255 let props = self.props.borrow();
1256 let focused_entity_index = self.base.props.borrow().focused_entity_index as usize;
1257
1258 let mut x = self.xlabel_x(focused_entity_index) + props.tooltip_offset;
1259 let y = f64::max(
1260 props.xaxis_top - props.yaxis_length,
1261 props.average_y_values[focused_entity_index] - (tooltip_height / 2.).trunc(),
1262 );
1263
1264 let width = self.base.props.borrow().width;
1265 if x + tooltip_width > width {
1266 x -= tooltip_width + 2. * props.tooltip_offset;
1267 x = x.max(props.yaxis_left);
1268 }
1269
1270 Point::new(x, y)
1271 }
1272}

Callers

nothing calls this directly

Calls 1

xlabel_xMethod · 0.45

Tested by

no test coverage detected