This commit is contained in:
lb 2024-01-04 16:44:15 +08:00
rodzic ac772e2caf
commit e1e73b341d
4 zmienionych plików z 19 dodań i 10 usunięć

Wyświetl plik

@ -145,7 +145,7 @@ function getOptions(data, chart_type) {
axisPointer: {
type: "shadow",
},
className: 'xc-chart-tooltip'
className: "xc-chart-tooltip",
// backgroundColor: ''
},
xAxis: {
@ -207,7 +207,9 @@ function getOptions(data, chart_type) {
fontSize: 10,
color: "#fffc",
},
data: (dataList || []).map((item) => item.value),
data: (dataList || []).map((item) =>
item.value == null || isNaN(+item.value) ? null : (+item.value).toFixed(2)
),
},
],
};

Wyświetl plik

@ -147,7 +147,10 @@ function getOptions(period, trend) {
},
},
series: {
data: trend[period].map((item) => item.qty),
// !(item.value == null || isNaN(+item.value)) ? (+item.value).toFixed(2) : null
data: trend[period].map((item) =>
item.qty == null || isNaN(+item.qty) ? null : (+item.qty).toFixed(2)
),
type: "line",
symbol: "circle",
symbolSize: 6,

Wyświetl plik

@ -4,7 +4,7 @@ export function lunarYear(year) {
return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
}
export function getOptions(period, source, trend, options={}) {
export function getOptions(period, source, trend, options = {}) {
if (trend[period].length == 0) return null;
const today = new Date();
const currentYear = today.getFullYear();
@ -40,7 +40,7 @@ export function getOptions(period, source, trend, options={}) {
.fill(1)
.map((_, index) => {
if (period == "week") {
const dtimestamp = today - (index+1) * 24 * 60 * 60 * 1000;
const dtimestamp = today - (index + 1) * 24 * 60 * 60 * 1000;
return `${new Date(dtimestamp).getMonth() + 1}.${new Date(
dtimestamp
).getDate()}`;
@ -65,7 +65,7 @@ export function getOptions(period, source, trend, options={}) {
},
},
yAxis: {
name: source == 'elec' ? '单位/kWh' : "单位/Nm³",
name: source == "elec" ? "单位/kWh" : "单位/Nm³",
nameTextStyle: {
color: "#fff",
fontSize: 10,
@ -96,10 +96,14 @@ export function getOptions(period, source, trend, options={}) {
{
data:
source == "elec"
? trend[period].map((item) => item.qty)
? trend[period].map((item) =>
item.qty == null || isNaN(+item.qty)
? null
: (+item.qty).toFixed(2)
)
: trend[period],
type: "line",
symbol: 'circle',
symbol: "circle",
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
@ -119,6 +123,6 @@ export function getOptions(period, source, trend, options={}) {
className: "xc-chart-tooltip",
// backgroundColor: ''
},
...options
...options,
};
}

Wyświetl plik

@ -124,8 +124,8 @@ new XClient(
new XClient(
{
url: "ws://10.70.2.2:8080/websocket/message?userId=ENERGY" + newUser,
// url: "ws://192.168.1.74:48080/websocket/message?userId=ENERGY" + newUser,
name: "MES_DATA",
// "ws://192.168.1.74:48080/websocket/message?userId=ENERGY" + newUser,
// "ws://192.168.1.74:48080/websocket/message?userId=ENERGY111",
},
energeHandler