Skip to content

Instantly share code, notes, and snippets.

@alwold
Created August 7, 2014 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alwold/74434df3781388bc316a to your computer and use it in GitHub Desktop.
Save alwold/74434df3781388bc316a to your computer and use it in GitHub Desktop.
// 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