如何删除 LineChartView iOS 图表中的点
How do I remove the dots in LineChartView iOS charts
我正在学习ios-charts. I was using the tutorial found here。第一张图片显示了我得到的结果。你如何去除蓝色圆点,使其只显示像第二张图片中所示的平滑线?
这是代码片段
import UIKit
import Charts
class ChartsViewController: UIViewController {
@IBOutlet weak var lineChartView: LineChartView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
let unitsSold = [20.0, 4.0, 6.0, 3.0, 12.0, 16.0]
setChart(months, values: unitsSold)
}
func setChart(dataPoints: [String], values: [Double]) {
var dataEntries: [ChartDataEntry] = []
for i in 0..<dataPoints.count {
let dataEntry = ChartDataEntry(value: values[i], xIndex: i)
dataEntries.append(dataEntry)
}
let lineChartDataSet = LineChartDataSet(yVals: dataEntries, label: "Units Sold")
let lineChartData = LineChartData(xVals: dataPoints, dataSet: lineChartDataSet)
lineChartView.data = lineChartData
}
}
将 LineDataSet
的 .setDrawCircles = NO;
设置为禁用圆的绘制。
它在维基上...
https://github.com/PhilJay/MPAndroidChart/wiki/DataSet-classes-in-detail
lineChartDataSet.circleRadius = 0
删除一行中的圆圈
lineChartDataSet.drawCirclesEnabled = false
在一个圆圈中单独删除值
lineChartData.drawValuesEnabled = false
除了答案之外,您还可以使用这些属性让您的线条更加流畅
lineChartDataSet.drawCirclesEnabled = false
lineChartDataSet.drawCubicEnabled = true
或者您可以使用模式 属性,因为 drawCubicEnabled 属性 已弃用
lineChartDataSet.mode = .cubicBezier
lineChartDataSet.cubicIntensity = 0.2
我正在学习ios-charts. I was using the tutorial found here。第一张图片显示了我得到的结果。你如何去除蓝色圆点,使其只显示像第二张图片中所示的平滑线?
这是代码片段
import UIKit
import Charts
class ChartsViewController: UIViewController {
@IBOutlet weak var lineChartView: LineChartView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"]
let unitsSold = [20.0, 4.0, 6.0, 3.0, 12.0, 16.0]
setChart(months, values: unitsSold)
}
func setChart(dataPoints: [String], values: [Double]) {
var dataEntries: [ChartDataEntry] = []
for i in 0..<dataPoints.count {
let dataEntry = ChartDataEntry(value: values[i], xIndex: i)
dataEntries.append(dataEntry)
}
let lineChartDataSet = LineChartDataSet(yVals: dataEntries, label: "Units Sold")
let lineChartData = LineChartData(xVals: dataPoints, dataSet: lineChartDataSet)
lineChartView.data = lineChartData
}
}
将 LineDataSet
的 .setDrawCircles = NO;
设置为禁用圆的绘制。
它在维基上...
https://github.com/PhilJay/MPAndroidChart/wiki/DataSet-classes-in-detail
lineChartDataSet.circleRadius = 0
删除一行中的圆圈
lineChartDataSet.drawCirclesEnabled = false
在一个圆圈中单独删除值
lineChartData.drawValuesEnabled = false
除了答案之外,您还可以使用这些属性让您的线条更加流畅
lineChartDataSet.drawCirclesEnabled = false
lineChartDataSet.drawCubicEnabled = true
或者您可以使用模式 属性,因为 drawCubicEnabled 属性 已弃用
lineChartDataSet.mode = .cubicBezier
lineChartDataSet.cubicIntensity = 0.2