Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS折线图高亮显示颜色_Ios_Swift_Ios Charts - Fatal编程技术网

iOS折线图高亮显示颜色

iOS折线图高亮显示颜色,ios,swift,ios-charts,Ios,Swift,Ios Charts,我使用的是3.2.2 iOS版本。我试图画一个折线图。在折线图中,只要用户点击数值点,就会显示一条高亮线。是否有任何方法可以隐藏或更改此高亮线颜色。我面临的另一个问题是泡沫在第一次进入时不会出现。我在网上找到了很多解决方案,但都不适合我。任何帮助都将不胜感激 添加数据项后 let setOne = LineChartDataSet(values: lineChartEntry, label: "") //Here we convert lineChartEntry to a LineChar

我使用的是3.2.2 iOS版本。我试图画一个折线图。在折线图中,只要用户点击数值点,就会显示一条高亮线。是否有任何方法可以隐藏或更改此高亮线颜色。我面临的另一个问题是泡沫在第一次进入时不会出现。我在网上找到了很多解决方案,但都不适合我。任何帮助都将不胜感激

添加数据项后

 let setOne = LineChartDataSet(values: lineChartEntry, label: "") //Here we convert lineChartEntry to a LineChartDataSet

    setOne.mode = .cubicBezier
    setOne.drawValuesEnabled = true

    setOne.lineWidth = 1
    setOne.circleRadius = 3
    setOne.drawCircleHoleEnabled = false
    setOne.valueFont = .systemFont(ofSize: 9)
    setOne.formLineWidth = 1
    setOne.formSize = 15

    setOne.setCircleColor(ChartColorTemplates.colorFromString("#ffcc1a29"))

    if !isSingelValue {
        setOne.setColor(ChartColorTemplates.colorFromString("#ffcc1a29"))
    }else {
        setOne.setColor(UIColor.clear)
    }

    let data = LineChartData(dataSet: setOne)

    data.addDataSet(setOne) //Adds the line to the dataSet
    scoreLineChart.xAxis.axisMinimum = 0
    scoreLineChart.data = data //finally - it adds the chart data to the chart and causes an update
    //        scoreLineChart.data?.setValueFormatter(valueFormatter)
    scoreLineChart.chartDescription?.text = "" // Here we set the description for the graph
    scoreLineChart.notifyDataSetChanged()

只需将
drawHorizontalHighlightIndicatorEnabled
drawVerticalHighlightIndicatorEnabled
设置为false即可隐藏网格线

    let set1 = ScatterChartDataSet(entries: values1, label: "DS 1")
    set1.drawHorizontalHighlightIndicatorEnabled = false
    set1.drawVerticalHighlightIndicatorEnabled = false
是否有任何方法可以隐藏或更改此高亮线颜色

要显示/隐藏或更改高亮线颜色,请编辑ChartDateSet的属性

let setOne = LineChartDataSet(values: lineChartEntry, label: "")
setOne.highlightColor = .red // color of the line
setOne.highlightWidht = 2.0 // width of the line
setOne.drawHorizontalHighlightIndicatorEnabled = false // hide horizontal line
setOne.drawVerticalHighlightIndicatorEnabled = false // hide vertical line
我面临的另一个问题是泡沫在第一次进入时不会出现

遗憾的是,我无法使用github存储库中的BallonMarker.swift重现这个问题。而且还不清楚哪一个是您提供的图像中的第一个数据条目

我试着在我的图表中添加“第一个条目”,但气球标记器工作得很好


您好,您的问题需要更清楚。。“我不知道你想隐藏什么,或者你说的是什么颜色?”阿塔扎兹我编辑了我的问题。我说的是图像中的橙色线。这是高亮显示的线,我想隐藏它。希望这有助于您理解问题。好的,我明白了,但是如果不查看您的代码就很难了。。显示您的代码,请使用LineChartView或CombinedChartView?折线图视图
let setOne = LineChartDataSet(values: lineChartEntry, label: "")
setOne.highlightColor = .red // color of the line
setOne.highlightWidht = 2.0 // width of the line
setOne.drawHorizontalHighlightIndicatorEnabled = false // hide horizontal line
setOne.drawVerticalHighlightIndicatorEnabled = false // hide vertical line