elastic-charts
                                
                                
                                
                                    elastic-charts copied to clipboard
                            
                            
                            
                        Performance: Formatter is called for each data point in bar chart even if not used
Describe the issue In https://github.com/elastic/elastic-charts/blob/master/packages/charts/src/chart_types/xy_chart/rendering/bars.ts#L92 the provided formatter is called for each data point in the series, but it's only used in special circumstances:
https://github.com/elastic/elastic-charts/blob/master/packages/charts/src/chart_types/xy_chart/rendering/bars.ts#L96
In case of charts with lots of series and slow formatting functions provided this can have a noticable performance impact.
E.g. in the following chart it's spending 44ms in getConvertedValue (out of ~360ms total blocking rendering time):

To Reproduce Configure a bar chart without labels on the bars and observe the provided formatter being called.
Expected behaviour Formatter should only be called if necessary to render the chart correctly
Thanks Joe, yep, this can definitely be improved a lot We can probably also call the value formatting only when showing the tooltip, without having a precomputed value saved