Skip to content

Instantly share code, notes, and snippets.

@alwold

alwold/graph.swift

Created Aug 7, 2014
Embed
What would you like to do?
// create graph
var graph = CPTXYGraph(frame: CGRectZero)
graph.title = "Hello Graph"
graph.paddingLeft = 0
graph.paddingTop = 0
graph.paddingRight = 0
graph.paddingBottom = 0
// hide the axes
var axes = graph.axisSet as CPTXYAxisSet
var lineStyle = CPTMutableLineStyle()
lineStyle.lineWidth = 0
axes.xAxis.axisLineStyle = lineStyle
axes.yAxis.axisLineStyle = lineStyle
// add a pie plot
var pie = CPTPieChart()
pie.dataSource = self
pie.pieRadius = (self.view.frame.size.width * 0.9)/2
graph.addPlot(pie)
self.graphView.hostedGraph = graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.