in viz-lib/src/visualizations/chart/plotly/updateData.js [51:95]
function updateSeriesText(seriesList, options) {
const formatNumber = createNumberFormatter(options.numberFormat);
const formatPercent = createNumberFormatter(options.percentFormat);
const formatText = createTextFormatter(options);
const defaultY = options.missingValuesAsZero ? 0.0 : null;
each(seriesList, series => {
const seriesOptions = options.seriesOptions[series.name] || { type: options.globalSeriesType };
series.text = [];
series.hover = [];
const xValues = options.globalSeriesType === "pie" ? series.labels : series.x;
xValues.forEach(x => {
const text = {
"@@name": series.name,
};
const item = series.sourceData.get(x) || { x, y: defaultY, row: { x, y: defaultY } };
const yValueIsAny = includes(["bubble", "scatter"], seriesOptions.type);
// for `formatValue` we have to use original value of `x` and `y`: `item.x`/`item.y` contains value
// already processed with `normalizeValue`, and if they were `moment` instances - they are formatted
// using default (ISO) date/time format. Here we need to use custom date/time format, so we pass original value
// to `formatValue` which will call `normalizeValue` again, but this time with different date/time format
// (if needed)
text["@@x"] = formatValue(item.row.x, "x", options);
text["@@y"] = yValueIsAny ? formatValue(item.row.y, series.yaxis, options) : formatNumber(item.y);
if (item.yError !== undefined) {
text["@@yError"] = formatNumber(item.yError);
}
if (item.size !== undefined) {
text["@@size"] = formatNumber(item.size);
}
if (options.series.percentValues || options.globalSeriesType === "pie") {
text["@@yPercent"] = formatPercent(Math.abs(item.yPercent));
}
extend(text, item.row.$raw);
series.text.push(formatText(text));
});
});
}