|
After Width: | Height: | Size: 204 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 979 B |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1008 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 1007 B |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,317 @@ |
|||
var dom1 = document.getElementById('container1'); |
|||
var dom2 = document.getElementById('container2'); |
|||
lineGraph(dom1, '温度', '℃') |
|||
lineGraph2(dom2, '血氧', '%') |
|||
|
|||
function lineGraph(dom, title, unit){ |
|||
var myChart = echarts.init(dom, null, { |
|||
renderer: 'canvas', |
|||
useDirtyRect: false |
|||
}); |
|||
var app = {}; |
|||
var ROOT_PATH = ''; |
|||
var option; |
|||
var dataAll = []; |
|||
|
|||
$.get( |
|||
ROOT_PATH + '/loraData', |
|||
function (_rawData) { |
|||
_rawData.forEach(value => dataAll.push(value)); |
|||
run(_rawData); |
|||
} |
|||
); |
|||
function run(_rawData) { |
|||
_rawData.unshift(["Income","Life Expectancy","Population","Country","Year"]) |
|||
// var countries = ['Australia', 'Canada', 'China', 'Cuba', 'Finland', 'France', 'Germany', 'Iceland', 'India', 'Japan', 'North Korea', 'South Korea', 'New Zealand', 'Norway', 'Poland', 'Russia', 'Turkey', 'United Kingdom', 'United States'];
|
|||
const countries = [title]; |
|||
const datasetWithFilters = []; |
|||
const seriesList = []; |
|||
echarts.util.each(countries, function (country) { |
|||
var datasetId = 'dataset_' + country; |
|||
datasetWithFilters.push({ |
|||
id: datasetId, |
|||
fromDatasetId: 'dataset_raw', |
|||
transform: { |
|||
type: 'filter', |
|||
config: { |
|||
and: [ |
|||
// { dimension: 'Year', gte: 1950 },
|
|||
{ dimension: 'Country', '=': country } |
|||
] |
|||
} |
|||
} |
|||
}); |
|||
seriesList.push({ |
|||
type: 'line', |
|||
datasetId: datasetId, |
|||
showSymbol: false, |
|||
smooth: true, |
|||
name: country, |
|||
endLabel: { |
|||
show: true, |
|||
formatter: function (params) { |
|||
return params.value[3] + ': ' + params.value[0] + unit; |
|||
} |
|||
}, |
|||
labelLayout: { |
|||
moveOverlap: 'shiftY' |
|||
}, |
|||
emphasis: { |
|||
focus: 'series' |
|||
}, |
|||
encode: { |
|||
x: 'Year', |
|||
y: 'Income', |
|||
label: ['Country', 'Income'], |
|||
itemName: 'Year', |
|||
tooltip: ['Income'] |
|||
} |
|||
}); |
|||
}); |
|||
option = { |
|||
animationDuration: 10000, |
|||
dataset: [ |
|||
{ |
|||
id: 'dataset_raw', |
|||
source: _rawData |
|||
}, |
|||
...datasetWithFilters |
|||
], |
|||
tooltip: { |
|||
order: 'valueDesc', |
|||
trigger: 'axis' |
|||
}, |
|||
xAxis: { |
|||
type: 'category', |
|||
nameLocation: 'middle' |
|||
}, |
|||
yAxis: [ |
|||
{ |
|||
scale: false, |
|||
name: '体温', |
|||
min: 30, |
|||
max: 40, |
|||
}, |
|||
{ |
|||
type: 'value', |
|||
name: '血氧', |
|||
min: 0, |
|||
max: 100, |
|||
position: 'left', |
|||
offset: 30, |
|||
axisLabel: { |
|||
formatter: '{value} °C' |
|||
} |
|||
} |
|||
], |
|||
grid: { |
|||
right: 140 |
|||
}, |
|||
series: seriesList |
|||
}; |
|||
myChart.setOption(option); |
|||
} |
|||
|
|||
setInterval(function () { |
|||
$.get( |
|||
ROOT_PATH + '/loraData?item=' + title, |
|||
function (_rawData2) { |
|||
|
|||
if (dataAll.length > 40){ |
|||
dataAll.shift(); |
|||
dataAll.shift(); |
|||
} |
|||
|
|||
_rawData2.forEach(value => dataAll.push(value)); |
|||
|
|||
_rawData = [["Income","Life Expectancy","Population","Country","Year"]]; |
|||
dataAll.forEach(value => _rawData.push(value)); |
|||
|
|||
myChart.setOption({ |
|||
dataset: [ |
|||
{ |
|||
source: _rawData |
|||
} |
|||
], |
|||
}); |
|||
|
|||
let original = ''; |
|||
dataAll.forEach((elem, index) => { |
|||
original += elem[3] + elem[0]; |
|||
if (elem[3] == "血氧") { |
|||
original += '%' |
|||
} else { |
|||
original += '℃' |
|||
} |
|||
original += ' ' |
|||
}) |
|||
|
|||
$(".sound-code-chunk-default-content").html(original); |
|||
|
|||
|
|||
} |
|||
); |
|||
|
|||
|
|||
|
|||
}, 1000); |
|||
|
|||
|
|||
if (option && typeof option === 'object') { |
|||
myChart.setOption(option); |
|||
} |
|||
|
|||
window.addEventListener('resize', myChart.resize); |
|||
|
|||
} |
|||
|
|||
function lineGraph2(dom, title, unit){ |
|||
var myChart = echarts.init(dom, null, { |
|||
renderer: 'canvas', |
|||
useDirtyRect: false |
|||
}); |
|||
var app = {}; |
|||
var ROOT_PATH = ''; |
|||
var option; |
|||
var dataAll = []; |
|||
|
|||
$.get( |
|||
ROOT_PATH + '/loraData', |
|||
function (_rawData) { |
|||
_rawData.forEach(value => dataAll.push(value)); |
|||
run(_rawData); |
|||
} |
|||
); |
|||
function run(_rawData) { |
|||
_rawData.unshift(["Income","Life Expectancy","Population","Country","Year"]) |
|||
// var countries = ['Australia', 'Canada', 'China', 'Cuba', 'Finland', 'France', 'Germany', 'Iceland', 'India', 'Japan', 'North Korea', 'South Korea', 'New Zealand', 'Norway', 'Poland', 'Russia', 'Turkey', 'United Kingdom', 'United States'];
|
|||
const countries = [title]; |
|||
const datasetWithFilters = []; |
|||
const seriesList = []; |
|||
echarts.util.each(countries, function (country) { |
|||
var datasetId = 'dataset_' + country; |
|||
datasetWithFilters.push({ |
|||
id: datasetId, |
|||
fromDatasetId: 'dataset_raw', |
|||
transform: { |
|||
type: 'filter', |
|||
config: { |
|||
and: [ |
|||
// { dimension: 'Year', gte: 1950 },
|
|||
{ dimension: 'Country', '=': country } |
|||
] |
|||
} |
|||
} |
|||
}); |
|||
seriesList.push({ |
|||
type: 'line', |
|||
datasetId: datasetId, |
|||
showSymbol: false, |
|||
smooth: true, |
|||
name: country, |
|||
endLabel: { |
|||
show: true, |
|||
formatter: function (params) { |
|||
return params.value[3] + ': ' + params.value[0] + unit; |
|||
} |
|||
}, |
|||
labelLayout: { |
|||
moveOverlap: 'shiftY' |
|||
}, |
|||
emphasis: { |
|||
focus: 'series' |
|||
}, |
|||
encode: { |
|||
x: 'Year', |
|||
y: 'Income', |
|||
label: ['Country', 'Income'], |
|||
itemName: 'Year', |
|||
tooltip: ['Income'] |
|||
} |
|||
}); |
|||
}); |
|||
option = { |
|||
animationDuration: 10000, |
|||
dataset: [ |
|||
{ |
|||
id: 'dataset_raw', |
|||
source: _rawData |
|||
}, |
|||
...datasetWithFilters |
|||
], |
|||
tooltip: { |
|||
order: 'valueDesc', |
|||
trigger: 'axis' |
|||
}, |
|||
xAxis: { |
|||
type: 'category', |
|||
nameLocation: 'middle' |
|||
}, |
|||
yAxis: { |
|||
scale: false, |
|||
name: 'Income' |
|||
}, |
|||
grid: { |
|||
right: 140 |
|||
}, |
|||
color:[ |
|||
'rgba(231,82,27,0.94)' |
|||
], |
|||
series: seriesList |
|||
}; |
|||
myChart.setOption(option); |
|||
} |
|||
|
|||
setInterval(function () { |
|||
$.get( |
|||
ROOT_PATH + '/loraData?item=' + title, |
|||
function (_rawData2) { |
|||
|
|||
if (dataAll.length > 40){ |
|||
dataAll.shift(); |
|||
dataAll.shift(); |
|||
} |
|||
|
|||
_rawData2.forEach(value => dataAll.push(value)); |
|||
|
|||
_rawData = [["Income","Life Expectancy","Population","Country","Year"]]; |
|||
dataAll.forEach(value => _rawData.push(value)); |
|||
|
|||
myChart.setOption({ |
|||
dataset: [ |
|||
{ |
|||
source: _rawData |
|||
} |
|||
], |
|||
}); |
|||
|
|||
let original = ''; |
|||
dataAll.forEach((elem, index) => { |
|||
original += elem[3] + elem[0]; |
|||
if (elem[3] == "血氧") { |
|||
original += '%' |
|||
} else { |
|||
original += '℃' |
|||
} |
|||
original += ' ' |
|||
}) |
|||
|
|||
$(".sound-code-chunk-default-content").html(original); |
|||
|
|||
|
|||
} |
|||
); |
|||
|
|||
|
|||
|
|||
}, 1000); |
|||
|
|||
|
|||
if (option && typeof option === 'object') { |
|||
myChart.setOption(option); |
|||
} |
|||
|
|||
window.addEventListener('resize', myChart.resize); |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,105 @@ |
|||
* {margin:0; padding:0;} |
|||
html,body{height:100%;} |
|||
.box { |
|||
height:100%; |
|||
background: #020723; |
|||
background-image:url("/image/lora2/background1.png"); |
|||
background-size: 100% 100%; |
|||
background-repeat: no-repeat; |
|||
} |
|||
|
|||
html { |
|||
/*在根元素中计算基准值字体大小,设备宽度 / 设计稿宽度 * 100*/ |
|||
font-size: calc(100vw /1920 * 100 ); |
|||
} |
|||
.box{ |
|||
font-size: 0.18rem; |
|||
} |
|||
/*头部*/ |
|||
.title{ |
|||
height: 0.64rem; |
|||
display: -webkit-flex; |
|||
display: flex; |
|||
position: relative; |
|||
} |
|||
.school{ |
|||
width: 2.06rem; |
|||
height: 0.64rem; |
|||
position: relative; |
|||
} |
|||
.school-logo{ |
|||
width: 1.68rem; |
|||
height: 0.43rem; |
|||
position:absolute; |
|||
bottom: 0; |
|||
right: 0; |
|||
padding:0; |
|||
margin:0; |
|||
} |
|||
.college{ |
|||
width: 1.71rem; |
|||
} |
|||
.college-text{ |
|||
margin-top: 0.35rem; |
|||
margin-left: 0.15rem; |
|||
font-family: Source Han Sans CN; |
|||
font-size: 0.18rem; |
|||
font-weight: 400; |
|||
color: #FFFFFF; |
|||
} |
|||
.menu{ |
|||
position:absolute; |
|||
left: 0; |
|||
right: 0; |
|||
margin:auto; |
|||
width: 15.43rem; |
|||
height: 0.64rem; |
|||
background-image:url("/image/lora2/top.png"); |
|||
background-size: 100% 100%; |
|||
background-repeat: no-repeat; |
|||
} |
|||
|
|||
/*设备列表*/ |
|||
.device{ |
|||
width: 2.99rem; |
|||
height: 18.56rem; |
|||
padding-top: 0.56rem; |
|||
} |
|||
.device-frame{ |
|||
width: 2.4rem; |
|||
height: 100%; |
|||
margin-left: 0.34rem; |
|||
} |
|||
.device-cell1{ |
|||
width: 2.4rem; |
|||
height: 0.64rem; |
|||
margin-bottom: 0.1rem; |
|||
padding-left: 0.36rem; |
|||
|
|||
background: linear-gradient(90deg, rgba(0,250,255,0.84), rgba(0,250,255,0)); |
|||
border-radius: 0.32rem; |
|||
} |
|||
|
|||
.device-cell2{ |
|||
width: 2.4rem; |
|||
height: 0.64rem; |
|||
margin-bottom: 0.1rem; |
|||
padding: 0.015rem; |
|||
background: linear-gradient(90deg, rgba(0,250,255,0.5), rgba(0,250,255,0.1)); |
|||
border-radius: 0.32rem; |
|||
} |
|||
.device-cell{ |
|||
width: 100%; |
|||
height: 100%; |
|||
background: #101010; |
|||
border-radius: 0.32rem; |
|||
background-image:url("/image/lora2/background1.png"); |
|||
} |
|||
|
|||
.device-online{ |
|||
width: 0.12rem; |
|||
height: 0.12rem; |
|||
background: #31EDB1; |
|||
border-radius: 0.06rem; |
|||
} |
|||
|
|||
@ -0,0 +1,30 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<meta charset="utf-8"> |
|||
<title></title> |
|||
</head> |
|||
<style> |
|||
* {margin:0; padding:0;} |
|||
html,body{height:100%;} |
|||
.box {height:100%;background: #020622;} |
|||
|
|||
html { |
|||
/*在根元素中计算基准值字体大小,设备宽度 / 设计稿宽度 * 100*/ |
|||
font-size: calc(100vw /1920 * 100 ); |
|||
} |
|||
|
|||
#box { |
|||
width: 19.2rem; |
|||
height: 1rem; |
|||
background-color: aqua; |
|||
font-size: 1rem; |
|||
} |
|||
</style> |
|||
<body> |
|||
<div id="box"> |
|||
测试rem |
|||
|
|||
</div> |
|||
</body> |
|||
</html> |
|||