如何删除LineChartView iOS图表中的点

时间:2016-05-17 05:48:18

标签: ios swift linechart ios-charts

我正在学习ios-charts。我正在使用找到here的教程。第一张照片显示了我得到的结果。如何删除蓝色圆圈点,使其仅显示如第二张图片中所示的平滑线条? This is the result I am getting

This is what I am trying to get

以下是代码片段

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

}

}

4 个答案:

答案 0 :(得分:8)

设置LineDataSet设置的add_action( 'admin_init', 'redirect_none_admin' ); function redirect_none_admin(){ if(is_admin() && current_user_can(activate_plugins)){ //... }else{ wp_redirect(home_url()); } } 以禁用绘制圆圈。

这是在wiki上...... https://github.com/PhilJay/MPAndroidChart/wiki/DataSet-classes-in-detail

答案 1 :(得分:6)

删除一行中的圆圈

lineChartDataSet.drawCirclesEnabled = false

在圆圈中单独删除值

lineChartData.drawValuesEnabled = false

答案 2 :(得分:1)

除了答案之外,您还可以使用这些属性使您的行更流畅

authorization

或者您可以使用mode属性,因为不赞成使用drawCubicEnabled属性

lineChartDataSet.drawCirclesEnabled = false
lineChartDataSet.drawCubicEnabled = true

答案 3 :(得分:-2)

lineChartDataSet.circleRadius = 0