Skip to content

Commit

Permalink
Adjustments to OSX pie demo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Feb 28, 2016
1 parent ca8a756 commit c31294a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions ChartsDemo-OSX/ChartsDemo-OSX/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,24 @@ class PieDemoViewController: NSViewController

let data = PieChartData(xVals: xs)
let ds1 = PieChartDataSet(yVals: yse1, label: "Hello")
ds1.colors = [NSUIColor.redColor(), NSUIColor.blueColor(), NSUIColor.greenColor(), NSUIColor.orangeColor(), NSUIColor.grayColor()]
data.addDataSet(ds1)

self.pieChartView.data = data
}


ds1.colors = ChartColorTemplates.vordiplom()

data.addDataSet(ds1)

let paragraphStyle: NSMutableParagraphStyle = NSParagraphStyle.defaultParagraphStyle().mutableCopy() as! NSMutableParagraphStyle
paragraphStyle.lineBreakMode = .ByTruncatingTail
paragraphStyle.alignment = .Center
let centerText: NSMutableAttributedString = NSMutableAttributedString(string: "iOS Charts\nby Daniel Cohen Gindi")
centerText.setAttributes([NSFontAttributeName: NSFont(name: "HelveticaNeue-Light", size: 15.0)!, NSParagraphStyleAttributeName: paragraphStyle], range: NSMakeRange(0, centerText.length))
centerText.addAttributes([NSFontAttributeName: NSFont(name: "HelveticaNeue-Light", size: 13.0)!, NSForegroundColorAttributeName: NSColor.grayColor()], range: NSMakeRange(10, centerText.length - 10))
centerText.addAttributes([NSFontAttributeName: NSFont(name: "HelveticaNeue-LightItalic", size: 13.0)!, NSForegroundColorAttributeName: NSColor(red: 51 / 255.0, green: 181 / 255.0, blue: 229 / 255.0, alpha: 1.0)], range: NSMakeRange(centerText.length - 19, 19))

self.pieChartView.centerAttributedText = centerText

self.pieChartView.data = data
}

override func viewWillAppear()
{
self.pieChartView.animate(xAxisDuration: 0.0, yAxisDuration: 1.0)
Expand Down

0 comments on commit c31294a

Please sign in to comment.