From f131114d5877cf30b3b8149108de8f9b3d06f1d8 Mon Sep 17 00:00:00 2001
From: simonyan <315082291@qq.com>
Date: Thu, 14 Nov 2024 23:44:01 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=94=9F=E6=88=90=E7=9A=84echart?=
=?UTF-8?q?=E5=9B=BE=EF=BC=8C=E4=BD=BF=E7=94=A8=E6=9C=AC=E5=9C=B0=E7=9A=84?=
=?UTF-8?q?echartjs=E6=96=87=E4=BB=B6=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
GeometricSightTracking/main.py | 6 +++++-
GeometricSightTracking/mainMapEcharts.py | 8 ++++++--
TOASimu/main.py | 14 ++++++++++++--
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/GeometricSightTracking/main.py b/GeometricSightTracking/main.py
index a974171..4053460 100644
--- a/GeometricSightTracking/main.py
+++ b/GeometricSightTracking/main.py
@@ -128,7 +128,11 @@ def main():
# 将结果拷贝的目标目录下
shutil.copytree(outputDir, outputDistDir)
-
+ # 将2个js文件拷贝到output目录下
+ echartjsFilePath = "../../resources/echarts.min.js"
+ worldjsFilePath = "../../resources/world.js"
+ shutil.copy(echartjsFilePath, os.path.join(outputDistDir, os.path.basename(echartjsFilePath)))
+ shutil.copy(worldjsFilePath, os.path.join(outputDistDir, os.path.basename(worldjsFilePath)))
if __name__ == "__main__":
try:
diff --git a/GeometricSightTracking/mainMapEcharts.py b/GeometricSightTracking/mainMapEcharts.py
index da524ba..d19aaf6 100644
--- a/GeometricSightTracking/mainMapEcharts.py
+++ b/GeometricSightTracking/mainMapEcharts.py
@@ -42,10 +42,14 @@ def rendOutputGeo(outputFilePath: str):
# 修改html,支持全屏和自适应
with open(htmlFilePath, "r") as file:
data = file.read()
- # 设置全屏大小
+ # 1、设置全屏大小
+ # 2、将在线js文件替换为本地js文件
data = data.replace(
"",
"\n",
- )
+ ).replace(
+ "https://assets.pyecharts.org/assets/v5/echarts.min.js", "echarts.min.js").replace(
+ "https://assets.pyecharts.org/assets/v5/maps/world.js","world.js")
with open(htmlFilePath, "w", encoding="utf-8") as file:
file.write(data)
+
diff --git a/TOASimu/main.py b/TOASimu/main.py
index e4c67c2..e75a2db 100644
--- a/TOASimu/main.py
+++ b/TOASimu/main.py
@@ -213,7 +213,9 @@ def handleOutput(lon: float, lat: float, index: int):
data = data.replace(
"",
"\n",
- )
+ ).replace(
+ "https://assets.pyecharts.org/assets/v5/echarts.min.js", "echarts.min.js").replace(
+ "https://assets.pyecharts.org/assets/v5/maps/world.js","world.js")
with open(f"output/{index}_scatter_chart.html", "w", encoding="utf-8") as file:
file.write(data)
@@ -286,7 +288,9 @@ def renderReflectance(pointList: list, valueList: list):
data = data.replace(
"",
"\n",
- )
+ ).replace(
+ "https://assets.pyecharts.org/assets/v5/echarts.min.js", "echarts.min.js").replace(
+ "https://assets.pyecharts.org/assets/v5/maps/world.js","world.js")
with open(htmlFilePath, "w", encoding="utf-8") as file:
file.write(data)
pass
@@ -513,6 +517,12 @@ def main():
globalUtils.rmPath(projectOutputDir)
# 将结果拷贝到目的目录
shutil.copytree("output", projectOutputDir)
+
+ # 将2个js文件拷贝到output目录下
+ echartjsFilePath = "../../resources/echarts.min.js"
+ worldjsFilePath = "../../resources/world.js"
+ shutil.copy(echartjsFilePath, os.path.join(projectOutputDir, os.path.basename(echartjsFilePath)))
+ shutil.copy(worldjsFilePath, os.path.join(projectOutputDir, os.path.basename(worldjsFilePath)))
return