Search code examples
iosxcodeswiftios-chartsradar-chart

iOS-charts radar chart removing labels and filling the web with color


Probably a very basic question.

I am using iOS-charts and am working with a radar chart.

I am struggling to figure out how to remove the labels from the graph and I am really struggling to FILL the web. I can change the outer lines but I want to fill the web/data in a specific colour.

any help would be much appreciated.

Kind regards

Wayne


Solution

  • So, there are two types of labels on a radar chart, the axis label that shows you the list of possible values on the chart from min to max and the labels that correspond to each point on your graph.

    REMOVING AXIS LABELS

    • Grab either the x or y axis on your radar chart view and set drawLabelsEnabled to false depending on the axis of the labels that you wish to hide

      let yAxis = radarChartView.yAxis
      let xAxis = radarChartView.xAxis
      
      yAxis.drawLabelsEnabled = false
      xAxis.drawLabelsEnabled = false
      

    REMOVING LABELS FOR VALUE OF EACH POINT

    • Go to the location that you create your RadarChartDataSet
    • Before using it to create your RadarChartData, set the drawValuesEnabled property to false

      let radarChartDataSet = RadarChartDataSet(yVals: dataEntries, label: "label")
      radarChartDataSet.drawValuesEnabled = false
      

    Also, here's a link to the Charts documentation page which can also be helpful (although it is not fully filled-in): http://cocoadocs.org/docsets/Charts/2.0.9/index.html