swift3 - iOS Charts, wavy lines -
let's straight point: started use ios charts daniel gindi, can't reproduce wavy lines in line chart
(and please notice image picked form repository of ios charts!)
all this, simple straight lines no curves
and code in viewdidload used showing that:
let ys1 = array(1..<10).map { x in return sin(double(x) / 2.0 / 3.141 * 1.5) } let ys2 = array(1..<10).map { x in return cos(double(x) / 2.0 / 3.141) } let yse1 = ys1.enumerated().map { x, y in return chartdataentry(x: double(x), y: y) } let yse2 = ys2.enumerated().map { x, y in return chartdataentry(x: double(x), y: y) } let data = linechartdata() let ds1 = linechartdataset(values: yse1, label: "hello") ds1.colors = [nsuicolor.red] ds1.drawcirclesenabled = false ds1.drawvaluesenabled = false data.adddataset(ds1) let ds2 = linechartdataset(values: yse2, label: "world") ds2.colors = [nsuicolor.blue] ds2.drawcirclesenabled = false ds2.drawvaluesenabled = false data.adddataset(ds2) self.viewchart.data = data self.viewchart.gridbackgroundcolor = nsuicolor.white self.viewchart.chartdescription?.text = "linechart demo"
can me? thank you!
please check :
let ds1 = linechartdataset(values: yse1, label: "hello") ds1.colors = [nsuicolor.red] ds1.drawcirclesenabled = false ds1.drawvaluesenabled = false ds1.mode = .cubicbezier // add line data.adddataset(ds1) let ds2 = linechartdataset(values: yse2, label: "world") ds2.colors = [nsuicolor.blue] ds2.drawcirclesenabled = false ds2.drawvaluesenabled = false ds2.mode = .cubicbezier // add line data.adddataset(ds2)
wiki
Comments
Post a Comment