Skip to content

Commit 42871c9

Browse files
authored
Merge pull request #540 from AAChartModel/dev
Dev
2 parents 65a8f66 + b4ff5dc commit 42871c9

File tree

5 files changed

+626
-11
lines changed

5 files changed

+626
-11
lines changed

AAInfographics/AAChartCreator/AAChartView+API.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
*/
3232

33+
import Foundation
34+
3335
// MARK: - Configure Chart View Content With AAChartModel
3436
@available(iOS 10.0, macCatalyst 13.1, macOS 10.13, *)
3537
extension AAChartView {
@@ -69,12 +71,16 @@ extension AAChartView {
6971
public func aa_drawChartWithChartOptions(_ aaOptions: AAOptions) {
7072
if optionsJson == nil {
7173
configureOptionsJsonStringWithAAOptions(aaOptions)
72-
let path = BundlePathLoader()
74+
guard let path = BundlePathLoader()
7375
.path(forResource: "AAChartView",
7476
ofType: "html",
75-
inDirectory: "AAJSFiles.bundle")
76-
let urlStr = NSURL.fileURL(withPath: path!)
77-
let urlRequest = NSURLRequest(url: urlStr) as URLRequest
77+
inDirectory: "AAJSFiles.bundle") else {
78+
// Consider more robust error handling or logging framework for production code
79+
print("Error: AAChartView.html not found in AAJSFiles.bundle. Chart cannot be loaded.")
80+
return
81+
}
82+
let fileURL = URL(fileURLWithPath: path) // 'path' is a non-optional String here
83+
let urlRequest = URLRequest(url: fileURL)
7884
load(urlRequest)
7985
} else {
8086
aa_refreshChartWholeContentWithChartOptions(aaOptions)
@@ -258,15 +264,15 @@ extension AAChartView {
258264
/// Show the series element content with index
259265
///
260266
/// - Parameter elementIndex: elementIndex element index
261-
public func aa_showTheSeriesElementContentWithSeriesElementIndex(_ elementIndex: NSInteger) {
267+
public func aa_showTheSeriesElementContentWithSeriesElementIndex(_ elementIndex: Int) {
262268
let jsStr = "showTheSeriesElementContentWithIndex('\(elementIndex)');"
263269
safeEvaluateJavaScriptString(jsStr)
264270
}
265271

266272
/// Hide the series element content with index
267273
///
268274
/// - Parameter elementIndex: element index
269-
public func aa_hideTheSeriesElementContentWithSeriesElementIndex(_ elementIndex: NSInteger) {
275+
public func aa_hideTheSeriesElementContentWithSeriesElementIndex(_ elementIndex: Int) {
270276
let jsStr = "hideTheSeriesElementContentWithIndex('\(elementIndex)');"
271277
safeEvaluateJavaScriptString(jsStr as String)
272278
}
@@ -311,7 +317,6 @@ extension AAChartView {
311317
let jsStr = "redrawWithAnimation('\(animation)')"
312318
safeEvaluateJavaScriptString(jsStr)
313319
}
314-
315320
}
316321

317322

AAInfographics/AAChartCreator/AAChartViewPluginProvider.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import Foundation
2-
31
// Protocol defining the responsibility for providing required plugin paths
42
@available(iOS 10.0, macCatalyst 13.1, macOS 10.13, *)
53
public protocol AAChartViewPluginProvider {
@@ -110,8 +108,7 @@ public class ProPluginProvider: AAChartViewPluginProvider {
110108
return nil
111109
}
112110

113-
let urlStr = NSURL.fileURL(withPath: path)
114-
return urlStr.path
111+
return path
115112
}
116113
}
117114

AAInfographicsDemo.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
84903C8E2DB8D6A40029FE5A /* EmojiParticleAnimationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84903C8D2DB8D6A40029FE5A /* EmojiParticleAnimationVC.swift */; };
120120
84903C9B2DB9F0680029FE5A /* BubbleChartOptionsComposer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84903C9A2DB9F0680029FE5A /* BubbleChartOptionsComposer.swift */; };
121121
84903C9D2DBA0BD20029FE5A /* AAChartView+ScreenRotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84903C9C2DBA0BD20029FE5A /* AAChartView+ScreenRotation.swift */; };
122+
84903CA02DBA24B50029FE5A /* EmojiProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84903C9F2DBA24B50029FE5A /* EmojiProvider.swift */; };
123+
84903CAE2DBA2E5C0029FE5A /* LissajousCurveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84903CAD2DBA2E5C0029FE5A /* LissajousCurveViewController.swift */; };
122124
84A9FB7E28C9BC0E00240C11 /* AAScatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A9FB7C28C9BC0E00240C11 /* AAScatter.swift */; };
123125
84AE6B1F26A58380001F0755 /* AADateUTCTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AE6B1E26A58380001F0755 /* AADateUTCTool.swift */; };
124126
84B68246266DB09100957FC5 /* AAChartSymbolConstant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B68245266DB09100957FC5 /* AAChartSymbolConstant.swift */; };
@@ -369,6 +371,8 @@
369371
84903C8D2DB8D6A40029FE5A /* EmojiParticleAnimationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiParticleAnimationVC.swift; sourceTree = "<group>"; };
370372
84903C9A2DB9F0680029FE5A /* BubbleChartOptionsComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BubbleChartOptionsComposer.swift; sourceTree = "<group>"; };
371373
84903C9C2DBA0BD20029FE5A /* AAChartView+ScreenRotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AAChartView+ScreenRotation.swift"; sourceTree = "<group>"; };
374+
84903C9F2DBA24B50029FE5A /* EmojiProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiProvider.swift; sourceTree = "<group>"; };
375+
84903CAD2DBA2E5C0029FE5A /* LissajousCurveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LissajousCurveViewController.swift; sourceTree = "<group>"; };
372376
84A9FB7C28C9BC0E00240C11 /* AAScatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AAScatter.swift; sourceTree = "<group>"; };
373377
84AE6B1E26A58380001F0755 /* AADateUTCTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AADateUTCTool.swift; sourceTree = "<group>"; };
374378
84B68245266DB09100957FC5 /* AAChartSymbolConstant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AAChartSymbolConstant.swift; sourceTree = "<group>"; };
@@ -643,10 +647,12 @@
643647
84595DE72B4698D600F69273 /* PolarChartOptionsVC.swift */,
644648
8437AE212DB61965003D4D84 /* MixedTypesChartOptionsVC.swift */,
645649
84903C8D2DB8D6A40029FE5A /* EmojiParticleAnimationVC.swift */,
650+
84903CAD2DBA2E5C0029FE5A /* LissajousCurveViewController.swift */,
646651
2DC1178786788013590AD7CC /* BubbleLegendChartOptionsComposer.swift */,
647652
84526E342CF4621D00EB2563 /* XAxisYAxisTypeOptionsComposer.swift */,
648653
8437AE1F2DB5F11C003D4D84 /* MixedTypesChartOptionsComposer.swift */,
649654
84903C9A2DB9F0680029FE5A /* BubbleChartOptionsComposer.swift */,
655+
84903C9F2DBA24B50029FE5A /* EmojiProvider.swift */,
650656
);
651657
path = AAOptions;
652658
sourceTree = "<group>";
@@ -1070,6 +1076,7 @@
10701076
84DEA0D82846013F00D0206F /* CustomTouchEndEventCallbackVC.swift in Sources */,
10711077
44EB70A722BCB606008FECE4 /* JSFunctionForAATooltipVC.swift in Sources */,
10721078
84123BC52DB0AE00003DA7A0 /* AARoundedCornersSeriesElement.swift in Sources */,
1079+
84903CAE2DBA2E5C0029FE5A /* LissajousCurveViewController.swift in Sources */,
10731080
84595DE82B4698D600F69273 /* PolarChartOptionsVC.swift in Sources */,
10741081
84B68246266DB09100957FC5 /* AAChartSymbolConstant.swift in Sources */,
10751082
84790F442CC236C80047C133 /* CustomLargeDateSeriesClickEventCallbackVC.swift in Sources */,
@@ -1086,6 +1093,7 @@
10861093
8441C0972C620ED400A6F784 /* CustomStyleForAreasplineChartComposer.swift in Sources */,
10871094
844007742B6F3FA00072FB66 /* MixedChartVC.swift in Sources */,
10881095
8441C0952C620AC900A6F784 /* CustomStyleForSplineChartVC.swift in Sources */,
1096+
84903CA02DBA24B50029FE5A /* EmojiProvider.swift in Sources */,
10891097
845BABF12D030318004C15D4 /* OfficialChartSample.swift in Sources */,
10901098
844007762B6F41A50072FB66 /* SpecialChartComposer.swift in Sources */,
10911099
5860368820ADD4DC745A2997 /* AreaChartOptionsComposer.swift in Sources */,
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
//
2+
// EmojiProvider.swift
3+
// AAInfographicsDemo
4+
//
5+
// Created by AnAn on 2025/4/24.
6+
// Copyright © 2025 An An. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
//https://getemoji.com
12+
class EmojiProvider: NSObject {
13+
class func clothingAndAccessories() -> [String] {
14+
[
15+
"🧳",
16+
"🌂",
17+
"☂️",
18+
"🧵",
19+
"🪡",
20+
"🪢",
21+
"🪭",
22+
"🧶",
23+
"👓",
24+
"🕶",
25+
"🥽",
26+
"🥼",
27+
"🦺",
28+
"👔",
29+
"👕",
30+
"👖",
31+
"🧣",
32+
"🧤",
33+
"🧥",
34+
"🧦",
35+
"👗",
36+
"👘",
37+
"🥻",
38+
"🩴",
39+
"🩱",
40+
"🩲",
41+
"🩳",
42+
"👙",
43+
"👚",
44+
"👛",
45+
"👜",
46+
"👝",
47+
"🎒",
48+
"👞",
49+
"👟",
50+
"🥾",
51+
"🥿",
52+
"👠",
53+
"👡",
54+
"🩰",
55+
"👢",
56+
"👑",
57+
"👒",
58+
"🎩",
59+
"🎓",
60+
"🧢",
61+
"",
62+
"🪖",
63+
"💄",
64+
"💍",
65+
"💼",
66+
]
67+
}
68+
69+
class func foodAndDrink() -> [String] {
70+
[
71+
"🍎",
72+
"🍐",
73+
"🍊",
74+
"🍋",
75+
"🍋‍🟩",
76+
"🍌",
77+
"🍉",
78+
"🍇",
79+
"🍓",
80+
"🫐",
81+
"🍈",
82+
"🍒",
83+
"🍑",
84+
"🥭",
85+
"🍍",
86+
"🥥",
87+
"🥝",
88+
"🍅",
89+
"🍆",
90+
"🥑",
91+
"🥦",
92+
"🫛",
93+
"🥬",
94+
"🫜",
95+
"🥒",
96+
"🌶",
97+
"🫑",
98+
"🌽",
99+
"🥕",
100+
"🫒",
101+
"🧄",
102+
"🧅",
103+
"🫚",
104+
"🥔",
105+
"🍠",
106+
"🫘",
107+
"🥐",
108+
"🥯",
109+
"🍞",
110+
"🥖",
111+
"🥨",
112+
"🧀",
113+
"🥚",
114+
"🍳",
115+
"🧈",
116+
"🥞",
117+
"🧇",
118+
"🥓",
119+
"🥩",
120+
"🍗",
121+
"🍖",
122+
"🦴",
123+
"🌭",
124+
"🍔",
125+
"🍟",
126+
"🍕",
127+
"🫓",
128+
"🥪",
129+
"🥙",
130+
"🧆",
131+
"🌮",
132+
"🌯",
133+
"🫔",
134+
"🥗",
135+
"🥘",
136+
"🫕",
137+
"🥫",
138+
"🍝",
139+
"🍜",
140+
"🍲",
141+
"🍛",
142+
"🍣",
143+
"🍱",
144+
"🥟",
145+
"🦪",
146+
"🍤",
147+
"🍙",
148+
"🍚",
149+
"🍘",
150+
"🍥",
151+
"🥠",
152+
"🥮",
153+
"🍢",
154+
"🍡",
155+
"🍧",
156+
"🍨",
157+
"🍦",
158+
"🥧",
159+
"🧁",
160+
"🍰",
161+
"🎂",
162+
"🍮",
163+
"🍭",
164+
"🍬",
165+
"🍫",
166+
"🍿",
167+
"🍩",
168+
"🍪",
169+
"🌰",
170+
"🥜",
171+
"🍯",
172+
"🥛",
173+
"🍼",
174+
"🫖",
175+
"☕️",
176+
"🍵",
177+
"🧃",
178+
"🥤",
179+
"🧋",
180+
"🫙",
181+
"🍶",
182+
"🍺",
183+
"🍻",
184+
"🥂",
185+
"🍷",
186+
"🫗",
187+
"🥃",
188+
"🍸",
189+
"🍹",
190+
"🧉",
191+
"🍾",
192+
"🧊",
193+
"🥄",
194+
"🍴",
195+
"🍽",
196+
"🥣",
197+
"🥡",
198+
"🥢",
199+
"🧂",
200+
]
201+
202+
}
203+
204+
}

0 commit comments

Comments
 (0)