|
|
@@ -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, |
|
|
|
}; |
|
|
|
} |