ios - how to set xAxis label to show dates with interval of 1 day or week using charts? Also issue when showing yAxis value -
my code bar chart shown below:
override func viewdidload() { super.viewdidload() ibviewgarph.delegate = self months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"] let unitssold = [1200.0, 1400.0, 600.0, 3500.0, 1200.0, 1600.0, 1400.0, 1800.0, 1200.0, 1400.0, 1500.0, 1400.0] setchart(months, values: unitssold) } func setchart(datapoints: [string], values: [double]) { ibviewgarph.leftaxis.axisminvalue = 500 ibviewgarph.leftaxis.axismaxvalue = 3500 var dataentries: [barchartdataentry] = [] in 0..<datapoints.count { let dataentry = barchartdataentry(value: values[i], xindex: i) dataentries.append(dataentry) } let chartdataset = barchartdataset(yvals: dataentries, label: "units sold") let chartdata = barchartdata(xvals: months, dataset: chartdataset) ibviewgarph.data = chartdata ibviewgarph.descriptiontext = "" chartdataset.colors = [uicolor(red: 230/255, green: 126/255, blue: 34/255, alpha: 1)] ibviewgarph.xaxis.labelposition = .bottom ibviewgarph.rightaxis.drawlabelsenabled = false ibviewgarph.animate(xaxisduration: 2.0, yaxisduration: 2.0) }
issue can see image , yaxis showing 2 lines , dont know issue , want set xaxis labels show dates ex: "28/8/2016" interval of 1 day or 1 week , how pass custom labels xaxis same have done yaxis? may similar question :chart - controlling axis interval, spacing , visibility dont know work around question have put numbers
Comments
Post a Comment