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

Double Bar Lines #3013

Closed
martheli opened this issue Nov 16, 2017 · 1 comment
Closed

Double Bar Lines #3013

martheli opened this issue Nov 16, 2017 · 1 comment

Comments

@martheli
Copy link

martheli commented Nov 16, 2017

This is my code that sets up the Bar Chart:

func setChart(chartview: BarChartView, xarray: [String], yarray: [Double], count: Int){

        var dataEntries: [BarChartDataEntry] = []
 
        for i in 0..<xarray.count {
            
            let dataEntry = BarChartDataEntry(x: Double(i), y: Double(yarray[i]))
            
            dataEntries.append(dataEntry)
        }
        
        let chartDataSet = BarChartDataSet(values: dataEntries, label: "")
        
        chartDataSet.drawValuesEnabled = true
        
        let chartData = BarChartData(dataSet: chartDataSet)
        
        let format = NumberFormatter()
        
        format.numberStyle = .none
        
        let formatter = DefaultValueFormatter(formatter: format)
        
        chartData.setValueFormatter(formatter)
        
        chartview.xAxis.valueFormatter = IndexAxisValueFormatter(values:xarray)
        
        chartview.xAxis.granularityEnabled = true
        
        chartview.xAxis.labelPosition = .bottom
        
        chartview.chartDescription?.enabled = false
        
        chartview.rightAxis.axisMinimum = 0.0
        
        chartview.leftAxis.axisMinimum = 0.0
    
        chartview.legend.enabled = false
        
        chartview.xAxis.drawGridLinesEnabled = false
        
        chartview.rightAxis.drawLabelsEnabled = false
        
        chartview.rightAxis.drawGridLinesEnabled = true
        
        chartview.xAxis.setLabelCount(count, force: false)
        
        chartview.leftAxis.axisMaximum = (yarray.max()! + 5)
        
        chartview.data = chartData

        }

Below is the chart and you can see there are double grid lines. How do I make it so it only shows one line per each Y value?

img_0039

@JayMehta711
Copy link

Hello @martheli
We are also facing same issue. Let me know how you are resolve that ?

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