36

I need disable some elements from my chart.

I used the iOS-charts library in (Swift 2), however I can't understand how to disable the following:

  1. Hide right and left numbers

  2. Hide description color square

  3. Hide all vertical lines

enter image description here

Jess Murray
  • 1,273
  • 1
  • 10
  • 32
VladyslavPG
  • 557
  • 1
  • 8
  • 19
  • Look for `drawGridLines` and/or `DrawGridLines` or something alike in `XAxis` and `YAxis`. Get the `ChartLegend` of the Graph, and hide it. You should really look into the doc for Android, which is quite similar: https://github.com/PhilJay/MPAndroidChart/wiki – Larme Apr 19 '16 at 09:40
  • @Larme Thank you. Find only how to find vertical lines. But still can't find how to hide numbers and color square.... In docs can't find anything about it... – VladyslavPG Apr 19 '16 at 10:15
  • Now I find it. In leftAxis.drawLabelsEnabled – VladyslavPG Apr 19 '16 at 10:29

3 Answers3

109
self.chartView.xAxis.drawGridLinesEnabled = false
self.chartView.leftAxis.drawLabelsEnabled = false
self.chartView.legend.enabled = false

will do the job

keyv
  • 2,430
  • 1
  • 18
  • 15
4
self.chartView.drawEntryLabelsEnabled = false

This will hide the label from PieChart and shows only value. Also shows legend with label texts.

Ares
  • 2,504
  • 19
  • 19
0

For only hide the top one:

graphCell.lineChartView.leftAxis.drawTopYLabelEntryEnabled = false
aturan23
  • 4,798
  • 4
  • 28
  • 52
Santiago
  • 448
  • 3
  • 12