Victory-native: Cannot rotate axis label.

Created on 25 Jul 2017  路  4Comments  路  Source: FormidableLabs/victory-native

Hi everyone,

I am trying to rotate an axis label using style={{axisLabel: {angle: 90}}} on victory-axis but it is not rotating. I also tried using axisLabelComponent={<VictoryLabel angle={90}/>} without success.

Thanks!

Most helpful comment

Is it possible to set the anchor of the rotation or move the labels somehow, such that after being rotated their center or start aligns with the data point's center? I tried with properties like paddingLeft or marginLeft but they don't have any effect.

See image. I'd like that the center of the left side of the labels aligns with the bar's center. Currently if you look at the Oct bar for example, it's difficult to see if it belongs to October or November.

screen shot 2019-01-29 at 15 34 46

All 4 comments

Hello!

Specify the angle in the axisLabel object within the style like so.

<VictoryAxis label="Label" style={{ axisLabel: {fontSize: 20, padding: 30, angle: 90}, tickLabels: {fontSize: 15, padding: 5, angle 90} }} />
rotatedlabel

Hi!
Thank you for your answer,
I think that's what I already had. Unless I have a vision problem hahaha.
untitled

@ericschaal unfortunately this is an issue in react-native-svg that we haven't figured out how to deal with yet. I'm going to close this issue as a duplicate of https://github.com/FormidableLabs/victory-native/issues/103

Is it possible to set the anchor of the rotation or move the labels somehow, such that after being rotated their center or start aligns with the data point's center? I tried with properties like paddingLeft or marginLeft but they don't have any effect.

See image. I'd like that the center of the left side of the labels aligns with the bar's center. Currently if you look at the Oct bar for example, it's difficult to see if it belongs to October or November.

screen shot 2019-01-29 at 15 34 46

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isabel-thx picture isabel-thx  路  5Comments

aszheng picture aszheng  路  5Comments

jlo1 picture jlo1  路  3Comments

JeremyBradshaw7 picture JeremyBradshaw7  路  4Comments

xinhash picture xinhash  路  4Comments