1.echarts 示例修改
重点代码
{value:220,itemStyle:{color:'green'},symbol: 'triangle',symbolSize: 12},
//value 值,itemStyle 样式 ,symbol 点形状triangle/square/diamond/circle ,symbolSize大小
option = {
title: {
text: 'Stacked Line'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
name: 'Email',
type: 'line',
stack: 'Total',
data: [{value:220,itemStyle:{color:'green'},symbol: 'triangle',symbolSize: 12},
//value 值,itemStyle 样式 ,symbol 点形状triangle/square/diamond/circle等,symbolSize大小
132, 101, 134, 90, 230, 210]
},
{
name: 'Union Ads',
type: 'line',
stack: 'Total',
data: [220, 182, 191, 234, {value:290,itemStyle:{color:'blue'},symbol: 'square',symbolSize: 12}, 330, 310]
},
{
name: 'Video Ads',
type: 'line',
stack: 'Total',
data: [150, 232, {value:220,itemStyle:{color:'orange'},symbol: 'diamond',symbolSize: 12}, 154, 190, 330, 410]
},
{
name: 'Direct',
type: 'line',
stack: 'Total',
data: [320, 332, {value:220,itemStyle:{color:'black'},symbol: 'rectangle',symbolSize: 12}, 334, 390, 330, 320]
},
{
name: 'Search Engine',
type: 'line',
stack: 'Total',
data: [820, 932, 901, 934, 1290, {value:1343,itemStyle:{color:'red'},symbol: 'circle',symbolSize: 12}, 1320]
}
]
};
2.tooltip添加滚动条
tooltip: {
trigger: 'axis',
confine:true,
enterable:true,
extraCssText:"max-width:70%;max-height:10%;overflow:auto;"//重点,根据echarts长宽设定tooltip长宽,溢出部分添加滚动条
},