iOS Charts - always show limit line -


i'm using "charts" library (by daniel gindi) on ios.

i draw linechartview (no issue there), , want add limit line represent target value:

let targetline = chartlimitline(limit: targetvalue, label: "") linechartview.leftaxis.addlimitline(targetline) 

the issue have is: if y-values of chart far target, limit line doesn't show on chart.

examples:

  • with target of 80, , last value 59: limit line not show. limit line not appearing

  • with target of 80, , last value 79: limit line show. limit line appearing

how can make sure limit line appear, no matter y-values are?

appendix : here rest of drawing code, it's standard:

let chartview = linechartview() chartview.backgroundcolor = uicolor.whitecolor()  chartview.dragenabled = false chartview.doubletaptozoomenabled = false chartview.pinchzoomenabled = false chartview.highlightpertapenabled = false  chartview.descriptiontext = "" chartview.legend.enabled = false chartview.rightaxis.enabled = false  // set y axis let yaxis = chartview.leftaxis yaxis.removealllimitlines() yaxis.drawzerolineenabled = true yaxis.drawlimitlinesbehinddataenabled = true yaxis.valueformatter = yvaluesformatter  // set x axis let xaxis = chartview.xaxis xaxis.labelposition = .bottom xaxis.drawlabelsenabled = true xaxis.drawlimitlinesbehinddataenabled = true xaxis.avoidfirstlastclippingenabled = true   // create new dataset let dataset = linechartdataset(yvals: entries, label: "") dataset.drawvaluesenabled = false dataset.linewidth = 2 dataset.colors = [uicolor.customblue] dataset.circleradius = 5 dataset.circlecolors = [uicolor.customblue] dataset.drawcircleholeenabled = false dataset.fillcolor = uicolor.cityzenaccent dataset.fillalpha = 0.5 dataset.drawfilledenabled = (charttype == .linefill) ? true : false  let data = linechartdata(xvals: xvalues, datasets: [dataset]) chartview.data = data 

the code limit lines takes place after that.

thanks

  /// if chart zoomed out, return true     open var isfullyzoomedout: bool     {         return isfullyzoomedoutx && isfullyzoomedouty     }      /// - returns: `true` if chart zoomed out on it's y-axis (vertical).     open var isfullyzoomedouty: bool     {         return !(_scaley > _minscaley || _minscaley > 1.0)     } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -