You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
2 months ago
|
document.addEventListener('DOMContentLoaded', function() {
|
||
|
var chartDom = document.getElementById('r1');
|
||
|
var myChart = echarts.init(chartDom);
|
||
|
var option;
|
||
|
|
||
|
fetch('/barrage_sentiment')
|
||
|
.then(response => response.json())
|
||
|
.then(data => {
|
||
|
// 只加载前100条数据
|
||
|
data = data.slice(0, 250);
|
||
|
|
||
|
var scatterData = data.map((item, index) => [index, item.sentiment]);
|
||
|
|
||
|
option = {
|
||
|
title: {
|
||
|
text: '弹幕情感分析',
|
||
|
left: 'center',
|
||
|
top: 'bottom',
|
||
|
textStyle: {
|
||
|
color: '#FFFFFF',
|
||
|
}
|
||
|
},
|
||
|
tooltip: {},
|
||
|
xAxis: {
|
||
|
type: 'category',
|
||
|
data: data.map((item, index) => index),
|
||
|
axisLabel: {
|
||
|
show:false
|
||
|
}
|
||
|
},
|
||
|
yAxis: {
|
||
|
type: 'value'
|
||
|
},
|
||
|
series: [{
|
||
|
data: scatterData,
|
||
|
type: 'scatter',
|
||
|
itemStyle: {
|
||
|
color: 'rgba(255, 0, 0, 0.8)'
|
||
|
}
|
||
|
}]
|
||
|
};
|
||
|
|
||
|
myChart.setOption(option);
|
||
|
});
|
||
|
});
|