data = _.sortBy(data, d => -d.x);
- let yTicks = data.map(d => collapsePath(d.value, 20));
+ let yTicks = data.map(d => {
+ return {
+ label: collapsePath(d.value, 20),
+ tooltip: d.value
+ };
+ });
let yValues = data.map(d => formatMeasure(d.x, 'SHORT_INT'));
return null;
}
let ticks = this.props.yTicks.map((tick, index) => {
- let point = this.props.data[index];
- let x = xScale.range()[0];
- let y = Math.round(yScale(point.y) + yScale.rangeBand() / 2 + this.props.barsHeight / 2);
- return <text key={index}
- className="bar-chart-tick histogram-tick"
- onClick={this.props.onBarClick && this.handleClick.bind(this, point)}
- style={{ cursor: this.props.onBarClick ? 'pointer' : 'default' }}
- x={x}
- y={y}
- dx="-1em"
- dy="0.3em">{tick}</text>;
+ const point = this.props.data[index];
+ const x = xScale.range()[0];
+ const y = Math.round(yScale(point.y) + yScale.rangeBand() / 2 + this.props.barsHeight / 2);
+ const label = tick.label ? tick.label : tick;
+ const tooltip = tick.tooltip ? tick.tooltip : null;
+ return <text
+ key={index}
+ className="bar-chart-tick histogram-tick"
+ onClick={this.props.onBarClick && this.handleClick.bind(this, point)}
+ style={{ cursor: this.props.onBarClick ? 'pointer' : 'default' }}
+ data-title={tooltip}
+ data-toggle={tooltip ? 'tooltip' : null}
+ x={x}
+ y={y}
+ dx="-1em"
+ dy="0.3em">
+ {label}
+ </text>;
});
return <g>{ticks}</g>;
},