Skip to content

Instantly share code, notes, and snippets.

@devraj
Created July 11, 2017 04:44
Show Gist options
  • Save devraj/955b2a429cd76dc284f17cab9c45dd5e to your computer and use it in GitHub Desktop.
Save devraj/955b2a429cd76dc284f17cab9c45dd5e to your computer and use it in GitHub Desktop.
Swift configuration for Purple Graph using ScrollableGraphView v3
private func paintGraphView() {
let graphView = ScrollableGraphView(frame: CGRect(x: 0, y: 0, width: 375, height: 350))
let purpleColor = UIColor.colorFromHex("#8D2595")
barPlot.set(data: data, withLabels: labels)
barPlot.topMargin = 80
barPlot.backgroundFillColor = UIColor.white
barPlot.lineColor = UIColor.clear
barPlot.lineStyle = .smooth
barPlot.shouldFill = true
barPlot.fillColor = self.view.backgroundColor as UIColor!
barPlot.shouldDrawDataPoint = true
barPlot.dataPointFillColor = purpleColor
barPlot.dataPointSpacing = 60
barPlot.dataPointLabelFont = UIFont.boldSystemFont(ofSize: 10)
barPlot.dataPointLabelColor = purpleColor
barPlot.referenceLineThickness = 1
barPlot.referenceLineLabelFont = UIFont.boldSystemFont(ofSize: 10)
barPlot.referenceLineColor = purpleColor.withAlphaComponent(0.25)
barPlot.referenceLineLabelColor = purpleColor
barPlot.shouldShowLabels = true
barPlot.dataPointLabelFont = UIFont.systemFont(ofSize: 10)
barPlot.dataPointLabelColor = purpleColor
barPlot.numberOfIntermediateReferenceLines = 5
barPlot.rangeMax = 70
self.view.addSubview(graphView)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment