MarcusCalidus / marcuscalidus-svg-panel

Grafana panel for displaying metric sensitive SVG images using the snap svg library
MIT License
63 stars 28 forks source link

feat: format value with specified formatter #29

Closed adrien-f closed 5 years ago

adrien-f commented 5 years ago

Greetings !

I noticed while using the plugin that I could not format manually values to a certain format. This PR adds the formatValueWithFormatter function that accepts a format :smile:

Let me know what you think of it !

MarcusCalidus commented 5 years ago

Hi Adrien,

sounds nice - thank you. I'd like to merge. Could you please post an example to the PR comments how to use it. This way I can refer in upcoming questions ;-)

adrien-f commented 5 years ago

Sure ! It looks like this:

$(svgnode).find("#thanos-sidecar-latency").text(ctrl.formatValueWithFormatter(ctrl.tables[5].rows[0]["Value #E"], "s"));

Where s is taken from the list of all value formatters

MarcusCalidus commented 5 years ago

Now I get it... It's already too late here :-) Thank you for your support.