Latest 1.0.1
Homepage https://github.com/Echo-BraveShine/ShineChart
License MIT
Platforms ios 9.0
Frameworks UIKit
Authors

ShineChart 基于Swift4.0 轻量级图表框架

安装ShineChart

通过cocoapods安装

pod 'ShineChart'

饼图

let item1 = ShinePieItem.init(color: .red, value: 0.7,title: "redcolor")
let item2 = ShinePieItem.init(color: .blue, value: 0.2,title: "bluecolor")
let item3 = ShinePieItem.init(color: .purple, value: 0.3,title: "purplecolor")

let pie = ShinePieChart.init(frame: CGRect.init(x: 0, y: 100, width: 300, height: 200), items: [item1,item2,item3])

pie.ringRadius = 20//内环半径

pie.startAngle = 0.2 //开始方向

pie.font = UIFont.systemFont(ofSize: 12)

pie.duration = 3

pie.center = self.view.center

view.addSubview(pie)

折线图

let line1 = ShineLine.init(color: .black,source: [0.2,0.4,0.6,0.2,0.8,0.7])

let line2 = ShineLine.init(color: .red,source: [0.3,0.2,0.8,0.5,0.6,0.9])

let bar = ShineLineChart.init(frame: CGRect.init(x: 0, y: 250, width: 375, height: 150), xItems: ["1","2","3","4","5","6"])

bar.maxValue = 1 //y轴最大值

bar.yItemCount = 5 //y轴坐标点个数

bar.lines = [line1,line2] //折线的集合

bar.duration = 2 //动画时长

///通过切换style可获取更多样式,见demo
bar.style = .line(type: .none)

self.view.addSubview(bar)

柱状图

let bar1 = ShineBar.init(color: .green, value: [0.5,0.3,0.5,0.9,0.7,0.1,0.4])
let bar2 = ShineBar.init(color: .red, value: [0.2,0.4,0.3,0.7,0.6,0.5,0.8])

let bar = ShineBarChart.init(frame: CGRect.init(x: 0, y: 350, width: 375, height: 200), xItems: ["1","2","3","4","5","6"])

bar.maxValue = 1 //y轴最大值

bar.yItemCount = 5 //y轴坐标点个数

bar.bars = [bar1,bar2]

bar.duration = 2

bar.xShaftTitle = "X"

bar.yShaftTitle = "Y"

bar.itemWidth = 40

bar.center = self.view.center

self.view.addSubview(bar)

Latest podspec

{
    "name": "ShineChart",
    "version": "1.0.1",
    "summary": "Swift u56feu8868u6846u67b6",
    "description": "Swift4.0 u8f7bu91cfu7ea7u56feu6807u6846u67b6,u6301u7eedu66f4u65b0",
    "homepage": "https://github.com/Echo-BraveShine/ShineChart",
    "license": "MIT",
    "authors": {
        "BraceShine": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Echo-BraveShine/ShineChart.git",
        "tag": "v1.0.1"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "ShineChart/ShineChart/*.{swift}",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This