var option = {
title: {
text: '课时观看时长分布',
subtext: '数据仅供参考',
left: 'center',
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
// formatter: '{b}
{a0}: {c0}人 ({d0}%)
{a1}: {c1}秒 ({d1}%)',
},
legend: {
data: ['0-30秒', '30秒-1分钟', '1-3分钟', '3-5分钟', '5分钟以上'],
top: 'bottom',
},
dataset: {
dimensions: [
{ name: 'ds', displayName: '日期' },
{ name: 'pv', displayName: '销售额' },
{ name: 'uv', displayName: '成本' },
],
source: {
ds: [1, 2, 3, 4, 5, 6, 7],
pv: [30, 40, 35, 50, 45, 30, 25],
uv: [40, 20, 30, 5, 20, 35, 40],
},
},
xAxis: {
type: 'category',
axisLabel: {
interval: 0,
rotate: 30,
},
},
yAxis: {
type: 'value',
},
series: [
{
type: 'line',
},
{
type: 'line',
},
],
};
myChart.setOption(option);