Skip to content

Commit 0c888b7

Browse files
committed
Add pictorial chart type and demo support
Introduces the 'pictorial' chart type to AAChartModel and AAPlotOptions, with a new AAPictorial model for configuration. Adds demo composer and SVG path definitions for pictorial charts, updates legend and plugin provider for new chart type, and includes sample JSON series data and project file references.
1 parent 56f338d commit 0c888b7

File tree

13 files changed

+272
-0
lines changed

13 files changed

+272
-0
lines changed

AAInfographics-Pro/AAChartCreator/AAChartModel.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public enum AAChartType: String {
122122
case histogram
123123
case bullet
124124
case treegraph
125+
case pictorial
125126
/*---------------------AAInfogrphics-Pro---------------------*/
126127
}
127128

AAInfographics-Pro/AAChartCreator/AAChartViewPluginProvider.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public class ProPluginProvider: AAChartViewPluginProvider {
8888
"AATreemap",
8989
"AATreegraph"
9090
],
91+
AAChartType.pictorial.rawValue : ["AAPictorial"], // Icon-based charts
9192
]
9293

9394
public func getRequiredPluginPaths(for options: AAOptions) -> Set<String> {

AAInfographics-Pro/AAOptionsModel/AALegend.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ public class AALegend: AAObject {
9292
return self
9393
}
9494

95+
@discardableResult
96+
public func itemMarginBottom(_ prop: Float?) -> AALegend {
97+
itemMarginBottom = prop
98+
return self
99+
}
100+
95101
@discardableResult
96102
public func itemStyle(_ prop: AAItemStyle?) -> AALegend {
97103
itemStyle = prop

AAInfographics-Pro/AAOptionsModel/AAPlotOptions.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class AAPlotOptions: AAObject {
5050
public var packedbubble: AAPackedbubble?
5151
public var treemap: AATreemap?
5252
public var solidgauge: AASolidgauge?
53+
public var pictorial: AAPictorial?
5354
/*---------------------AAInfogrphics-Pro---------------------*/
5455

5556

@@ -144,6 +145,12 @@ public class AAPlotOptions: AAObject {
144145
solidgauge = prop
145146
return self
146147
}
148+
149+
@discardableResult
150+
public func pictorial(_ prop: AAPictorial) -> AAPlotOptions {
151+
pictorial = prop
152+
return self
153+
}
147154
/*---------------------AAInfogrphics-Pro---------------------*/
148155

149156

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//
2+
// AAPictorial.swift
3+
// AAInfographics-ProDemo
4+
//
5+
// Created by AnAn on 2025/9/23.
6+
//
7+
8+
public class AAPictorial: AAObject {
9+
10+
public var pointPadding: Float?
11+
public var groupPadding: Float?
12+
public var dataLabels: AADataLabels?
13+
public var stacking: String?
14+
public var paths: [AAPathsElement]?
15+
16+
@discardableResult
17+
public func pointPadding(_ value: Float?) -> AAPictorial {
18+
self.pointPadding = value
19+
return self
20+
}
21+
22+
@discardableResult
23+
public func groupPadding(_ value: Float?) -> AAPictorial {
24+
self.groupPadding = value
25+
return self
26+
}
27+
28+
@discardableResult
29+
public func dataLabels(_ value: AADataLabels?) -> AAPictorial {
30+
self.dataLabels = value
31+
return self
32+
}
33+
34+
@discardableResult
35+
public func stacking(_ value: String?) -> AAPictorial {
36+
self.stacking = value
37+
return self
38+
}
39+
40+
@discardableResult
41+
public func paths(_ value: [AAPathsElement]?) -> AAPictorial {
42+
self.paths = value
43+
return self
44+
}
45+
46+
}
47+
48+
49+
public class AAPathsElement: AAObject {
50+
51+
public var definition: String?
52+
public var max: Float?
53+
54+
@discardableResult
55+
public func definition(_ value: String?) -> AAPathsElement {
56+
self.definition = value
57+
return self
58+
}
59+
60+
@discardableResult
61+
public func max(_ value: Float?) -> AAPathsElement {
62+
self.max = value
63+
return self
64+
}
65+
66+
}

AAInfographics-ProDemo.xcodeproj/project.pbxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@
139139
84B13F3B289E2CA0007356C6 /* AAParallelAxes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B13F3A289E2CA0007356C6 /* AAParallelAxes.swift */; };
140140
84B13F3D289E5FAB007356C6 /* AABulletDataElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B13F3C289E5FAB007356C6 /* AABulletDataElement.swift */; };
141141
84DC910E2D2FDDB7002EDC1F /* CustomClickEventCallbackMessageVC2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DC910D2D2FDDB7002EDC1F /* CustomClickEventCallbackMessageVC2.swift */; };
142+
84DD6C322E823ECA00B3D195 /* AAPictorial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DD6C312E823ECA00B3D195 /* AAPictorial.swift */; };
143+
84DD6C362E8240EE00B3D195 /* AAPictorialChartComposer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DD6C352E8240EE00B3D195 /* AAPictorialChartComposer.swift */; };
144+
84DD6C382E8242C400B3D195 /* AAPictorialPaths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DD6C372E8242C400B3D195 /* AAPictorialPaths.swift */; };
145+
84DD6C3B2E8244E000B3D195 /* pictorial2Series.json in Resources */ = {isa = PBXBuildFile; fileRef = 84DD6C3A2E8244E000B3D195 /* pictorial2Series.json */; };
146+
84DD6C3C2E8244E000B3D195 /* pictorial1Series.json in Resources */ = {isa = PBXBuildFile; fileRef = 84DD6C392E8244E000B3D195 /* pictorial1Series.json */; };
142147
84DEB8B628FAE48300BF9423 /* AARelationshipChartVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DEB8B528FAE48300BF9423 /* AARelationshipChartVC.swift */; };
143148
84DEB8B828FAE4DF00BF9423 /* AAHeatOrTreeMapChartVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DEB8B728FAE4DF00BF9423 /* AAHeatOrTreeMapChartVC.swift */; };
144149
84DEB8BA28FAE4F300BF9423 /* AABubbleChartVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84DEB8B928FAE4F300BF9423 /* AABubbleChartVC.swift */; };
@@ -310,6 +315,11 @@
310315
84B13F3C289E5FAB007356C6 /* AABulletDataElement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AABulletDataElement.swift; sourceTree = "<group>"; };
311316
84B2386B283F6D4C00193B9A /* PackageBundlePathLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PackageBundlePathLoader.swift; sourceTree = "<group>"; };
312317
84DC910D2D2FDDB7002EDC1F /* CustomClickEventCallbackMessageVC2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomClickEventCallbackMessageVC2.swift; sourceTree = "<group>"; };
318+
84DD6C312E823ECA00B3D195 /* AAPictorial.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AAPictorial.swift; sourceTree = "<group>"; };
319+
84DD6C352E8240EE00B3D195 /* AAPictorialChartComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AAPictorialChartComposer.swift; sourceTree = "<group>"; };
320+
84DD6C372E8242C400B3D195 /* AAPictorialPaths.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AAPictorialPaths.swift; sourceTree = "<group>"; };
321+
84DD6C392E8244E000B3D195 /* pictorial1Series.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = pictorial1Series.json; sourceTree = "<group>"; };
322+
84DD6C3A2E8244E000B3D195 /* pictorial2Series.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = pictorial2Series.json; sourceTree = "<group>"; };
313323
84DEB8B528FAE48300BF9423 /* AARelationshipChartVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AARelationshipChartVC.swift; sourceTree = "<group>"; };
314324
84DEB8B728FAE4DF00BF9423 /* AAHeatOrTreeMapChartVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AAHeatOrTreeMapChartVC.swift; sourceTree = "<group>"; };
315325
84DEB8B928FAE4F300BF9423 /* AABubbleChartVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AABubbleChartVC.swift; sourceTree = "<group>"; };
@@ -474,6 +484,8 @@
474484
44D27DB1255A6CE300D0C636 /* SeriesJsonFiles */ = {
475485
isa = PBXGroup;
476486
children = (
487+
84DD6C392E8244E000B3D195 /* pictorial1Series.json */,
488+
84DD6C3A2E8244E000B3D195 /* pictorial2Series.json */,
477489
84A5691027FEC88700883553 /* packedbubbleSeries.json */,
478490
84A5690F27FEC88700883553 /* streamgraphSeries.json */,
479491
);
@@ -540,6 +552,7 @@
540552
84B13F32289D09EA007356C6 /* AAHeatmap.swift */,
541553
84B13F34289D12DF007356C6 /* AAData.swift */,
542554
84B13F3A289E2CA0007356C6 /* AAParallelAxes.swift */,
555+
84DD6C312E823ECA00B3D195 /* AAPictorial.swift */,
543556
);
544557
path = AAOptionsProModel;
545558
sourceTree = "<group>";
@@ -639,6 +652,8 @@
639652
84DEB8C128FAE58C00BF9423 /* AABubbleChartComposer.swift */,
640653
84DEB8C328FAE59F00BF9423 /* AAColumnVariantChartComposer.swift */,
641654
843E5E0C2E7AD52D0030D36E /* AATreegraphChartComposer.swift */,
655+
84DD6C352E8240EE00B3D195 /* AAPictorialChartComposer.swift */,
656+
84DD6C372E8242C400B3D195 /* AAPictorialPaths.swift */,
642657
);
643658
path = Composer;
644659
sourceTree = "<group>";
@@ -774,6 +789,8 @@
774789
84A5693927FEC89F00883553 /* treemapWithLevelsData.json in Resources */,
775790
84A5693A27FEC89F00883553 /* heatmapData.json in Resources */,
776791
84A5693127FEC89F00883553 /* sankeyData.json in Resources */,
792+
84DD6C3B2E8244E000B3D195 /* pictorial2Series.json in Resources */,
793+
84DD6C3C2E8244E000B3D195 /* pictorial1Series.json in Resources */,
777794
843E5E0F2E7AD6390030D36E /* treegraphData.json in Resources */,
778795
84526E0B2CEB401500EB2563 /* AABoost.js in Resources */,
779796
84A5694327FEC89F00883553 /* sunburst2Data.json in Resources */,
@@ -866,6 +883,7 @@
866883
84DEB8BE28FAE54500BF9423 /* AARelationshipChartComposer.swift in Sources */,
867884
844615B3283F580300E26DA4 /* AAPlotOptions.swift in Sources */,
868885
843E5E0D2E7AD52D0030D36E /* AATreegraphChartComposer.swift in Sources */,
886+
84DD6C382E8242C400B3D195 /* AAPictorialPaths.swift in Sources */,
869887
844615BC283F580300E26DA4 /* AAXAxis.swift in Sources */,
870888
27F872AB25E797690068380F /* ProjectBundlePathLoader.swift in Sources */,
871889
844615A7283F580300E26DA4 /* AAChart.swift in Sources */,
@@ -881,6 +899,7 @@
881899
844615A6283F580300E26DA4 /* AAMarker.swift in Sources */,
882900
844736082DA635E00040CCCE /* AABoostFractalChartComposer.swift in Sources */,
883901
844736102DA6994D0040CCCE /* AAFractalJuliaSetData.swift in Sources */,
902+
84DD6C322E823ECA00B3D195 /* AAPictorial.swift in Sources */,
884903
84B13EEB28990388007356C6 /* CustomClickEventCallbackMessageVC.swift in Sources */,
885904
8441A76126C2568F007EAAA7 /* AAExtension.swift in Sources */,
886905
844615B8283F580300E26DA4 /* AASubtitle.swift in Sources */,
@@ -912,6 +931,7 @@
912931
84526E092CEB3F1E00EB2563 /* AABoostChartVC.swift in Sources */,
913932
84B13F35289D12DF007356C6 /* AAData.swift in Sources */,
914933
844615AB283F580300E26DA4 /* AALegend.swift in Sources */,
934+
84DD6C362E8240EE00B3D195 /* AAPictorialChartComposer.swift in Sources */,
915935
844736282DAF90C60040CCCE /* AAChartView+API.swift in Sources */,
916936
44D27E0C255ADE1E00D0C636 /* AAOptionsSeries.swift in Sources */,
917937
84526E032CEB3BCD00EB2563 /* AABoost.swift in Sources */,
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// AAPictorialChartComposer.swift
3+
// AAInfographics-ProDemo
4+
//
5+
// Created by AnAn on 2025/9/23.
6+
//
7+
8+
import UIKit
9+
10+
class AAPictorialChartComposer: NSObject {
11+
12+
// Kelvin color temperature scale chart
13+
static func pictorial1Chart() -> AAOptions {
14+
return AAOptions()
15+
.chart(AAChart()
16+
.type(AAChartType.pictorial))
17+
.colors(["#B0FDFE", "#E3FED4", "#F9F492", "#FAF269", "#FAE146", "#FDA003"])
18+
.title(AATitle()
19+
.text("Kelvin color temperature scale chart"))
20+
.subtitle(AASubtitle())
21+
.xAxis(AAXAxis()
22+
.visible(true)
23+
.min(0.2))
24+
.yAxis(AAYAxis()
25+
.visible(true))
26+
.legend(AALegend()
27+
.align(AAChartAlignType.right)
28+
.floating(true)
29+
.itemMarginTop(5)
30+
.itemMarginBottom(5)
31+
.layout(AAChartLayoutType.vertical)
32+
// .margin(0)
33+
// .padding(0)
34+
.verticalAlign(AAChartVerticalAlignType.middle))
35+
.tooltip(AATooltip()
36+
.headerFormat("")
37+
.valueSuffix(" K"))
38+
.plotOptions(AAPlotOptions()
39+
.pictorial(AAPictorial()
40+
.pointPadding(0)
41+
.groupPadding(0)
42+
// .borderWidth(0)
43+
.dataLabels(AADataLabels()
44+
.enabled(true)
45+
.align(AAChartAlignType.center)
46+
.format("{y} K"))
47+
.stacking("percent")
48+
.paths([
49+
AAPathsElement()
50+
.definition(kWomanPath),
51+
AAPathsElement()
52+
.definition(kManPath)
53+
])))
54+
.series(AAOptionsSeries.pictorial2Series)
55+
}
56+
57+
static func pictorial2Chart() -> AAOptions {
58+
return AAOptions()
59+
.chart(AAChart()
60+
.type(AAChartType.pictorial))
61+
.title(AATitle()
62+
.text("Composition of the human body"))
63+
.xAxis(AAXAxis()
64+
.categories(["Woman", "Man"])
65+
.lineWidth(0)
66+
.opposite(true))
67+
.yAxis(AAYAxis()
68+
.visible(false)
69+
// .stackShadow(AAStackingShadow()
70+
// .enabled(true))
71+
.max(100))
72+
.legend(AALegend()
73+
.itemMarginTop(15)
74+
.itemMarginBottom(15)
75+
.layout(AAChartLayoutType.vertical)
76+
// .padding(0)
77+
.verticalAlign(AAChartVerticalAlignType.middle)
78+
.align(AAChartAlignType.center)
79+
// .margin(0)
80+
)
81+
.tooltip(AATooltip()
82+
.headerFormat(""))
83+
.plotOptions(AAPlotOptions()
84+
.pictorial(AAPictorial()
85+
.pointPadding(0)
86+
.groupPadding(0)
87+
.dataLabels(AADataLabels()
88+
.enabled(true)
89+
.align(AAChartAlignType.center)
90+
.format("{y} %"))
91+
.stacking("normal")
92+
.paths([
93+
AAPathsElement()
94+
.definition(kBulbPath)
95+
])))
96+
.series(AAOptionsSeries.pictorial2Series)
97+
}
98+
99+
}

0 commit comments

Comments
 (0)