Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

Commit

Permalink
Add rotation bar chart label (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
superandrew213 authored and marzolfb committed May 3, 2017
1 parent e73a7c5 commit 5f12ec5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export default class BarChart extends Component {
fontFamily: 'Arial',
fontSize: 14,
bold: true,
color: '#34495E'
color: '#34495E',
rotate: 45,
}
},
axisY: {
Expand Down Expand Up @@ -134,7 +135,7 @@ export default class BarChart extends Component {
{options.axisX.showLabels ?
<Text fontFamily={textStyle.fontFamily}
fontSize={textStyle.fontSize} fontWeight={textStyle.fontWeight} fontStyle={textStyle.fontStyle}
fill={textStyle.fill} x={c.line.centroid[0]} y={labelOffset + chartArea.y.min} rotate={45} textAnchor="middle">
fill={textStyle.fill} x={c.line.centroid[0]} y={labelOffset + chartArea.y.min} rotate={textStyle.rotate} textAnchor="middle">
{c.item.name}
</Text>
: null}
Expand Down
1 change: 1 addition & 0 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const fontAdapt = (fontProps) => {
return {
fontFamily: fontProps.fontFamily,
fontSize: fontProps.fontSize,
rotate: fontProps.rotate || 0,
fontWeight: fontProps.fontWeight ? 'bold' : 'normal',
fontStyle: fontProps.fontStyle ? 'italic' : 'normal' ,
fill: fill
Expand Down

0 comments on commit 5f12ec5

Please sign in to comment.