// // SinusBarChartViewController.swift // ChartsDemo-iOS // // Created by Jacob Christie on 2017-07-09. // Copyright © 2017 jc. All rights reserved. // #if canImport(UIKit) import UIKit #endif import Charts class SinusBarChartViewController: DemoBaseViewController { @IBOutlet var chartView: BarChartView! @IBOutlet var sliderX: UISlider! @IBOutlet var sliderTextX: UITextField! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.title = "Sinus Bar Chart" self.options = [.toggleValues, .toggleHighlight, .animateX, .animateY, .animateXY, .saveToGallery, .togglePinchZoom, .toggleAutoScaleMinMax, .toggleData] chartView.delegate = self chartView.chartDescription.enabled = false chartView.drawBarShadowEnabled = false chartView.drawValueAboveBarEnabled = false chartView.maxVisibleCount = 60 let xAxis = chartView.xAxis xAxis.labelPosition = .bottom xAxis.enabled = false let leftAxis = chartView.leftAxis leftAxis.labelCount = 6 leftAxis.axisMinimum = -2.5 leftAxis.axisMaximum = 2.5 leftAxis.granularityEnabled = true leftAxis.granularity = 0.1 let rightAxis = chartView.rightAxis rightAxis.labelCount = 6 rightAxis.axisMinimum = -2.5 rightAxis.axisMaximum = 2.5 rightAxis.granularity = 0.1 let l = chartView.legend l.horizontalAlignment = .left l.verticalAlignment = .bottom l.orientation = .horizontal l.drawInside = false l.form = .square l.formSize = 9 l.font = .systemFont(ofSize: 11) l.xEntrySpace = 4 // chartView.legend = l sliderX.value = 150 slidersValueChanged(nil) chartView.animate(xAxisDuration: 2, yAxisDuration: 2) } override func updateChartData() { if self.shouldHideData { chartView.data = nil return } self.setDataCount(Int(sliderX.value)) } func setDataCount(_ count: Int) { let entries = (0..