Skip to content

Commit

Permalink
Release 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Leoni committed Feb 5, 2022
1 parent baec44c commit cd4cf75
Show file tree
Hide file tree
Showing 21 changed files with 574 additions and 123 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.3.0
* **FEATURE:** Added Scatter chart
* **FIX:** Fixed `shouldScroll` property.


## 1.2.1
* **FEATURE:** Added support for Storyboard

Expand Down
85 changes: 56 additions & 29 deletions Example/FLCharts/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,72 @@ class ViewController: UIViewController {
super.viewDidLoad()
view.backgroundColor = .white

let monthsData = [MultiPlotable(name: "jan", values: [30, 0, 0]),
MultiPlotable(name: "feb", values: [55, 0, 0]),
MultiPlotable(name: "mar", values: [70, 0, 0]),
MultiPlotable(name: "apr", values: [45, 30, 0]),
MultiPlotable(name: "may", values: [85, 0, 0]),
MultiPlotable(name: "jun", values: [46, 40, 0]),
MultiPlotable(name: "jul", values: [75, 0, 0]),
MultiPlotable(name: "aug", values: [10, 0, 0]),
MultiPlotable(name: "set", values: [60, 0, 0]),
MultiPlotable(name: "oct", values: [75, 0, 0]),
MultiPlotable(name: "nov", values: [85, 0, 0]),
MultiPlotable(name: "dec", values: [55, 50, 20])]
var monthsData: [PlotableData] = []

let data = FLChartData(title: "Consumptions",
data: monthsData,
legendKeys: [Key(key: "F1", color: .Gradient.purpleCyan),
Key(key: "F2", color: .green),
Key(key: "F3", color: .Gradient.sunset)],
unitOfMeasure: "kWh")
monthsData = [
ScatterPlotable(x: 10.839988510221971, y: 8.587106591224336),
ScatterPlotable(x: 15.299129085689668, y: 38.552766707227285),
ScatterPlotable(x: 15.35078612619641, y: 36.49894052036733),
ScatterPlotable(x: 2.610617242416038, y: 31.31575103102955),
ScatterPlotable(x: 12.405358885011637, y: 51.90156317943829),
ScatterPlotable(x: 3.0511565198462343, y: 61.83913503693172),
ScatterPlotable(x: 11.724536444721771, y: 26.178808708388736),
ScatterPlotable(x: 9.827075196452416, y: 42.251336976025385),
ScatterPlotable(x: 12.317182088116304, y: 3.0921186208962337),
ScatterPlotable(x: 15.820992489229733, y: 16.426826517619887),
ScatterPlotable(x: 2.282637000059655, y: 80.04758483526805),
ScatterPlotable(x: 10.362707563030302, y: 26.832734822388428),
ScatterPlotable(x: 13.354707157044048, y: 46.52775961525811),
ScatterPlotable(x: 5.7244020200118335, y: 22.358078282814976),
ScatterPlotable(x: 2.07964896336037, y: 98.02773021009796),
ScatterPlotable(x: 14.413761813594125, y: 85.68037835676299),
ScatterPlotable(x: 9.986518848938694, y: 85.75449649249009),
ScatterPlotable(x: 17.78796600480713, y: 62.508555646363185),
ScatterPlotable(x: 10.117735260477584, y: 61.78378326561926),
ScatterPlotable(x: 0.3640039997010436, y: 96.53751839181793),
ScatterPlotable(x: 17.147832151436994, y: 92.89349217706958),
ScatterPlotable(x: 12.745950761706375, y: 79.22327631312078),
ScatterPlotable(x: 12.92676299380437, y: 17.049959556070704),
ScatterPlotable(x: 8.827170027380545, y: 78.14597672470192)
]

chartView.setup(data: data, type: .bar(highlightView: BarHighlightedView()))
chartView.showAverageLine = true
monthsData = [MultiPlotable(name: "jan", values: [30, 43]),
MultiPlotable(name: "feb", values: [55, 43]),
MultiPlotable(name: "mar", values: [70, 43]),
MultiPlotable(name: "apr", values: [45, 43]),
MultiPlotable(name: "may", values: [85, 43]),
MultiPlotable(name: "jun", values: [46, 43]),
MultiPlotable(name: "jul", values: [75, 43]),
MultiPlotable(name: "aug", values: [10, 43]),
MultiPlotable(name: "set", values: [60, 43]),
MultiPlotable(name: "oct", values: [75, 43]),
MultiPlotable(name: "nov", values: [85, 43]),
MultiPlotable(name: "dec", values: [55, 0])]

let chart = FLChart(data: data, type: .bar())
chart.config = FLChartConfig(granularityY: 20)
let chartData = FLChartData(title: "Consumptions",
data: monthsData,
legendKeys: [Key(key: "F1", color: .Gradient.purpleCyan),
Key(key: "F2", color: .green),
Key(key: "F3", color: .Gradient.sunset)],
unitOfMeasure: "kWh")

let chart = FLChart(data: chartData, type: .bar())
chart.config = FLChartConfig(granularityX: 3)
chart.cartesianPlane.yAxisPosition = .right
chart.cartesianPlane.showTicks = false
chart.showAverageLine = true

let card = FLCard(chart: chart, style: .rounded)
card.showAverage = true
card.showLegend = true
card.showLegend = false

view.addSubview(card)
card.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(chart)
chart.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
card.centerYAnchor.constraint(equalTo: view.centerYAnchor),
card.centerXAnchor.constraint(equalTo: view.centerXAnchor),
card.heightAnchor.constraint(equalToConstant: 300),
card.widthAnchor.constraint(equalToConstant: 330)
chart.centerYAnchor.constraint(equalTo: view.centerYAnchor),
chart.centerXAnchor.constraint(equalTo: view.centerXAnchor),
chart.heightAnchor.constraint(equalToConstant: 250),
chart.widthAnchor.constraint(equalToConstant: 330)
])
}
}
38 changes: 35 additions & 3 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified FLCharts.framework.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion FLCharts.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Pod::Spec.new do |s|
s.name = 'FLCharts'
s.version = '1.2.2'
s.version = '1.3.0'
s.summary = 'Customizable iOS Charts built in Swift.'

s.description = <<-DESC
Expand Down
Loading

0 comments on commit cd4cf75

Please sign in to comment.