Comments (4)
Implemented! You can now rotate the chart after initialization.
Example:
func onSelected(slice: PieSlice, selected: Bool) {
chartView.referenceAngle = 270 - slice.view.midAngle.radiansToDegrees + chartView.referenceAngle
}
extension FloatingPoint {
var radiansToDegrees: Self {
return self * 180 / .pi
}
}
Where 270 is the top center, the angle you want to rotate the slice to.
While this doesn't affect the calculations, it's worth to note that the slice's mid angle is not necessarily in [0, 2π] range. If you want to have it in this range, e.g. to debug you can do slice.view.midAngle.radiansToDegrees.truncatingRemainder(dividingBy: 360)
.
You'll have to use 0 as selectedOffset
for now. To support both selectedOffset
and rotation change it's necessary to do a little more work. You can try to do this if you want! The most simple way to achieve this would be to add a delegate method for termination of rotate animation and also allow to select slices programmatically, such that you can do this when the rotation finishes. Or the other way around, depending on what you need.
The change is in master, to use it:
pod 'PieCharts', :git => 'https://github.com/i-schuetz/PieCharts.git'
from piecharts.
It's not possible right now. I will take a look into this in the next days, thanks!
from piecharts.
Awesome thanks!
from piecharts.
Great thank you!
from piecharts.
Related Issues (20)
- Aligning Slice labels to always stay in the middle of slices
- Disable selection HOT 2
- Chart not centered if simulator screen size is not the storyboard screen size HOT 3
- Failed to render and update auto layout status HOT 1
- IBDesignable Error
- failed to render and update auto layout status HOT 3
- SnapKit related issue HOT 1
- inner and outer radius not updating when changing them via code HOT 1
- Parameter name change for CAMediaTimingFunction in PieSliceLayer.swift
- Placing piechart in a table view cell
- slices not moving
- static slices HOT 2
- how get slice when it is selected after doing some animation like rotation
- how get slice when it is selected after doing some animation like rotation
- add button
- Adding Drop Shadow to PieChart
- Labels overlapping HOT 3
- Pie chart not at center
- labelGenerator creating Multiple labels for each Part
- How to make a chart with only 1 model ? by default they must be at least 2 !!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piecharts.