Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.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_Charts - Fatal编程技术网

Ios 值未显示在图表上

Ios 值未显示在图表上,ios,swift,charts,Ios,Swift,Charts,我正在使用库在swift中绘制图形。我想在LineChartView上显示以下值。 我的价值观如下 1) x:0.0 y:0.62020133693747 2) x:0.0 y:0.62020133693747 3) x:0.0 y:0.62020133693747 4) x:8500.0 y:0.62020133693747 5) x:8500.0 y:0.925703706122449 6) x:9000.0 y:0.925703706122449 7) x:9000.0 y:1.43307

我正在使用库在swift中绘制图形。我想在LineChartView上显示以下值。 我的价值观如下

1) x:0.0 y:0.62020133693747

2) x:0.0 y:0.62020133693747

3) x:0.0 y:0.62020133693747

4) x:8500.0 y:0.62020133693747

5) x:8500.0 y:0.925703706122449

6) x:9000.0 y:0.925703706122449

7) x:9000.0 y:1.433070403327373

8) x:9500.0 y:1.433074003327373

9) x:9500.0 y:0.37799568

10) x:9500.0 y:0.37799568

11) x:9500.0 y:0.37799568

12) x:9000.0 y:0.37799568

13) x:9000.0 y:0.26996914285714

14) x:8500.0 y:0.26996914285714

15) x:8500.0 y:0.23997257142857

16) x:6000.0 y:0.23997257142857

17) x:6000.0 y:0.219552079597251

18) x:0.0 y:0.219552079597251

19) x:0.0 y:0.453594816

20) x:0.0 y:0.453594816

根据这些值,预期图为:

但当我使用图书馆时,我得到了以下图表:

库似乎无法绘制最后的值

我尝试了各种设置,但没有解决我的问题

我的代码:

`func updateChartValues(arrLineCDE: Array<ChartDataEntry>) -> (LineChartDataSet) {

let Xvalues: [Double] = [/*All My X values are here*/]
let Yvalues: [Double] = [/*All My Y values are here*/]
var entries: [ChartDataEntry] = Array()

for (i, x) in Xvalues.enumerated() {
    entries.append(ChartDataEntry(x: Xvalues[i], y: Yvalues[i], data: UIImage(named: "icon", in: Bundle(for: self.classForCoder), compatibleWith: nil)))
}
self.dataSet = LineChartDataSet(values: entries, label: "Depth vs. FV")
self.dataSet.mode = LineChartDataSet.Mode.cubicBezier
return dataSet
}`

给我看看code@a-n-i-k-e-t编辑你的问题并在那里添加你的代码,而不是在评论中。它完成了。你能检查一下吗?请帮我调试一下吗?当线条开始旋转时,没有明显的理由不绘制最后6个值对,您可以首先在折线图渲染器中的
drawDataSets
添加一些断点,以查看是否存在所有缺少的值,以及是否满足循环条件。是的,我已经绘制了,我正在获取数据集中的所有值。但我不知道为什么不打印。我也在GitHub上打开了这个问题。我不确定是否存在值范围设置或类似设置?不知道?不过,问题还没有解决!
`func setLineChartProperty(lineChartView lcv: LineChartView) {
//Line Chart Setting:
// lcv.delegate = self
lcv.setViewPortOffsets(left: 44.0, top: 30.0, right: 44.0, bottom: 44.0)
lcv.backgroundColor = darkBlueColor
lcv.chartDescription?.enabled = false
lcv.dragEnabled = false
lcv.setScaleEnabled(false)
lcv.pinchZoomEnabled = false
lcv.drawGridBackgroundEnabled = false

lcv.xAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: CGFloat(12.0))!
lcv.xAxis.setLabelCount(6, force: false)
lcv.xAxis.labelTextColor = UIColor.white
lcv.xAxis.labelPosition = .bottom
lcv.xAxis.axisLineColor = UIColor.white
lcv.xAxis.gridColor = UIColor.white
lcv.xAxis.drawGridLinesEnabled = true
lcv.xAxis.axisMaximum = 10000
lcv.xAxis.axisMinimum = 0

lcv.leftAxis.labelFont = UIFont(name: "HelveticaNeue-Light", size: CGFloat(12.0))!
lcv.leftAxis.setLabelCount(6, force: false)
lcv.leftAxis.labelTextColor = UIColor.white
lcv.leftAxis.labelPosition = .outsideChart
lcv.leftAxis.axisLineColor = UIColor.white
lcv.leftAxis.gridColor = UIColor.white
lcv.leftAxis.drawGridLinesEnabled = true

lcv.legend.horizontalAlignment = .right
lcv.legend.verticalAlignment = .bottom
lcv.legend.orientation = .horizontal
lcv.legend.drawInside = true
lcv.legend.form = .square
lcv.legend.formSize = 8.0
lcv.legend.formToTextSpace = 4.0
lcv.legend.xEntrySpace = 6.0

lcv.xAxis.enabled = true
lcv.rightAxis.enabled = false
lcv.leftAxis.enabled = true
lcv.legend.enabled = true
lcv.legend.textColor = UIColor.white
lcv.animate(xAxisDuration: 1.0, yAxisDuration: 1.0)

}`