Mustansir-06 commented on PR #21460:
URL: https://github.com/apache/echarts/pull/21460#issuecomment-3728838822
Thank you for the demo and the feedback @plainheart!
I agree that defining individual formatters works well for a few series.
However, the motivation for this PR is to support generic, reusable formatting
functions.
If a developer has many series (or a dynamic number of series), they
currently have to define a new function for each one to include the series
name. By passing the name as a third parameter, a single formatter can be
written to handle multiple series dynamically:
// With this PR, one function can handle multiple units dynamically
const myGenericFormatter = (value, index, name) => {
const unitMap = { 'Email': ' unit1', 'Union Ads': ' unit2' };
return value + (unitMap[name] || '');
};
This brings valueFormatter in line with other ECharts formatters that
already provide the name context. What are your thoughts on supporting this
more dynamic approach?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]