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

Horizontal Bar Chart lines not visible with two BarChartDataSet in chart data #2220

Closed
ghost opened this issue Mar 3, 2017 · 1 comment
Closed

Comments

@ghost
Copy link

ghost commented Mar 3, 2017

I am trying to show horizontal bar chart with two datasets and but when I run my code with shows the only text of lines but lines are not visible. I can see text animate but no lines.
This is my code:
chartView.noDataTextColor = .orange
chartView.chartDescription?.text = ""
let dataSet = getDataSet(budget: totalBudget, spending: totalSpend)
let chartData = BarChartData(dataSets: dataSet)
chartData.setValueTextColor(.white)
chartView.data = chartData

This is my getDataSet Method:
func getDataSet(budget: Double, spending: Double) -> [BarChartDataSet] {

    var budgetEntryList = [BarChartDataEntry]()
    let budgetEntry = BarChartDataEntry(x: budget, y: budget)
    budgetEntryList.append(budgetEntry)
    
    let budgetDataSet = BarChartDataSet(values: budgetEntryList, label: "Total Budget")
    budgetDataSet.setColor(.orange)
    
    var spendingEntryList = [BarChartDataEntry]()
    let spendEntry = BarChartDataEntry(x: spending, y: spending)
    spendingEntryList.append(spendEntry)
    
    let spendingDataSet = BarChartDataSet(values: spendingEntryList, label: "Total Spending")
    spendingDataSet.setColor(.green)
    
    return [budgetDataSet,spendingDataSet]
    
    }

screen shot 2017-03-03 at 7 16 00 pm

@liuxuan30
Copy link
Member

Take a look at ChartsDemo, there are examples already.

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

1 participant