I’m trying to use the UnitPicker in @grafana/ui in my plugin but this component’s value is just a string.
Is there an exported function to format data by giving the chosen unit ? Or do I have to develop a formatter by myself ?
Because in panels like gauges or graph, choosing a unit will format the value displayed. For example, if you set the unit to Watt, if the value displayed is 1700, it will format it to “1.7 KW”
If you’d like to format values from the resulting data frame, you can use the display formatter on the field you want to display. For more information, check out the documentation on how to Display values from a data frame.
If you’d like to use it elsewhere, you might want to check out some of the value format helper functions.