cancel
Showing results for 
Search instead for 
Did you mean: 

FUIChartView: how to specify range for y axis

0 Kudos

Hi Folks,

I have implemented FUIChartView type area. As per requirement, we need to specify range for y axis.Although i check in api documentation , was trying to set following attributes.

chartView.categoryAxis.isZeroBased = false

chartView.categoryAxis.abbreviatesLabels = false

chartView.categoryAxis.explicitMax = 66.0

chartView.categoryAxis.explicitMin = 20.0

But same is not reflecting in my chart view.

Kindly help me if i am missing something.

following code is suing to setup chart view:

chartView.chartType = .area

chartView.selectionMode = FUIChartSelectionMode.all

chartView.dataSource = self

summaryView.dataSource = self

chartView.delegate = self

chartView.style.themePalette.primary2 = UIColor.orange

chartView.style.themePalette.primary4 = UIColor.gray

chartView.series.colors = UIColor.gray

chartView.series.points.isHidden = true

chartView.categoryAxis.isZeroBased = false

chartView.categoryAxis.abbreviatesLabels = false

chartView.categoryAxis.explicitMax = 66.0

chartView.categoryAxis.explicitMin = 20.0

chartView.isUserInteractionEnabled = true

Thanks,

Ruchi

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Ruchi,

As Stan pointed out, categoryAxis is x axis so you need to use numericAxis for y axis. And if you want to change default settings for secondary y axis then you need to use secondaryNumericAxis.

By default the chart calculates the range from the data you passed in. So usually you don't have to specify explicitMin and explicitMax for data range unless you want to specify the range for the chart.

So your code should like this:

chartView.numericAxis.isZeroBased = false

chartView.numericAxis.explicitMax = 66.0

chartView.numericAxis.explicitMin = 20.0

Thanks,

Shen

former_member190800
Contributor
0 Kudos

Ruchi, I think you should be trying to set values on the numeric axis, not category axis.

**EDIT** I'm aware there was a historical limitation on this, have forwarded to the new developer.

0 Kudos

Thanks Stan,

I tried same with numericAxis as well, but still not reflecting.

chartView.numericAxis.isZeroBased = false

chartView.numericAxis.abbreviatesLabels = false

chartView.numericAxis.explicitMax = 66.0

chartView.numericAxis.explicitMin = 20.0

Thanks,

Ruchi