@lobehub/charts
Version:
React modern charts components built on recharts
9 lines • 412 B
JavaScript
import { sumNumericArray } from "../utils";
var calculateDefaultLabel = function calculateDefaultLabel(data, category) {
return sumNumericArray(data.map(function (dataPoint) {
return dataPoint[category];
}));
};
export var parseLabelInput = function parseLabelInput(labelInput, valueFormatter, data, category) {
return labelInput ? labelInput : valueFormatter(calculateDefaultLabel(data, category));
};