Skip to content

Commit bf1a25e

Browse files
committed
Add a property named floating for AALegend and correct triple Y axes sample chart
1 parent f6677ee commit bf1a25e

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

AAInfographics/AAOptionsModel/AALegend.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public class AALegend: AAObject {
4848
public var symbolWidth: Float?
4949
public var x: Float?
5050
public var y: Float?
51+
public var floating: Bool?
5152

5253
@discardableResult
5354
public func layout(_ prop: AAChartLayoutType?) -> AALegend {
@@ -133,6 +134,12 @@ public class AALegend: AAObject {
133134
return self
134135
}
135136

137+
@discardableResult
138+
public func floating(_ prop: Bool?) -> AALegend {
139+
floating = prop
140+
return self
141+
}
142+
136143
public override init () {
137144

138145
}

AAInfographicsDemo/Demo/AdditionalContent/DrawChartWithAAOptionsVC.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -989,14 +989,13 @@ function () {
989989
.enabled(true)//设置 y 轴是否显示数字
990990
.format("{value}°C")
991991
.style(AAStyle()
992-
.color(colorsThemeArr[0])//yAxis Label font color
992+
.color(colorsThemeArr[2])//yAxis Label font color
993993
))
994994
.title(AATitle()
995995
.text("温度")
996996
.style(AAStyle()
997-
.color(colorsThemeArr[0])))
997+
.color(colorsThemeArr[2])))
998998
.opposite(true)
999-
1000999

10011000
let yAxis2 = AAYAxis()
10021001
.visible(true)
@@ -1005,12 +1004,12 @@ function () {
10051004
.enabled(true)//设置 y 轴是否显示数字
10061005
.format("{value}°mm")
10071006
.style(AAStyle()
1008-
.color(colorsThemeArr[1])//yAxis Label font color
1007+
.color(colorsThemeArr[0])//yAxis Label font color
10091008
))
10101009
.title(AATitle()
10111010
.text("降雨量")
10121011
.style(AAStyle()
1013-
.color(colorsThemeArr[1])))
1012+
.color(colorsThemeArr[0])))
10141013

10151014
let yAxis3 = AAYAxis()
10161015
.visible(true)
@@ -1019,21 +1018,24 @@ function () {
10191018
.enabled(true)//设置 y 轴是否显示数字
10201019
.format("{value}°mb")
10211020
.style(AAStyle()
1022-
.color(colorsThemeArr[2])//yAxis Label font color
1021+
.color(colorsThemeArr[1])//yAxis Label font color
10231022
))
10241023
.title(AATitle()
10251024
.text("海平面气压")
10261025
.style(AAStyle()
1027-
.color(colorsThemeArr[2])))
1026+
.color(colorsThemeArr[1])))
1027+
.opposite(true)
1028+
10281029

10291030
let aaTooltip = AATooltip()
10301031
.enabled(true)
10311032
.shared(true)
10321033

10331034
let aaLegend = AALegend()
10341035
.enabled(true)
1036+
.floating(true)
10351037
.layout(.vertical)
1036-
.align(.center)
1038+
.align(.left)
10371039
.x(80)
10381040
.verticalAlign(.top)
10391041
.y(55)
@@ -1048,7 +1050,7 @@ function () {
10481050

10491051
let element2 = AASeriesElement()
10501052
.name("海平面气压")
1051-
.type(.spline)
1053+
.type(.line)
10521054
.yAxis(2)
10531055
.data([1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2, 1013.1, 1016.9, 1018.2, 1016.7])
10541056
.dashStyle(.shortDot)
@@ -1057,7 +1059,7 @@ function () {
10571059

10581060
let element3 = AASeriesElement()
10591061
.name("温度")
1060-
.type(.spline)
1062+
.type(.line)
10611063
.yAxis(0)
10621064
.data([7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6])
10631065
.tooltip(AATooltip()
@@ -1071,7 +1073,7 @@ function () {
10711073
.yAxisArray([yAxis1,yAxis2,yAxis3])
10721074
.tooltip(aaTooltip)
10731075
.legend(aaLegend)
1074-
.series([element1,element2,element3])
1076+
.series([element1,element2,element3,])
10751077

10761078
return aaOptions
10771079
}

0 commit comments

Comments
 (0)