Skip to content

Commit

Permalink
Release 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesco Leoni committed Oct 22, 2022
1 parent f52f644 commit 99b9f42
Show file tree
Hide file tree
Showing 12 changed files with 537 additions and 421 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.9.0
* **FEATURE:** Added `averageLineOverlapsChart` on `FLChart` to let the chart overlaps the average line.
* **FEATURE:** Added possibility to hide x and y axes.
* **FEATURE:** Added `showDashedLines` in `FLChart`.
* **IMPROVEMENT:** Added `uiColor(_:)` and `white(_:alpha:)` `FLColor` inits.
* **FIX:** Orientation changes redraw.


## 1.8.0
* **FEATURE:** Added `yMinValue` and `yMaxValue` on `FLChart` to clip the chart y axis.
* **FIX:** Bar animation.
Expand Down
38 changes: 29 additions & 9 deletions Example/FLCharts/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import FLCharts

class ViewController: UIViewController {

@IBOutlet weak var chartView: FLChart!
@IBOutlet weak var chartView: FLChart!

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -30,9 +30,9 @@ class ViewController: UIViewController {
let barChartData = FLChartData(title: "Consumptions",
data: monthsData,
legendKeys: [
Key(key: "1", color: .red),
Key(key: "2", color: .blue),
Key(key: "3", color: .green)
Key(key: "1", color: .white(0.9)),
Key(key: "2", color: .white(0.9)),
Key(key: "3", color: .white(0.9))


// Key(key: "F1", yThresholds: [40 : .red,
Expand Down Expand Up @@ -80,10 +80,16 @@ class ViewController: UIViewController {
radarChart.showXAxisLabels = true
radarChart.showYAxisLabels = true

let lineChart = FLChart(data: barChartData, type: .bar(bar: FLMultipleValuesChartBar.self, highlightView: BarHighlightedView(), config: FLBarConfig(radius: .capsule, width: 30, spacing: 15)))
let lineChart = FLChart(data: barChartData, type: .bar(highlightView: BarHighlightedView(), config: FLBarConfig(radius: .corners(corners: [.layerMaxXMinYCorner, .layerMinXMaxYCorner], 3), width: 30)))
// lineChart.showXAxis = false
// lineChart.showYAxis = false
lineChart.averageLineOverlapsChart = true
lineChart.showAverageLine = true
lineChart.config = FLChartConfig(granularityY: 20)

lineChart.showDashedLines = false
lineChart.config = FLChartConfig(granularityY: 40, averageView: FLAverageViewConfig(lineWidth: 5, primaryFont: .systemFont(ofSize: 14, weight: .heavy), secondaryFont: .systemFont(ofSize: 13, weight: .bold), primaryColor: .orange, secondaryColor: .orange, lineColor: .orange.withAlphaComponent(0.9)))
lineChart.cartesianPlane.yAxisPosition = .none
lineChart.shouldScroll = false

let card = FLCard(chart: lineChart, style: .rounded)
card.showAverage = false
card.showLegend = false
Expand All @@ -93,8 +99,10 @@ class ViewController: UIViewController {
NSLayoutConstraint.activate([
card.centerYAnchor.constraint(equalTo: view.centerYAnchor),
card.centerXAnchor.constraint(equalTo: view.centerXAnchor),
card.heightAnchor.constraint(equalToConstant: 290),
card.widthAnchor.constraint(equalToConstant: 300)
card.heightAnchor.constraint(equalToConstant: 200),
card.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 10),
card.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -10)
// card.widthAnchor.constraint(equalToConstant: 300)
])

// view.addSubview(radarChart)
Expand All @@ -112,6 +120,18 @@ extension ViewController {

var monthsData: [MultiPlotable] {
[MultiPlotable(name: "jan", values: [30, 24, 53]),
MultiPlotable(name: "feb", values: [55, 44, 24]),
MultiPlotable(name: "mar", values: [70, 15, 44]),
MultiPlotable(name: "apr", values: [45, 68, 34]),
MultiPlotable(name: "may", values: [85, 46, 12]),
MultiPlotable(name: "jun", values: [46, 73, 32]),
MultiPlotable(name: "jul", values: [75, 46, 53]),
MultiPlotable(name: "aug", values: [10, 24, 24]),
MultiPlotable(name: "set", values: [60, 74, 44]),
MultiPlotable(name: "oct", values: [75, 72, 34]),
MultiPlotable(name: "nov", values: [85, 10, 15]),
MultiPlotable(name: "dec", values: [55, 66, 32]),
MultiPlotable(name: "jan", values: [30, 24, 53]),
MultiPlotable(name: "feb", values: [55, 44, 24]),
MultiPlotable(name: "mar", values: [70, 15, 44]),
MultiPlotable(name: "apr", values: [45, 68, 34]),
Expand Down

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.8.0'
s.version = '1.9.0'
s.summary = 'Customizable iOS Charts built in Swift.'

s.description = <<-DESC
Expand Down
7 changes: 4 additions & 3 deletions Sources/FLCharts/Bar/FLChartBarCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ final public class FLChartBarCell: UICollectionViewCell {
public var shouldShowTicks: Bool = true

internal var barView: ChartBar!
internal var showXAxis: Bool = true
private let xAxisLine = UIView()
private let spaceXLineFromBottom: CGFloat = 25
let xAxisLabel = UILabel()
Expand All @@ -39,7 +40,7 @@ final public class FLChartBarCell: UICollectionViewCell {
self.barView = bar

addSubview(xAxisLine)
xAxisLine.backgroundColor = config.axesLines.color
xAxisLine.backgroundColor = showXAxis ? config.axesLines.color : .clear
xAxisLine.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
Expand All @@ -52,7 +53,7 @@ final public class FLChartBarCell: UICollectionViewCell {
addSubview(xAxisLabel)
xAxisLabel.textAlignment = .center
xAxisLabel.font = config.axesLabels.font
xAxisLabel.textColor = config.axesLabels.color
xAxisLabel.textColor = showXAxis ? config.axesLabels.color : .clear
xAxisLabel.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
Expand All @@ -63,7 +64,7 @@ final public class FLChartBarCell: UICollectionViewCell {
if shouldShowTicks {
let xAxisTick = UIView()
addSubview(xAxisTick)
xAxisTick.backgroundColor = config.tick.color
xAxisTick.backgroundColor = showXAxis ? config.tick.color : .clear
xAxisTick.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
Expand Down
Loading

0 comments on commit 99b9f42

Please sign in to comment.