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

Pie chart is too small in tableview header view #696

Closed
pavm035 opened this issue Jan 21, 2016 · 11 comments
Closed

Pie chart is too small in tableview header view #696

pavm035 opened this issue Jan 21, 2016 · 11 comments

Comments

@pavm035
Copy link

pavm035 commented Jan 21, 2016

Hi,

I'm using pie chart in uitableview head review but the chart is too much small than its frame size, am I missing anything?

Thanks
Pavan

@pmairoldi
Copy link
Collaborator

A pie chart is supposed to be round so I believe that it tries to fit itself inside the frame but stay round. Try increasing the height of your header to make it bigger.

@pavm035
Copy link
Author

pavm035 commented Jan 22, 2016

@petester42 Thanks for the quick response, yes if i increase height it will work, but i wanted to know whether any work around to increase the diameter of the circle within the same height?

@pmairoldi
Copy link
Collaborator

No because that would lead to clipping the circle. You could increase the chart frame until it looks like you want without increasing the height. But that's kind of a hack.

Have you tried to change the chart padding or offset? I forget what it's called.

@pavm035
Copy link
Author

pavm035 commented Jan 23, 2016

Offset did not work, but increasing height actually making circle appearing bigger, i believe there would be some API actually which controls it, unfortunately i could not find right one yet

@danielgindi
Copy link
Collaborator

You can zero all the offsets - by disabling the legend like pieChart.legend.enabled = false.
Then if the pie is still too small for you - just adjust the size of the view.

@pavm035
Copy link
Author

pavm035 commented Jan 25, 2016

Thanks

@fsjack
Copy link

fsjack commented Apr 2, 2016

There's one point that @danielgindi didn't mention, that PieChartView leave space for the highlight selection slice, so if you don't need the highlight selection function you could also set selectionShift of data set to 0 to get rid of the blank padding.

@SylarRuby
Copy link

Hi @fsjack, what exactly do you mean? How to remove the padding and disable the slice highlight?

@Sebulec
Copy link

Sebulec commented Feb 2, 2017

@SylarRuby It means, when you are preparing the chart data for example:
let pieChartData = PieChartData(dataSet: pieChartDataSet)
then you have to set selectionShift property to 0:
pieChartDataSet.selectionShift = 0

To disable slice highlight on pie chart:
chartView.highlightPerTapEnabled = false

@kevinOlivet
Copy link

Hi,
This worked for me:
setExtraOffsets(left: -15, top: -15, right: -15, bottom: -15)
Before:
Screen Shot 2019-07-16 at 4 17 05 PM
After:
Screen Shot 2019-07-16 at 4 17 58 PM

@FutureAndroidDeveloper
Copy link

If you dont need to maintain the selection of a piece of the diagram, you need to set the selection shift to 0.
This will remove extra padding from the bottom and top of your chart.

let dataSet = PieChartDataSet(entries: entries)
dataSet.selectionShift = 0

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

8 participants