title: Horizontal Bar Chart Labels
body: <p>I recently upgraded one of my client projects from <code>Swift2</code> and iOS-charts 2 to <code>Swift3</code> and iOS-charts 3.</p>
  
  <p>Most of the code is functioning as expected after a few days of manual tweaking, however, I am still having an issue with my horizontal bar chart.</p>
  
  <p><strong>The chart used to display as:</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/nmd2C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nmd2C.png" alt="enter image description here"></a></p>
  
  <p><strong>The chart now displays as:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/mcyqt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mcyqt.png" alt="enter image description here"></a></p>
  
  <p>Core code for the chart:</p>
  
  <pre><code>func drawMarginChart() {
      let labels = marginObject!.getLabelsForChart()
      let values = marginObject!.getValuesForChart()
  
      var dataEntries = [ChartDataEntry]()
  
      for i in 0..&lt;values.count {
          let entry = BarChartDataEntry(x: Double(i), y: values[i])
          dataEntries.append(entry)
      }
  
      let barChartDataSet = BarChartDataSet(values: dataEntries, label: "")
      barChartDataSet.drawValuesEnabled = false
      barChartDataSet.colors = ChartColorTemplates.joyful()
  
      let barChartData = BarChartData(dataSet: barChartDataSet)
      barChartMargins.data = barChartData
      barChartMargins.legend.enabled = false
  
      barChartMargins.xAxis.valueFormatter = IndexAxisValueFormatter(values: labels)
      barChartMargins.xAxis.granularityEnabled = true
      barChartMargins.xAxis.granularity = 1
  
      barChartMargins.animate(xAxisDuration: 3.0, yAxisDuration: 3.0, easingOption: .easeInOutBounce)
  }
  </code></pre>
  
  <p><strong>What I am hoping to find out is:</strong></p>
  
  <p>1) How can I get the label to appear for each bar on the chart</p>
  
  <p>2) How can I get the chart to resize automatically to display the labels</p>
  
  <p><strong>If these other issues could be addressed, that would be fantastic, but we are willing to ship it without these:</strong></p>
  
  <p>1) How can I remove the gridline overlap on the left side of the chart?</p>
  
  <p>2) How can I keep the bottom of the chart from truncating?</p>
  
  <p>I have tried adjusting many of the chart properties per posts I have found here and on other sites, however, nothing fixes the issues. Any help it making the chart appear like the old version would be greatly appreciated by myself and my client.</p>