From 3cf5a291dd04c8176e8a454ba599826ceb0b01bc Mon Sep 17 00:00:00 2001
From: XXAY <2606432452@qq.com>
Date: Tue, 21 Sep 2021 11:47:36 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=9C=E8=89=B2=E4=BF=A1?=
=?UTF-8?q?=E6=81=AF=20=E4=BF=AE=E6=94=B9=E5=B1=9E=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
chart/tools.py | 56 ++++++++++++++++++---------
chart/views.py | 11 +-----
file_keep/chart/file/8160590002021413 | 50 ------------------------
file_keep/chart/file/8180000562021492 | 50 ------------------------
templates/chart/Basic.html | 2 +-
5 files changed, 39 insertions(+), 130 deletions(-)
delete mode 100644 file_keep/chart/file/8160590002021413
delete mode 100644 file_keep/chart/file/8180000562021492
diff --git a/chart/tools.py b/chart/tools.py
index 7f58d29..eca836f 100644
--- a/chart/tools.py
+++ b/chart/tools.py
@@ -9,6 +9,13 @@ from Simple_Drawing.settings import BASE_DIR
url_ = "127.0.0.1:8000"
+def random_color():
+ color_list = ["#009688", '#5FB878', '#393D49',
+ '#1E9FFF', '#FFB800', '#FF5722',
+ '#01AAED', '#2F4056']
+ return random.choice(color_list)
+
+
# 保存单个文件
def keep_file(file_data, file_path, file_name=None, ui=0):
if file_name is not None:
@@ -87,7 +94,6 @@ class ChartParameter(object):
if 'Senior' in data:
self.Senior = data['Senior']
- self.colors = 0
self.colors_dict = {}
def html_out_Basics(self):
@@ -121,18 +127,18 @@ class ChartParameter(object):
style="height: 25px; width:80px;margin-top: 6px">
"""
if parameter.input_type == "color_name":
- self.colors_dict[f"color{self.colors}"] = "color_name"
+ self.colors_dict[f"{parameter.name}"] = "color_name"
parameter.input_type = f"""
"""
- self.colors += 1
+
if parameter.input_type == "rgb":
- self.colors_dict[f"color{self.colors}"] = "rgb"
+ self.colors_dict[f"{parameter.name}"] = "rgb"
f"""
"""
self.colors += 1
@@ -239,21 +245,21 @@ class="layui-input" style="height: 25px; width:80px;margin-top: 6px">
style="height: 25px; width:80px;margin-top: 6px">
"""
if parameter.input_type == "color_name":
- self.colors_dict[f"color{self.colors}"] = "color_name"
+ self.colors_dict[f"{parameter.name}"] = "color_name"
parameter.input_type = f"""
"""
- self.colors += 1
+
if parameter.input_type == "rgb":
- self.colors_dict[f"color{self.colors}"] = "rgb"
+ self.colors_dict[f"{parameter.name}"] = "rgb"
f"""
"""
- self.colors += 1
+
if parameter.input_type == "palettes":
parameter.input_type = f"""