3

Hi everybody i'm working with iOS Charts iOS Charts danielgindi

here i'm struggling to add a title / units for x & y axis values. help me enter image description here

in this image in Yaxis having the title / unit like Power(bhp) & torque(ib-ft) like this iaso want to implement in both x & y Axis

Test iOS
  • 175
  • 2
  • 13

1 Answers1

-3

You can add constraints to your graph in storyboard, e.g. make the chartview be 0.9 of width and height and center vertically and horizontally.

Label 1 Add it on the right side of the graph and these constraints:

a. align center y to superview

b. trailing space to superview as 0

c. leading space to graph as 0

Label 2 Add it on the left side of the graph and these constraints:

a. align center y to superview

b. leading space to superview as 0

c. trailing space to graph as 0

In code for these 2 labels this has to be added:

label.transform=CGAffineTransformMakeRotation( ( M_PI ) / 2 );
label2.transform=CGAffineTransformMakeRotation( ( M_PI ) / 2 );

Label 3 Add it at the bottom and these constraints:

a. align center x to superview

b. bottom space to superview as 0

c. top space to graph as 0

Result:

enter image description here

DevB2F
  • 4,674
  • 4
  • 36
  • 60