Skip to content

Commit

Permalink
Pad series text to be same length as x axis (re getredash#391) (getre…
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Short authored May 3, 2018
1 parent 7a2a3f2 commit fc5437f
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions client/app/visualizations/chart/plotly/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,17 +395,22 @@ export function prepareLayout(element, seriesList, options, data) {
function updateSeriesText(seriesList, options) {
each(seriesList, (series) => {
series.text = [];
series.sourceData.forEach((item) => {
let text = formatNumber(item.y);
if (item.yError !== undefined) {
text = `${text} \u00B1 ${formatNumber(item.yError)}`;
}
series.x.forEach((xvalue) => {
const item = series.sourceData.get(xvalue);
if (item !== undefined) {
let text = formatNumber(item.y);
if (item.yError !== undefined) {
text = `${text} \u00B1 ${formatNumber(item.yError)}`;
}

if (options.series.percentValues) {
text = `${formatPercent(Math.abs(item.yPercent))}% (${text})`;
}
if (options.series.percentValues) {
text = `${formatPercent(Math.abs(item.yPercent))}% (${text})`;
}

series.text.push(text);
series.text.push(text);
} else {
series.text.push(null);
}
});
});
return seriesList;
Expand Down

0 comments on commit fc5437f

Please sign in to comment.