Wrong number precision in horizontal chart legend
See original GitHub issueHey 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());
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:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
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!
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!!