|
|
@ -55,7 +55,14 @@ class Bar extends Component { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
const { height, title, forceFit = true, data, color = 'rgba(24, 144, 255, 0.85)', padding } = this.props; |
|
|
const { |
|
|
|
|
|
height, |
|
|
|
|
|
title, |
|
|
|
|
|
forceFit = true, |
|
|
|
|
|
data, |
|
|
|
|
|
color = 'rgba(24, 144, 255, 0.85)', |
|
|
|
|
|
padding, |
|
|
|
|
|
} = this.props; |
|
|
|
|
|
|
|
|
const { autoHideXLabels } = this.state; |
|
|
const { autoHideXLabels } = this.state; |
|
|
|
|
|
|
|
|
@ -79,16 +86,21 @@ class Bar extends Component { |
|
|
return ( |
|
|
return ( |
|
|
<div className={styles.chart} style={{ height }} ref={this.handleRoot}> |
|
|
<div className={styles.chart} style={{ height }} ref={this.handleRoot}> |
|
|
<div ref={this.handleRef}> |
|
|
<div ref={this.handleRef}> |
|
|
{title && <h4>{title}</h4>} |
|
|
{title && <h4 style={{ marginBottom: 20 }}>{title}</h4>} |
|
|
<Chart |
|
|
<Chart |
|
|
scale={scale} |
|
|
scale={scale} |
|
|
height={height} |
|
|
height={title ? height - 41 : height} |
|
|
forceFit={forceFit} |
|
|
forceFit={forceFit} |
|
|
data={data} |
|
|
data={data} |
|
|
padding={padding || 'auto'} |
|
|
padding={padding || 'auto'} |
|
|
> |
|
|
> |
|
|
<Axis name="x" title={false} label={!autoHideXLabels} tickLine={!autoHideXLabels} /> |
|
|
<Axis |
|
|
<Axis name="y" title={false} line={false} tickLine={false} min={0} /> |
|
|
name="x" |
|
|
|
|
|
title={false} |
|
|
|
|
|
label={autoHideXLabels ? false : {}} |
|
|
|
|
|
tickLine={autoHideXLabels ? false : {}} |
|
|
|
|
|
/> |
|
|
|
|
|
<Axis name="y" min={0} /> |
|
|
<Tooltip showTitle={false} crosshairs={false} /> |
|
|
<Tooltip showTitle={false} crosshairs={false} /> |
|
|
<Geom type="interval" position="x*y" color={color} tooltip={tooltip} /> |
|
|
<Geom type="interval" position="x*y" color={color} tooltip={tooltip} /> |
|
|
</Chart> |
|
|
</Chart> |
|
|
|