Skip to content

Commit c7aefae

Browse files
authored
Merge pull request #8139 from ORITOMI/fix-funnel-percent-total-label
Fix funnel percentTotal text formatting
2 parents c31fee7 + 6458372 commit c7aefae

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎draftlogs/8139_fix.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix funnel `percentTotal` text formatting to display formatted percentages instead of raw ratios [[#8139](https://github.com/plotly/plotly.js/pull/8139)], with thanks to @ORITOMI for the contribution!

‎src/traces/bar/plot.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
11071107
obj.percentPrevious = cdi.difR;
11081108
obj.percentPreviousLabel = Lib.formatPercent(cdi.difR);
11091109
obj.percentTotal = cdi.sumR;
1110-
obj.percenTotalLabel = Lib.formatPercent(cdi.sumR);
1110+
obj.percentTotalLabel = Lib.formatPercent(cdi.sumR);
11111111
}
11121112

11131113
var customdata = Lib.castOption(trace, cdi.i, 'customdata');

‎test/jasmine/tests/funnel_test.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,7 @@ describe('A funnel plot', function() {
12711271
textinfo: 'value+percent initial+percent previous+percent total',
12721272
}], 'text.bartext', [
12731273
['txt: %{value}', ['txt: 3', 'txt: 2', 'txt: 1']],
1274+
['%{percentTotal}', ['50%', '33%', '17%']],
12741275
['%{value}-%{percentInitial}-%{percentPrevious}-%{percentTotal:0.3f}', ['3-100%-100%-0.500', '2-67%-67%-0.333', '1-33%-50%-0.167']]
12751276
]);
12761277
});

0 commit comments

Comments
 (0)