Swift ios-charts format Y axis Issue -


i using ios charts framework , have formatted xaxis show date. have tried format yaxis show false , positive strings. still date on both xaxis , yaxis. have spent lot of time on can please?

formatter

@objc(linechartformatter) public class linechartformatter: nsobject, iaxisvalueformatter{    var dayschosen = int()   var months = [string]()   let analysisviewcontroller: analysisviewcontroller = analysisviewcontroller()   let yaxis:yaxis = yaxis()    public func stringforvalue(_ value: double, axis: axisbase?) -> string {     dayschosen = analysisdatastruct.segmenttimechosen      if (axis == yaxis){           if value == 0.0 {             return "false"           } else {             return "true"           }         } else {           if dayschosen == 7 {             months = analysisdataarraystruct.sevendaysarray         } else if dayschosen == 30 {             months = analysisdataarraystruct.thirtydaysarray         } else {         months = analysisdataarraystruct.ninetydayarray       }       }      return months[int(value)]   } } 

inside chart class

let formato:linechartformatter = linechartformatter() let xaxis:xaxis = xaxis() let yaxis:yaxis = yaxis()  func displaybottomchart(){  dispatchqueue.global(qos: .background).async {  //yaxis formatter positive , false strings   _ = ys2.enumerated().map{ x, y in return self.formato.stringforvalue(double(x), axis: self.yaxis)}   self.yaxis.valueformatter = self.formato  // xaxis formatter date string   _ = array(0...(numberofreadings - 1)).map { x in return self.formato.stringforvalue(double(x), axis: self.xaxis) }                   self.xaxis.valueformatter = self.formato   self.linechart2.xaxis.valueformatter = self.xaxis.valueformatter    let data2 = linechartdata()   let ds2 = linechartdataset(values: yse2, label: "")   data2.adddataset(ds2)   self.linechart2.data = data2    dispatchqueue.main.async {                       self.linechart2.animate(xaxisduration: 0.0, yaxisduration: 0.2) 

to explain left axis should have false , true values (0 = false 1 = true).

graph image.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -