Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacked bar always show last value #2592

Closed
icefox57 opened this issue Jul 10, 2017 · 4 comments
Closed

Stacked bar always show last value #2592

icefox57 opened this issue Jul 10, 2017 · 4 comments

Comments

@icefox57
Copy link

icefox57 commented Jul 10, 2017

I want to create a stacked bar
i followed the demo finish the coding.
but stacked bar always show last value.

so i remove my value and use static value , but same problem.
could anyone help me ?

func bulidBarChartDataSet(dataPoints: [String], values: [[Double]] , labels:[String]) -> BarChartDataSet {

    `var dataEntries: [BarChartDataEntry] = []
    
    for i in 0..<dataPoints.count {
        
        let d1:Double = 23.3
        let d2:Double = 41.2
        let demoV = [d1,d2]
        
        let dataEntry = BarChartDataEntry(x: Double(i), yValues: demoV)//values[i])
        dataEntries.append(dataEntry)
    }
    
    let chartDataSet = BarChartDataSet(values: dataEntries, label: "")
    chartDataSet.stackLabels = labels
    chartDataSet.colors = [RandomFlatColor(),RandomFlatColor()]
    chartDataSet.valueFont = NSUIFont.systemFont(ofSize: 11)
    return chartDataSet
}`

this is what i got now.
4d6d5815-2ee0-4861-8fa4-1b4e2a05f85a

@thierryH91200
Copy link
Contributor

no problem for me

You took what demo?

capture d ecran 2017-07-10 a 10 37 39

   // MARK: BarChartDataEntry
    var yVals = [BarChartDataEntry]()
    for i in 0..<count
    {
        let d1:Double = 23.3
        let d2:Double = 41.2
        let demoV = [d1,d2]
        
        let dataEntry = BarChartDataEntry(x: Double(i), yValues: demoV)//values[i])
        yVals.append(dataEntry)
        
    }

@icefox57
Copy link
Author

i only found oc demo at Chart's github home page.
Is there swift demo?

@icefox57
Copy link
Author

I found my problem!.
chartView.autoScaleMinMaxEnabled = true
remove this line everything works perfect

@thierryH91200
Copy link
Contributor

i only found oc demo at Chart's github home page.
Is there swift demo?

yes in pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants