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.

Wrong number precision in horizontal chart legend

See original GitHub issue

Hey there, In horizontal chart legend, the quantity number precision is changed (i.e. integer numbers are displayed as float). I would expect that quantity is displayed as it is specified in datum object

Expected Behavior

Quantity displayed in chart legend should be displayed as it is specified in the datum object. As an alternative we should be able to override the default number formatter in legend object (which is currently hardcoded d3Format.format('s'))

Current Behavior

Quantity in the datum object are displayed with a different precision than specified (e.g. 4 is displayed 4.00000)

Possible Solution

Steps to Reproduce (for bugs)

import Legend from 'britecharts/src/charts/legend'
import {select} from 'd3-selection';

...

var data = [
            {
                name: 'On time',
                quantity: '4'
            },
            {
                name: 'Late',
                quantity: '3',
            }
        ];

select('.my-chart-legend').datum(data).call(new Legend());

capture d ecran 2017-06-28 a 17 59 22

Context

We would like to use brightchart to display a donut with late and on time tasks but we don’t want the legend to display 4.000000 on track tasks. Sadly this is blocking for us to use brightchart in our app

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
Golodhroscommented, Jun 29, 2017

Hi @cpuy, thanks for opening an issue!

You are right on the analysis and we should definitely have an accessor for the number format. We will try to tackle it soon!

1reaction
Golodhroscommented, Jul 4, 2017

Totally, let’s go with the first option. The second is fine, but it would require the user to also require the D3 format submodule.

Thanks a lot!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Excel 2013 legend entries in wrong order on stacked column ...
When you created your vertically stacked column chart, the legend appeared, by default, in a horizontal display at the bottom, beneath the X- ......
Read more >
Add a legend, gridlines, and other markings in Numbers on Mac
In Numbers on your Mac, add a legend, a caption, gridlines, trendlines, error bars, reference lines, labels, and other markings to a chart....
Read more >
Skip decimal points on y-axis in chartJS - Stack Overflow
Is there a way that I can restrict it to only have numbers? This is my code var matches = $("#matches").get(0).
Read more >
Horizontal date axis incorrect on Excel line chart with ...
To check, in the Select Data Source dialogue for your chart, click on series 1 in the legend Entries (Series) on the left...
Read more >
How to Change Elements of a Chart like Title, Axis ... - YouTube
You can change the Chart Title, Axis titles of horizontal and vertical ... of chart, display grid lines, change legend, display error bars, ......
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