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

Commit 5f12ec5

Browse files
superandrew213marzolfb
authored andcommitted
Add rotation bar chart label (#144)
1 parent e73a7c5 commit 5f12ec5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Bar.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export default class BarChart extends Component {
5151
fontFamily: 'Arial',
5252
fontSize: 14,
5353
bold: true,
54-
color: '#34495E'
54+
color: '#34495E',
55+
rotate: 45,
5556
}
5657
},
5758
axisY: {
@@ -134,7 +135,7 @@ export default class BarChart extends Component {
134135
{options.axisX.showLabels ?
135136
<Text fontFamily={textStyle.fontFamily}
136137
fontSize={textStyle.fontSize} fontWeight={textStyle.fontWeight} fontStyle={textStyle.fontStyle}
137-
fill={textStyle.fill} x={c.line.centroid[0]} y={labelOffset + chartArea.y.min} rotate={45} textAnchor="middle">
138+
fill={textStyle.fill} x={c.line.centroid[0]} y={labelOffset + chartArea.y.min} rotate={textStyle.rotate} textAnchor="middle">
138139
{c.item.name}
139140
</Text>
140141
: null}

src/util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const fontAdapt = (fontProps) => {
4545
return {
4646
fontFamily: fontProps.fontFamily,
4747
fontSize: fontProps.fontSize,
48+
rotate: fontProps.rotate || 0,
4849
fontWeight: fontProps.fontWeight ? 'bold' : 'normal',
4950
fontStyle: fontProps.fontStyle ? 'italic' : 'normal' ,
5051
fill: fill

0 commit comments

Comments
 (0)