Skip to content

Commit b7a7a8f

Browse files
committed
Optimize AAOptions samples
1 parent 6dd8846 commit b7a7a8f

File tree

4 files changed

+38
-22
lines changed

4 files changed

+38
-22
lines changed

AAInfographics/AAOptionsModel/AALayoutAlgorithm.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class AALayoutAlgorithm: AAObject {
1212
public var seriesInteraction: Bool?
1313
public var dragBetweenSeries: Bool?
1414
public var parentNodeLimit: Bool?
15+
public var enableSimulation: Bool?
1516

1617
@discardableResult
1718
public func gravitationalConstant(_ prop: Any?) -> AALayoutAlgorithm {
@@ -43,6 +44,12 @@ public class AALayoutAlgorithm: AAObject {
4344
return self
4445
}
4546

47+
@discardableResult
48+
public func enableSimulation(_ prop: Bool?) -> AALayoutAlgorithm {
49+
enableSimulation = prop
50+
return self
51+
}
52+
4653
public override init() {
4754

4855
}

AAInfographicsDemo/Demo/AAChartModel/Composer/ChartSampleProvider.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ class ChartSampleProvider: NSObject {
141141
MixedTypesChartOptionsComposer.polarThermometerChart(),
142142
MixedTypesChartOptionsComposer.polarLollipopChart(),
143143

144+
BubbleLegendChartOptionsComposer.bubbleLegendChart(),
145+
BubbleLegendChartOptionsComposer.customBubbleLegendChart(),
146+
BubbleLegendChartOptionsComposer.packedbubbleChart(),
147+
BubbleLegendChartOptionsComposer.packedbubbleSplitChart(),
148+
BubbleLegendChartOptionsComposer.packedbubbleSpiralChart(),
149+
150+
BubbleChartOptionsComposer.punchCardChart(),
151+
BubbleChartOptionsComposer.punchCardChart2(),
152+
BubbleChartOptionsComposer.punchCardChart3(),
153+
144154
AreaChartOptionsVC.configureComplicatedCustomAreasplineChart(),//复杂自定义曲线填充图 1
145155
AreaChartOptionsVC.configureComplicatedCustomAreasplineChart2(),//复杂自定义曲线填充图 2
146156
AreaChartOptionsVC.configureComplicatedCustomAreasplineChart3(),//复杂自定义曲线填充图 3
@@ -180,15 +190,7 @@ class ChartSampleProvider: NSObject {
180190

181191
MultiYAxesChartOptionsVC.disableGroupingBoxplotMixedScatterChart(),
182192

183-
BubbleLegendChartOptionsComposer.bubbleLegendChart(),
184-
BubbleLegendChartOptionsComposer.customBubbleLegendChart(),
185-
BubbleLegendChartOptionsComposer.packedbubbleChart(),
186-
BubbleLegendChartOptionsComposer.packedbubbleSplitChart(),
187-
BubbleLegendChartOptionsComposer.packedbubbleSpiralChart(),
188-
189-
BubbleChartOptionsComposer.punchCardChart(),
190-
BubbleChartOptionsComposer.punchCardChart2(),
191-
BubbleChartOptionsComposer.punchCardChart3(),
193+
192194

193195

194196

AAInfographicsDemo/Demo/AAChartModel/Composer/SpecialChartComposer.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,18 @@ class SpecialChartComposer {
156156
.yAxisTitle("")
157157
.yAxisGridLineWidth(0)
158158
.colorsTheme([
159-
AAGradientColor.radialGradient(position: .topCenter, startColor: AAColor.red, endColor: AAColor.green),
159+
// AAGradientColor.radialGradient(position: .topCenter, startColor: AAColor.red, endColor: AAColor.green),
160160
AAGradientColor.deepSea,
161-
AAGradientColor.lemonDrizzle
161+
AAGradientColor.lemonDrizzle,
162+
AAGradientColor.wroughtIron,
162163
])
163164
.series([
164165
AASeriesElement()
165166
.name("BubbleOne")
166167
.colorByPoint(true)
167-
.marker(AAMarker()
168-
.lineColor(AAColor.red)
169-
.lineWidth(3))
168+
// .marker(AAMarker()
169+
// .lineColor(AAColor.red)
170+
// .lineWidth(3))
170171
.data([
171172
[97, 36, 79],
172173
[94, 74, 60],
@@ -183,9 +184,9 @@ class SpecialChartComposer {
183184
,
184185
AASeriesElement()
185186
.name("BubbleTwo")
186-
.marker(AAMarker()
187-
.lineColor(AAColor.blue)
188-
.lineWidth(3))
187+
// .marker(AAMarker()
188+
// .lineColor(AAColor.blue)
189+
// .lineWidth(3))
189190
.data([
190191
[25, 60, 87],
191192
[2, 75, 59],
@@ -202,9 +203,9 @@ class SpecialChartComposer {
202203
,
203204
AASeriesElement()
204205
.name("BubbleThree")
205-
.marker(AAMarker()
206-
.lineColor(AAColor.yellow)
207-
.lineWidth(3))
206+
// .marker(AAMarker()
207+
// .lineColor(AAColor.yellow)
208+
// .lineWidth(3))
208209
.data([
209210
[47, 47, 21],
210211
[20, 12, 66],

AAInfographicsDemo/Demo/AAOptions/BubbleLegendChartOptionsComposer.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class BubbleLegendChartOptionsComposer {
6161
*/
6262
class func bubbleLegendChart() -> AAOptions {
6363
AAOptions()
64+
.title(AATitle()
65+
.text("Bubble Legend"))
6466
.chart(AAChart()
6567
.type(.bubble))
6668
.legend(AALegend()
@@ -162,6 +164,8 @@ class BubbleLegendChartOptionsComposer {
162164
*/
163165
class func customBubbleLegendChart() -> AAOptions {
164166
AAOptions()
167+
.title(AATitle()
168+
.text("Bubble Legend"))
165169
.chart(AAChart()
166170
.type(.bubble))
167171
.legend(AALegend()
@@ -225,7 +229,8 @@ class BubbleLegendChartOptionsComposer {
225229
.zMax(1000)
226230
.layoutAlgorithm(AALayoutAlgorithm() //packedbubbleChart 和 packedbubbleSplitChart 只有layoutAlgorithm这一段不一样
227231
.gravitationalConstant(0.02)
228-
.splitSeries(false))
232+
.splitSeries(false)
233+
.enableSimulation(false))
229234
.dataLabels(AADataLabels()
230235
.enabled(true)
231236
.format("{point.name}")
@@ -253,7 +258,8 @@ class BubbleLegendChartOptionsComposer {
253258
.splitSeries(true)
254259
.seriesInteraction(false)
255260
.dragBetweenSeries(true)
256-
.parentNodeLimit(true))
261+
.parentNodeLimit(true)
262+
.enableSimulation(false))
257263
.dataLabels(AADataLabels()
258264
.enabled(true)
259265
.format("{point.name}")

0 commit comments

Comments
 (0)