ShinobiCharts: No primary y-axis to customize


#1

I get this Error for a couple hour. I want to make a function which setup the custom view, the scrollview and the donut. Below my sninppet code :

var donutArrival: ShinobiChart?
var viewArrival: UIView = UIView()


func setupDonut(donut: ShinobiChart, viewForDonut: UIView/*, x: Int, y: Int, width: Int , height: Int*/) {

    var views: UIView = viewForDonut
    var charts: ShinobiChart = donut
    
    /* setting up custom view  */
    views = UIView(frame: CGRect(x: 10, y: 15, width: 400, height: 600))
    views.backgroundColor = UIColor.gray
    
    charts = ShinobiChart(frame: CGRect.init(x: (0), y: (0), width: (views.frame.size.width), height: (views.frame.size.height)))

    views.addSubview(charts)
    
    scrollView.addSubview(views)
    
    self.view.addSubview(scrollView)
    
    charts.delegate = self
    charts.datasource = self
    
    charts.loadDataInBackground = true

    //        chart.titleLabel.text = title
    //        chart.titleLabel.font = UIFont(name: "Futura", size: 10)
    charts.overlapChartTitle = true
    charts.legend.isHidden = false
    charts.legend.position = .bottomMiddle

    chartTheme = SChartiOS7Theme()
    //        chartTheme?.chartStyle.backgroundColor = UIColor.white

    //        chartTheme?.chartStyle.backgroundColor = UIColor(white: 1, alpha: 1)
    //        chartTheme?.chartStyle.plotAreaBackgroundColor = UIColor(white: 1, alpha: 1)
    //        chartTheme?.donutCrustThickness = 1
    
    charts.applyTheme(chartTheme!)
   //        charts.reloadData()


    }

The view is show up but not with the donut. Its work before when i split up the code one by one but now is doest work in one function. Below the log :

From: ShinobiChart at 0x7fc753c1c6e0
2017-05-26 13:53:57.832 LEARN ORDER TAKER[5784:123258] 
ShinobiCharts: No primary y-axis to customize.
From: ShinobiChart at 0x7fc753c1c6e0

Any answer and suggest will help for me. Thanks in advance


#2

Hi MrX,

I can’t reproduce the log message using the code you’ve given. The log message suggests your code is trying to access a y-axis somewhere, but a donut chart doesn’t have any axes.

Is there any other code that may be relevant?

Alison


#3

Hi aclarke,
I know but the log say that -.- But i solved it with chart.redraw() when my data finished loaded. But its still not solved fully.

I will share the code and SS to make clear. Thanks aclarke

MrM