锘縱ar currDate = new Date();
var yesterdayDate = new Date();
$(function () {
if (todayData_UVI.length == 0 && yesterdayData_UVI.length == 0) {
$("#main").append("
During maintenance of equipment failure,the UVI data can鈥檛 be provided timely,sorry for the inconvenience.
")
$(".uivEc").hide();
} else {
DrLine();
}
})
function DrLine(){
require.config({
paths: {
echarts: '/Echarts/asset/js/echarts',
'echarts/chart/line': '/Echarts/asset/js/echarts-map'
}
});
option = {
tooltip: {
show: true,
trigger: 'axis'
},
grid: {
x: 30,
y: 30,
x2: 78,
y2: 30
},
xAxis: [
{
type: 'category',
axisLine: { // 杞寸嚎
show: true,
lineStyle: {
color: '#636363',
type: 'solid',
width: 2
}
},
axisTick: {
show: false
},
splitLine: {
show: false,
lineStyle: {
color: '#fff',
type: 'solid',
width: 1
}
},
splitArea: {
show: false,
areaStyle: {
color: ['#B2CEDA', '#B1C6DB', '#B1BFDA', '#B1B7DB', '#B1B0DC', '#B1B0DC', '#B1A7DB', '#B19FDB', '#B297DC', '#B090DB', '#B288DC', '#B180DB', '#B177DB', '#B270DC', '#B269DC', '#B161DC']
}
},
data: xAxisLable,
axisLabel: {
show: true,
interval: 59 // {number}
}
}
],
yAxis: [
{
type: 'value',
splitNumber: 15,
max: 15,
axisLabel: {
formatter: '{value}'
},
axisLine: { // 杞寸嚎
show: true,
lineStyle: {
color: '#636363',
type: 'solid',
width: 2
}
},
splitLine: {
show: true,
lineStyle: {
color: ['', '#98B6CF', '#99ACCF', '#99A6D2', '#9796CF', '#988ED0', '#A596D5', '#916ECD', '#A88AD7', '#A77DD8', '#A570D4', '#A570D4', '#A25BD1', '#983AD1', '#962BCF'],
type: 'solid',
width: 2
}
},
splitArea: {
show: true,
areaStyle: {
color: ['#B2CEDA', '#B1C6DB', '#B1BFDA', '#B1B7DB', '#B1B0DC', '#B1B0DC', '#B1A7DB', '#B19FDB', '#B297DC', '#B090DB', '#B288DC', '#B180DB', '#B177DB', '#B270DC', '#B269DC', '#B161DC']
}
}
},
{
//y 绗簩缁勬暟
type: 'value',
precision: 1,
splitNumber: 5,
max: 5,
min: 1,
axisLabel: {
formatter: function (value) {
// Function formatter
var t = "";
switch (value) {
case 1:
t = "0-2 \n(Low)";
break;
case 2:
t = "3-5 \n(Moderate)";
break;
case 3:
t = "6-7 \n(High)";
break;
case 4:
t = "8-10 \n(Very High)";
break;
case 5:
t = ">= 11 \n(Extreme)";
break;
}
return t;
}
},
axisLine: { // 杞寸嚎
show: true,
lineStyle: {
color: '#636363',
type: 'solid',
width: 2
}
},
splitLine: {
show: true,
lineStyle: {
color: ['#636363', '#99A6D2', '#957FCF', '#9C6DD3', '#9743CE'],
type: 'solid',
width: 2
}
}
}
],
series: [
{
name: new Date(yesterdayDate.setDate(yesterdayDate.getDate() - 1)).format('dd/MM'),
type: 'line',
symbol: 'none',
itemStyle: {
normal: {
color: '#FFFF01',
lineStyle: {
shadowColor: 'rgba(0,0,0,0.4)'
}
}
},
data: yesterdayData_UVI
},
{
name: currDate.format('dd/MM'),
type: 'line',
symbol: 'none',
itemStyle: {
normal: {
color: '#FE0000',
lineStyle: {
shadowColor: 'rgba(0,0,0,0.4)'
}
}
},
data: todayData_UVI
}
]
};
require(
[
'echarts',
'echarts/chart/line'
],
function (ec) {
var myChart = ec.init(document.getElementById('main'));
myChart.setOption(option);
}
)
}