更改 HighCharts 的绘图区域颜色 Swift iOS
Change the plot area colour for HighCharts Swift iOS
当我在 Swift iOS 中切换到深色模式时,设置绘图区域的动态颜色似乎不起作用,尝试了以下解决方法,
let background = HIChart()
background.backgroundColor = HIColor(rgba: 139, green: 188, blue: 33, alpha: 0.1)
background.plotBackgroundColor = HIColor(rgba: 139, green: 188, blue: 33, alpha: 0.1)
//Setting for view also
chart: HIChartView!
chart.chartBackgroundColor = UIColor(named: "BackgroundColor")
chart.backgroundColor = UIColor(named: "BackgroundColor")
尝试测试此配置:
let options = HIOptions()
let chart = HIChart()
chart.type = "column"
chart.backgroundColor = HIColor(uiColor: .yellow)
options.chart = chart
let title = HITitle()
title.text = "Demo chart"
options.title = title
let plotOptions = HIPlotOptions()
plotOptions.series = HISeries()
let animation = HIAnimationOptionsObject()
animation.duration = 0
plotOptions.series.animation = animation
options.plotOptions = plotOptions
let series = HIColumn()
series.data = [49.9, 71.5, 106.4, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
options.series = [series]
当我在 Swift iOS 中切换到深色模式时,设置绘图区域的动态颜色似乎不起作用,尝试了以下解决方法,
let background = HIChart()
background.backgroundColor = HIColor(rgba: 139, green: 188, blue: 33, alpha: 0.1)
background.plotBackgroundColor = HIColor(rgba: 139, green: 188, blue: 33, alpha: 0.1)
//Setting for view also
chart: HIChartView!
chart.chartBackgroundColor = UIColor(named: "BackgroundColor")
chart.backgroundColor = UIColor(named: "BackgroundColor")
尝试测试此配置:
let options = HIOptions()
let chart = HIChart()
chart.type = "column"
chart.backgroundColor = HIColor(uiColor: .yellow)
options.chart = chart
let title = HITitle()
title.text = "Demo chart"
options.title = title
let plotOptions = HIPlotOptions()
plotOptions.series = HISeries()
let animation = HIAnimationOptionsObject()
animation.duration = 0
plotOptions.series.animation = animation
options.plotOptions = plotOptions
let series = HIColumn()
series.data = [49.9, 71.5, 106.4, 129.2, 144, 176, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
options.series = [series]