Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
feat(label): bar chart x axis size
Browse files Browse the repository at this point in the history
adds prop to customize x axis font size
  • Loading branch information
eddier committed Mar 23, 2017
1 parent 885c9b2 commit 77cbd5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/components/charts/BarChart/BarChart.examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Standard Area AreaChart
xDataType='date'
showIcon
showXLabel
XLabelFontSize='12'
tooltipTitle='OPERATIONS'
/>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/components/charts/BarChart/BarChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class BarChart extends React.Component {
xDataType={xDataType}
showXLabel={showXLabel}
showIcon={showIcon}
XLabelFontSize={this.props.XLabelFontSize}
/>
<ToolTip tooltip={this.state.tooltip} yScale={yScale} />
</g>
Expand All @@ -108,7 +109,8 @@ BarChart.propTypes = {
xDataType: string,
showXLabel: bool,
showIcon: bool,
tooltipTitle: string
tooltipTitle: string,
XLabelFontSize: string
}

BarChart.defaultProps = {
Expand All @@ -120,7 +122,8 @@ BarChart.defaultProps = {
xDataType: 'month',
showXLabel: false,
showIcon: false,
tooltipTitle: ''
tooltipTitle: '',
XLabelFontSize: '16'
}

export default BarChart
8 changes: 5 additions & 3 deletions src/components/charts/BarChart/Rect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Rect = (props) => {
/>
: '' }
{ (props.showXLabel)
? <text x={(xScale(d.x)) + (xScale.bandwidth() / 2)} key={`${i}-t`} width={xScale.bandwidth()} y={innerHeight + 13} fill={palette.grey} textAnchor='middle'>
? <text fontSize={props.XLabelFontSize} x={(xScale(d.x)) + (xScale.bandwidth() / 2)} key={`${i}-t`} width={xScale.bandwidth()} y={innerHeight + 13} fill={palette.grey} textAnchor='middle'>
{xDateLabel}
</text>
: '' }
Expand All @@ -88,14 +88,16 @@ Rect.propTypes = {
xScale: func.isRequired,
yScale: func.isRequired,
showXLabel: React.PropTypes.bool,
showIcon: React.PropTypes.bool
showIcon: React.PropTypes.bool,
XLabelFontSize: string
}

Rect.defaultProps = {
borderRadius: 3,
fill: palette.blue,
showXLabel: false,
showIcon: false
showIcon: false,
XLabelFontSize: '16'
}

export default Rect

0 comments on commit 77cbd5b

Please sign in to comment.