Canvas conditional text

Hello

I've been working with conditional formatting of metrics. But I would like also to conditional show an up or down arrow according to the sign of variation.

Is that possible?

Thank you

Hugo

1 Like

Hi @Hugo_Pires

I think it won't be possible to add an arrow as part of metricFormatter.
for metricFormatter numeral-js lib is used https://github.com/elastic/numeral-js and looks like it doesn't allow to add static text into formatting.

Possible workaround is to add a text visualization next to your metric visualization that would just display correct arrow. Text visualization should be backed up by the same data source and then you could conditionally render arrow. That part of the expression would look something like this:

| markdown {switch case={case if={gt 0} then="⬆️"} default="⬇️"} 

You could also try to replace metric visualization with text visualization completely.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.