Charts: Line not showing in LineChart

Created on 14 Jun 2017  路  4Comments  路  Source: danielgindi/Charts

I am trying to draw a line chart but I am not able to get a line. Everything else seem to be responding to my data i.e. axis scale, label color etc.

Am I doing something wrong or is this a bug?

    var dataEntries: [ChartDataEntry] = []

    for i in 1...5 {
        let dataEntry = ChartDataEntry(x: Double(i), y: Double(i))
        dataEntries += [dataEntry]
    }

    let chartDataset = LineChartDataSet(values: dataEntries, label: "Test")

    var datasets = [IChartDataSet]()
    datasets += [chartDataset]

    let chartData = ChartData(dataSets: datasets)
    chartView.data = chartData

Most helpful comment

For other people who have same problem: (Line not showing, Line disappearing on zoom)

#Make sure your xAxis data is ordered.

All 4 comments

modify
var datasets = LineChartDataSet
datasets += [chartDataset]

let chartData = LineChartData(dataSets: datasets)
chartView.data = chartData

That still does not solve the problem. No line in the graph, but doing debugging it seems that the data is in "chartData"

Sorry....me being a newbie messing up the different data types.

For other people who have same problem: (Line not showing, Line disappearing on zoom)

#Make sure your xAxis data is ordered.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bharati555 picture Bharati555  路  4Comments

Aungbandlab picture Aungbandlab  路  4Comments

deepumukundan picture deepumukundan  路  3Comments

kwstasna picture kwstasna  路  3Comments

Shunshine07 picture Shunshine07  路  3Comments