Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radar chart title #2061

Closed
alifarhangmehr opened this issue Jan 11, 2017 · 7 comments
Closed

Radar chart title #2061

alifarhangmehr opened this issue Jan 11, 2017 · 7 comments

Comments

@alifarhangmehr
Copy link

Hi guys,
Sorry if my question is very stupid, but I struggled with almost a week and came up with nothing.
So I wanted to know how can I set the title of radar chart and also wants to know how can I change location of description and the chart it self, cuz it act really strange and I can not predict how the chart is going to show, is there any way to fix it into a view ? (it only happened with radar chart, the other fit to their view just fine)
here is my code :

//Label
  let dataPoints = ["Strenght", "Cardio", "Stretch", "Versality", "Recovery"]
  //Points
  let values = [0.65, 1.0, 0.7, 0.65, 0.85]

var dataEntries: [RadarChartDataEntry] = []
      for i in 0..<values.count {
          let dataEntry = RadarChartDataEntry(value: values[I])
          dataEntries.append(dataEntry)
      }
      

      let chartDataSet = RadarChartDataSet(values: dataEntries, label: "Performance")
      
      radarChartView.yAxis.axisMinimum = 0.0
      radarChartView.yAxis.axisMaximum = 0.8
      
      radarChartView.xAxis.axisMinimum = 0.0
      radarChartView.xAxis.axisMaximum = 1.0

      chartDataSet.drawFilledEnabled = true

      let chartData = RadarChartData(dataSet: chartDataSet)
      chartData.labels = dataPoints
      radarChartView.data = chartData
@liuxuan30
Copy link
Member

please give a screenshot so we know what you want.. And make sure you played with ChartsDemo radar chart

@alifarhangmehr
Copy link
Author

screen shot 2017-01-12 at 5 21 46 pm

I just want to change the label on the edge of the chart (.0 1.0 2.0 3.0 4.0 ) to a string

@MatrixTeo
Copy link

Hi,

Take a look at the demo, add - (NSString *)stringForValue:(double)value axis:(ChartAxisBase *)axis delegate method and use value as the array index.

I don't know if it's an expected behavior, but currently it works.

@alifarhangmehr
Copy link
Author

Thank you for reply, but I'm using swift and the whole process with obj-c and swift are different, so I can't even guess where should I set the values

I'm using a loop for injecting values to my chart and dataPoints are the array of labels that I need to show in the chart, but I don't know why its not working.

for i in 0..<values.count {
let dataEntry = RadarChartDataEntry(value: values[i], data: dataPoints[i] as AnyObject?)
dataEntries.append(dataEntry)
}

@alifarhangmehr
Copy link
Author

If only anyone can give me a swift code which can run a simple radar chart with labels around, my problem is going to be solved.

@liuxuan30
Copy link
Member

Just use valueFormatter to format to whatever you want.

@dalianmengzi
Copy link

Have you solved this problem? I met him too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants