在这里我绘制了一个包含虚线和法线的折线图,我将虚线和直线的值分开并放入数组数组中。在某些情况下,值的大小会变得越来越小比图表视图更重要。
我使用的第三方库是iOS图表,https://github.com/danielgindi/Charts
for (_, GraphValue) in (param?.enumerated())! {
var lineChartEntry = [ChartDataEntry]()
for items in GraphValue{
let value = ChartDataEntry(x:(items.xValue!/60), y: items.yValue!)
lineChartEntry.append(value)
}
let line1 = LineChartDataSet(values: lineChartEntry, label: "")
line1.drawCirclesEnabled = false
line1.colors = [UIColor(red: 154/255, green: 42/255, blue: 16/255, alpha: 1)]
line1.drawValuesEnabled = false
line1.lineWidth = 2
let graphValue = GraphValue[0]
if (graphValue.isDottedLine){
line1.lineDashLengths = [3,3]
}
line1.mode = .cubicBezier
data.addDataSet(line1)
chartview.data = data
}
问题图像附在此处 Image