question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing Label formatter control of the single variables format

See original GitHub issue

What problem does this feature solve?

The current interface to control labels within the charts is giving the user the possibility to define what content to display and in which order to print, however it is missing the possibility (or it’s not that clear) to set a specific format for the variables.

So imagine the chart displays a series of labels (e.g. AVG, MIN, MAX) see the screenshot: Screenshot 2020-06-03 at 14 19 00

the markPoint set up has a custom formatter which is:

 markPoint: {
                label: {
                    formatter: '{b}\n{c}',
                 }

However I would like to be able to control the value {c} in order to display consistent decimal places (e.g. 0.00)

Ref. from documentation.


String template

Model variation includes:

{a}: series name.
{b}: the name of a data item.
{c}: the value of a data item.
{@xxx}: the value of a dimension named'xxx', for example,{@product}refers the value of'product'` dimension.
{@[n]}: the value of a dimension at the index ofn, for example,{@[3]}` refers the value at dimensions[3].

What does the proposed API look like?

I would imagine something within the brackets to control the single value. e.g. {c:0.0} where 0.0 could be a series of supported format code, perhaps using the Excel format code convention (https://support.microsoft.com/en-gb/office/number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68?ui=en-us&rs=en-gb&ad=gb) so the developer is able to control numbers and dates

e.g. {c:0.00} where 0.00 is the number format (a number with 2 decimal places).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
dvagocommented, Jun 12, 2020

@Ovilia I found a third different the argument type in the main tooltip attribute, just to let you know (https://echarts.apache.org/en/option.html#series-line.tooltip)

In this case the formatter comes out as an array with an object and you cant use \n but you can plug html tags in it.

tooltip: {
          formatter: (params) => {
            return `${params[0].name}<br />${params[0].marker}${params[0].data.toFixed(2)}`
          },
 },```
2reactions
Oviliacommented, Jun 12, 2020

We are considering providing pipes like formatter: "{b}\n{c | fixed(2)}" and provide some utility functions. But we haven’t reached solid conclusions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing Label formatter control of the single variables format
What problem does this feature solve? The current interface to control labels within the charts is giving the user the possibility to define ......
Read more >
subject:"\[GitHub\] \[incubator\-echarts\] Ovilia ... - The Mail Archive
[GitHub] [incubator-echarts] Ovilia commented on issue #12749: Missing Label formatter control of the single variables format · 2020-06-12 Thread GitBox.
Read more >
PROC TABULATE - Building Tables With Style - Lex Jansen
FORMAT = specifies a format for table cells. MISSING includes missing values in the table. ORDER= determines the order for values of class...
Read more >
100% Control of Data Labels in Power BI - YouTube
This lets you control what values get displayed on your labels and when ... Appling formatting string to the labels 08:32 Customizing labels...
Read more >
Format Fields and Field Labels - Tableau Help
To format a specific field label: Right-click (control-click on Mac) the field label in the view and select Format. In the Format pane,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found