我用Echarts.js创建了折线图。与这个问题有两个责任。 第一:如何使同一数组值中属于折线图的每一列的颜色不同? 第二:如何将X轴上的值表示为单独的图例?
var option = {
title: {
text: 'title here',
subtext: 'subtext here',
x: 'center',
fontFamily: 'Open Sans'
},
tooltip: {
trigger: 'axis',
formatter: "Name: {b}<br/> Toplam: {c}",
axisPointer: {
type: 'shadow'
}
},
legend: {
type: 'scroll',
orient: 'horizontal',
data: ['bar 1'],
right: 10,
top: 20,
bottom: 20,
align: 'left'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: gwNameList,
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: 'bar 1',
type: 'bar',
barWidth: '40%',
center: ['40%', '50%'],
data: gwRequestList
}
],
color: ['#EF9170', '#62D0AC', '#5986A5', '#D35384', '#FFFB93']
};
myChart.setOption(option);
},
);