我是使用Highcharts的新手。在iOS中使用它(与JS几乎相同),我有这段代码可以测试:
private func initChart(){
let chart = HIChart()
let chartOptions = HIOptions()
chartOptions.chart = chart
chart.type = "line"
chartOptions.title = HITitle()
chartOptions.title.text = "Auction Details"
chartOptions.subtitle = HISubtitle()
chartOptions.subtitle.text = "P&L Curves"
let xAxis = HIXAxis()
xAxis.title = HITitle()
xAxis.title.text = "Time"
xAxis.categories = ["10-01-2018", "23-03-2018", "10-04-2018", "30-04-2018", "01-05-2018", "14-09-2018", "10-011-2018", "22-11-2018"]
chartOptions.xAxis = [xAxis]
let yAxis = HIYAxis()
yAxis.title = HITitle()
yAxis.title.text = "Money"
yAxis.min = 0.0
chartOptions.yAxis = [yAxis]
let seriesRewards = HISeries()
seriesRewards.name = "Rewards"
seriesRewards.data = [["10-01-2018", 23.4], ["23-03-2018", 34.2], ["22-11-2018",7.9]]
let seriesPrice = HISeries()
seriesPrice.name = "Price"
seriesPrice.data = [["23-03-2018",42.4], ["23-03-2018",34.2], ["10-04-2018",61.1], ["01-05-2018",87.0], ["14-09-2018",25.9], ["22-11-2018",100.1], ["01-12-2018",95.9], ["22-12-2018",81.9]]
chartOptions.series = [seriesRewards, seriesPrice]
chartView.options = chartOptions
}
这运行得很好,但是我第一系列的分数与我所说的不符...请看下图:
我的问题是,seriesRewards的定义如下:
seriesRewards.data = [[“ 10-01-2018”,23.4],[“ 23-03-2018”,34.2], [“ 22-11-2018”,7.9]]
为什么最后一个点没有显示在图表的正确位置?
致谢