1
0
Fork 0

Dynamic SAC dot radius

This commit is contained in:
Gregory Eremin 2015-03-19 15:49:04 +07:00
parent d0d84e6437
commit 4caf20ca25
1 changed files with 10 additions and 3 deletions

View File

@ -1,8 +1,6 @@
var Dot = React.createClass({ var Dot = React.createClass({
mixins: [ChartAnimationMixin], mixins: [ChartAnimationMixin],
radius: 10,
getInitialState: function() { getInitialState: function() {
return {}; return {};
}, },
@ -19,12 +17,21 @@ var Dot = React.createClass({
}, },
render: function() { render: function() {
var radius,
val = ''+ this.props.value;
if (val.length === 1) {
radius = 8;
} else if (val.length === 2) {
radius = 9;
} else {
radius = 11;
}
return ( return (
<g className={'dot dot-'+ this.props.i} onMouseOver={this.props.onMouseOver}> <g className={'dot dot-'+ this.props.i} onMouseOver={this.props.onMouseOver}>
<circle ref="dot" <circle ref="dot"
cx={this.props.x} cx={this.props.x}
cy={this.state.lastY || this.props.y} cy={this.state.lastY || this.props.y}
r={this.radius} /> r={radius} />
<text ref="value" <text ref="value"
x={this.props.x} x={this.props.x}
y={this.props.y+4}> y={this.props.y+4}>