This commit is contained in:
wobeitaoleshigexuruo 2024-06-07 20:54:53 +08:00
parent 8af9dc3f9b
commit c70f9ff81e
12 changed files with 174 additions and 94 deletions

View File

@ -83,7 +83,7 @@
<div class="bar">
<div class="barbox">
<ul class="clearfix">
<li class="pulll_left counter">43°c</li>
<li class="pulll_left counter">43 C</li>
<li class="pulll_left counter">51135 mm</li>
</ul>
</div>

View File

@ -13,7 +13,7 @@ def aqi_data(session):
data1.append(
{
"name": row[0],
"value": [idx + 1, float(row[1]), row[2]],
"value": [[idx + 1, float(row[1]), row[2]]],
}
)
# Serialize the list of dictionaries to JSON

View File

@ -10,7 +10,7 @@ def aqi_pie(session):
data = session.execute(query2).fetchall()
color_map = {
"": "#065aab",
"": "#06c8ab",
"": "#066eab",
"轻度污染": "#0696ab",
}

View File

@ -86,7 +86,12 @@ const Chart4_Data = {
"永川",
"云阳",
"北碚",
"垫江"
"垫江",
"铜梁",
"奉节",
"潼南",
"沙坪坝",
"开州"
],
"y": [
25.9,
@ -95,7 +100,12 @@ const Chart4_Data = {
25.1,
25.1,
24.9,
24.9
24.9,
24.9,
24.8,
24.8,
24.7,
24.6
]
}
@ -107,7 +117,12 @@ const Chart5_Data = {
"万州",
"开州",
"酉阳",
"丰都"
"丰都",
"合川",
"石柱",
"奉节",
"綦江",
"云阳"
],
"y": [
94.0,
@ -116,7 +131,12 @@ const Chart5_Data = {
81.0,
79.0,
78.0,
77.0
77.0,
77.0,
77.0,
76.0,
76.0,
75.0
]
}
@ -124,186 +144,232 @@ const Chart6_Data = [
{
"name": "奉节",
"value": [
[
1,
33.0,
"优"
]
]
},
{
"name": "黔江",
"value": [
[
2,
33.0,
"优"
]
]
},
{
"name": "巴南",
"value": [
[
3,
37.0,
"优"
]
]
},
{
"name": "北碚",
"value": [
[
4,
40.0,
"优"
]
]
},
{
"name": "城口",
"value": [
[
5,
38.0,
"优"
]
]
},
{
"name": "大足",
"value": [
[
6,
58.0,
"良"
]
]
},
{
"name": "合川",
"value": [
[
7,
40.0,
"优"
]
]
},
{
"name": "江津",
"value": [
[
8,
37.0,
"优"
]
]
},
{
"name": "开州",
"value": [
[
9,
31.0,
"优"
]
]
},
{
"name": "荣昌",
"value": [
[
10,
36.0,
"优"
]
]
},
{
"name": "沙坪坝",
"value": [
[
11,
44.0,
"优"
]
]
},
{
"name": "铜梁",
"value": [
[
12,
52.0,
"良"
]
]
},
{
"name": "万盛",
"value": [
[
13,
37.0,
"优"
]
]
},
{
"name": "巫山",
"value": [
[
14,
33.0,
"优"
]
]
},
{
"name": "巫溪",
"value": [
[
15,
33.0,
"优"
]
]
},
{
"name": "秀山",
"value": [
[
16,
8.0,
"优"
]
]
},
{
"name": "永川",
"value": [
[
17,
38.0,
"优"
]
]
},
{
"name": "酉阳",
"value": [
[
18,
8.0,
"优"
]
]
},
{
"name": "渝北",
"value": [
[
19,
38.0,
"优"
]
]
},
{
"name": "云阳",
"value": [
[
20,
33.0,
"优"
]
]
},
{
"name": "潼南",
"value": [
[
21,
44.0,
"优"
]
]
},
{
"name": "璧山",
"value": [
[
22,
52.0,
"良"
]
]
},
{
"name": "綦江",
"value": [
[
23,
53.0,
"良"
]
]
}
]
@ -382,7 +448,7 @@ const Chart32_Data = [
"云阳",
"潼南"
],
"color": "#065aab"
"color": "#06c8ab"
},
{
"value": 4,
@ -417,7 +483,7 @@ const Chart33_Data = [
2.1,
2.3
],
"color": "#065aab"
"color": "#0656bb"
},
{
"value": 17,
@ -498,7 +564,7 @@ const Chart33_Data = [
"detail": [
3.8
],
"color": "#065aab"
"color": "#9796cb"
}
]

View File

@ -4,7 +4,7 @@ from sqlalchemy import text
def hum_now(session):
query2 = text('SELECT city_name,humidity FROM tem_now_analyse ORDER BY humidity DESC LIMIT 7')
query2 = text('SELECT city_name,humidity FROM tem_now_analyse ORDER BY humidity DESC LIMIT 12')
data = session.execute(query2).fetchall()
x = []
y = []

View File

@ -4,7 +4,7 @@ from sqlalchemy import text
def tem_now(session):
query2 = text('SELECT city_name,temperature FROM tem_now_analyse ORDER BY temperature DESC LIMIT 7')
query2 = text('SELECT city_name,temperature FROM tem_now_analyse ORDER BY temperature DESC LIMIT 12')
data = session.execute(query2).fetchall()
x = []
y = []

View File

@ -15,6 +15,8 @@ def wind(session):
0: "#065aab",
2: "#06c8ab",
1: "#0696ab",
3: "#0656bb",
4: "#9796cb",
}
info_map = {}

View File

@ -16,14 +16,17 @@ function echarts_31() {
tooltip: {
trigger: 'item',
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
return [p[0] + 60, p[1] - 100];
},
formatter: function (params) {
var dataItem = data.find(item => item.name === params.name);
var value = `${dataItem.name}: ${params.value} (${params.percent}%) <br>`;
dataItem.weather.forEach((v) => {
value += `${v} <br>`;
dataItem.weather.forEach((v, index) => {
value += `${v} `;
if (index % 2 === 1) {
value += '<br>';
}
});
return value; // 动态遍历数据显示地区、天气和百分比
@ -39,7 +42,6 @@ function echarts_31() {
color: 'rgba(255,255,255,.5)',
fontSize: '12',
},
data: ['晴天', '多云', '小雨', '大雨', '阴天', '雷阵雨', '雾']
},
series: [
{

View File

@ -18,14 +18,17 @@ function echarts_32() {
tooltip: {
trigger: 'item',
position: function (p) { //其中p为当前鼠标的位置
return [p[0] + 10, p[1] - 10];
return [p[0] + 60, p[1] - 10];
},
formatter: function (params) {
var dataItem = data.find(item => item.name === params.name);
var value = `${dataItem.name}: ${params.value} (${params.percent}%) <br>`;
dataItem.degree.forEach((v) => {
value += `${v} <br>`;
dataItem.degree.forEach((v, index) => {
value += `${v} `;
if (index % 2 === 1) {
value += '<br>';
}
});
return value; // 动态遍历数据显示地区、天气和百分比

View File

@ -6,7 +6,7 @@ function echarts_33() {
// 指定图表的配置项和数据
option = {
title: {
text: '空气质量地区排行',
text: '风速地区排行',
// subtext: '数据来源:环保局',
left: 'center',
textStyle: {
@ -23,8 +23,9 @@ function echarts_33() {
var dataItem = data.find(item => item.name === params.name);
var value = `${dataItem.name}: ${params.value} (${params.percent}%) <br>`;
dataItem.degree.forEach((v) => {
value += `${v} <br>`;
dataItem.degree.forEach((v, index) => {
var detail = dataItem.detail[index];
value += `${v}: ${detail} m/s <br>`;
});
return value; // 动态遍历数据显示地区、天气和百分比

View File

@ -53,11 +53,14 @@ function echarts_4() {
},
yAxis: {
type: 'value',
interval: 0.3, // 指定刻度间隔
min:24.5,
max:26,
axisLabel: {
formatter: '{value}°C' // Add the °C unit to the formatter
formatter: '{value}°C', // Add the °C unit to the formatter
},
axisLabel: {
interval: 0,
// rotate:50,
show: true,
splitNumber: 15,

View File

@ -41,6 +41,9 @@ function echarts_5() {
},
},
yAxis: {
interval: 5, // 指定刻度间隔
min:70,
max:100,
type: 'value',
axisLabel: {