Skip to content

Commit cfa8348

Browse files
committed
Fix #505
1 parent f63878d commit cfa8348

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

AAInfographics/AAChartCreator/AAChartView.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ public class AAChartView: WKWebView {
190190

191191

192192
private func drawChart() {
193-
let jsStr = "loadTheHighChartView('\(optionsJson ?? "")','\(contentWidth ?? 0)','\(contentHeight ?? 0)')"
193+
//添加 `frame.size.height`, 是为了解决新版 Highcharts 的图表的高度 height 不会自适应 container 的问题
194+
//Add `frame.size.height` to solve the problem that the height of the new version of Highcharts chart will not adapt to the container
195+
let jsStr = "loadTheHighChartView('\(optionsJson ?? "")','\(contentWidth ?? 0)','\(contentHeight ?? frame.size.height)')"
194196
safeEvaluateJavaScriptString(jsStr)
195197
}
196198

@@ -248,8 +250,14 @@ public class AAChartView: WKWebView {
248250
}
249251

250252
private func configureOptionsJsonStringWithAAOptions(_ aaOptions: AAOptions) {
253+
//添加 `frame.size.height`, 是为了解决新版 Highcharts 的图表的高度 height 不会自适应 container 的问题
254+
//Add `frame.size.height` to solve the problem that the height of the new version of Highcharts chart will not adapt to the container
255+
if aaOptions.chart?.height == nil {
256+
aaOptions.chart?.height = frame.size.height
257+
}
258+
251259
if isClearBackgroundColor == true {
252-
aaOptions.chart?.backgroundColor = "rgba(0,0,0,0)"
260+
aaOptions.chart?.backgroundColor = AAColor.clear
253261
}
254262

255263
if clickEventEnabled == true {

0 commit comments

Comments
 (0)