Skip to content

Commit abb7892

Browse files
committed
Update JS plugin loading logic in AACustomStageChartVC
Refactored the way JS plugin paths are loaded to use BundlePathLoader for AAXrange.js and added error handling for AACustom-Stage.js. Ensures correct bundle paths and directory structure for plugin loading in the chart view.
1 parent f52c049 commit abb7892

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

AAInfographics-ProDemo/Demo/AAPlugins/AAStageSeries/AACustomStageChartVC.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,23 @@ class AACustomStageChartVC: UIViewController {
5252
NSString *jsPath = [[NSBundle mainBundle] pathForResource:@"AADrilldown" ofType:@"js"];
5353
self.aaChartView.pluginsArray = @[jsPath];
5454
*/
55-
let jsPath: String = Bundle.main.path(forResource: "AACustom-Stage", ofType: "js") ?? ""
56-
self.aaChartView?.userPluginPaths = [jsPath]
55+
// 使用正确的Bundle路径和目录结构来加载JS文件
56+
let jsPathXrange: String = BundlePathLoader().path(
57+
forResource: "AAXrange",
58+
ofType: "js",
59+
inDirectory: "AAJSFiles.bundle/AAModules"
60+
) ?? ""
61+
62+
// AACustom-Stage.js位于项目Demo目录中,使用Bundle.main加载
63+
guard let jsPathCustom_Stage = Bundle.main.path(forResource: "AACustom-Stage", ofType: "js") else {
64+
print("Error: Could not find AACustom-Stage.js")
65+
return
66+
}
67+
68+
self.aaChartView?.userPluginPaths = [
69+
jsPathXrange,
70+
jsPathCustom_Stage,
71+
]
5772

5873
//输出查看 AAOption 的 computedProperties 内容
5974
// AAOptions *aaOptions = [self chartConfigurationWithSelectedIndex:self.selectedIndex];

0 commit comments

Comments
 (0)