You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey!
I could successfully implement the framework to get a line chart but now I want to try to get get a candle stick chart, but the candle stick chart wont show up. The X and Y axis get created and align to the data I set, but the graph itself does not appear.
This is the code I am using:
class GraphCreation {
let chartData: [ChartData]
init(chartData: [ChartData]) {
self.chartData = chartData
}
func chartCreationLine(chartView: LineChartView) -> LineChartView {
var lineChartEntry = [ChartDataEntry]()
for i in 0..<chartData.count {
let value = ChartDataEntry(x: Double(i), y: chartData[i].open)
lineChartEntry.append(value)
}
let line1 = LineChartDataSet(values: lineChartEntry, label: "Number")
let data = LineChartData()
data.addDataSet(line1)
chartView.data = data
chartView.chartDescription?.text = "Chart"
return chartView
}
func chartCreationCandle(chartView: CandleStickChartView) -> CandleStickChartView {
var candleChartEntry = [CandleChartDataEntry]()
for i in 0..<chartData.count {
let value = CandleChartDataEntry(x: Double(i), shadowH: chartData[i].high, shadowL: chartData[i].low, open: chartData[i].open, close: chartData[i].close)
candleChartEntry.append(value)
}
let set1 = CandleChartDataSet(values: candleChartEntry, label: "Chart")
let data = CandleChartData()
data.addDataSet(set1)
chartView.data = data
chartView.chartDescription?.text = "Candle Stick"
return chartView
}
}
I of course looked at the demos already, but could not figure out what the problem is or what is missing.
I also set a chartView outlet in the Viewcontroller.
Thanks a lot!
The text was updated successfully, but these errors were encountered:
Hey!
I could successfully implement the framework to get a line chart but now I want to try to get get a candle stick chart, but the candle stick chart wont show up. The X and Y axis get created and align to the data I set, but the graph itself does not appear.
This is the code I am using:
I of course looked at the demos already, but could not figure out what the problem is or what is missing.
I also set a chartView outlet in the Viewcontroller.
Thanks a lot!
The text was updated successfully, but these errors were encountered: