title: Swift 3 - Set X-Y axis UILabel per device
body: <p>I've label and I given values of X-Y axis, but my values didn't put label on the center per device, and I wrote method of width size if device is big set width size 50 else smaller but this method not working in iPhone SE, 5S/5, 6/6s/7 just working with iPhone 6+/6S+/7+!! For example like this</p>
  
  <p><a href="https://i.stack.imgur.com/ZffAm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZffAm.png" alt="enter image description here"></a></p>
  
  <p>So what's wrong and what additions should I add ??</p>
  
  <pre><code>let lengthOfChar : CGFloat = data.ans.length // Characters form SQLite database
  let yAxis : CGFloat = self.view.frame.height / 3 * 1.8
  let width: CGFloat = view.frame.size.width - 40 // frame width
  var targetWidth: CGFloat = (width - (lengthOfChar - 1) * 5) / lengthOfChar
  
  if targetWidth &gt; 50 {
      targetWidth = 50
  }
  
  let totalWidth: CGFloat = (targetWidth * lengthOfChar) + ((lengthOfChar - 5) * 5)
  let x : CGFloat = (width / 2) - (totalWidth / 2)
  let xx : CGFloat = (CGFloat(indexTar) * targetWidth) + (CGFloat(indexTar) * 5) + 20
  var xAxis : CGFloat = (x + xx)
  xAxis = width - xAxis
  </code></pre>