Closed
Description
Add support for text templates in shape labels.
Add a text template property to shape.label
, with support for displaying variables which are updated automatically based on the shape's properties -- for example, the x/y coordinates of a rectangle or the slope of a line.
This feature depends on #6454 (Support adding text labels to lines and shapes).
Proposed API
- Add a
shape.label.texttemplate
property - Template string format identical to
hovertemplate
/texttemplate
, where variables can be included in the string using the syntax%{variable}
.- Number format can be specified using d3-format's syntax
- A limited number of variables are supported, including at least:
- Shape properties
x0
,x1
,y0
,y1
- Calculated value
slope
- Possibility to include other variables
- Shape properties
- Displayed text is updated in real time as values change, including during drag
Partnership
Development of this feature is sponsored by Volkswagen's Center of Excellence for Battery Systems.