Skip to content

Commit

Permalink
update dist and lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaming743 committed Jun 16, 2020
1 parent 1342926 commit 0862955
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions dist/charts.map.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/charts.min.js

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions lib/extend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ var numberText = {
number: [],
content: '',
position: [0, 0],
toFixed: 0
toFixed: 0,
rowGap: 0,
formatter: null
},
validator: function validator(_ref7) {
var shape = _ref7.shape;
Expand All @@ -167,14 +169,18 @@ var numberText = {
var number = shape.number,
content = shape.content,
toFixed = shape.toFixed,
rowGap = shape.rowGap;
rowGap = shape.rowGap,
formatter = shape.formatter;
var textSegments = content.split('{nt}');
var lastSegmentIndex = textSegments.length - 1;
var textString = '';
textSegments.forEach(function (t, i) {
var currentNumber = number[i];
if (i === lastSegmentIndex) currentNumber = '';
if (typeof currentNumber === 'number') currentNumber = currentNumber.toFixed(toFixed);
var currentNumber = number[i] || '';

if (typeof currentNumber === 'number') {
currentNumber = currentNumber.toFixed(toFixed);
if (typeof formatter === 'function') currentNumber = formatter(currentNumber);
}

textString += t + (currentNumber || '');
});

Expand All @@ -183,7 +189,7 @@ var numberText = {
}, {
shape: _objectSpread({}, shape, {
content: textString,
rowGap: rowGap || 0
rowGap: rowGap
})
});
}
Expand Down

0 comments on commit 0862955

Please sign in to comment.