Use custom function for number formatting
This commit is contained in:
@@ -209,7 +209,7 @@ var Bar = React.createClass({
|
||||
calculateLabelPosition: function() {
|
||||
var val = this.props.value,
|
||||
offset = this.props.offset,
|
||||
label = this.props.item + ': ' + numberFormat(val),
|
||||
label = this.props.item + ': ' + formatNumber(val),
|
||||
labelWidth = textWidth(label),
|
||||
labelOffsetWidth = labelWidth + 2*this.labelPaddingH,
|
||||
labelX;
|
||||
@@ -247,7 +247,7 @@ var Bar = React.createClass({
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var label = this.props.item ? (this.props.item + ': ' + numberFormat(this.props.value)) : '',
|
||||
var label = this.props.item ? (this.props.item + ': ' + formatNumber(this.props.value)) : '',
|
||||
labelWidth = textWidth(label),
|
||||
labelOuterWidth = (labelWidth == 0 ? 0 : labelWidth + 2*this.labelPaddingH),
|
||||
barX = (this.state.lastBarX && this.state.lastBarX !== this.props.x
|
||||
|
||||
@@ -9,11 +9,6 @@ var SVGChartMixin = {
|
||||
var fontFamily = 'Helvetica Neue, Helvetica, sans-serif',
|
||||
fontSize = 16;
|
||||
|
||||
function numberFormat(num) {
|
||||
// FIXME: Not supported in IE10- and Safari
|
||||
return Intl.NumberFormat().format(num);
|
||||
}
|
||||
|
||||
function textWidth(str) {
|
||||
var svg = document.createElementNS('http://www.w3.org/2000/svg', "svg");
|
||||
text = document.createElementNS('http://www.w3.org/2000/svg', "text");
|
||||
|
||||
@@ -179,7 +179,7 @@ var StackedAreaChart = React.createClass({
|
||||
return (
|
||||
<StackedArea key={'area-'+ i}
|
||||
item={item} i={i}
|
||||
d={roundPathCorners(this.buildPathD(path), 4)}
|
||||
d={roundPathCorners(this.buildPathD(path), 3)}
|
||||
color={Colors[i]}
|
||||
onMouseOver={this.handleFocusIn.bind(this, i)} />
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user