我正在创建一个区域图高图。由于我未设置任何颜色,因此应默认为默认蓝色。对我来说,它会自动填充rgba(247, 163, 92, 0.75);
。为什么会这样。如何在顶部边框上获得默认的深蓝色,在areapline内获得默认的蓝色。
这是我的代码:
let series_vals = [];
let data_array = [];
let val_array = [];
for (let i = 0; i <= 15 i++) {
series_trend.push("series_trend" + i);
data_array.push([]);
val_array.push(val);
}
let series = [];
series_vals.forEach((name, index) => {
series.push({
val_array: val_array[index],
data: data_array[index],
})
});
$.getJSON(json, result => {
series.forEach(obj => {
result.forEach((elem, i, array) => {
if (elem.val === obj.val) {
obj.data.push({
x: elem.date,
y: elem.xyz,
});
}
});
});
Highcharts.chart(target, {
chart: {
height: 100,
width: 300,
type: 'areaspline',
},
title: {
text: ''
},
credits: {
enabled: false
},
legend: {
enabled: false
},
xAxis: {
visible: false
},
yAxis: {
visible: false
},
tooltip: {
formatter: function() {
let date_format = (filter == 'day') ? moment(this.key).format('MMM DD, YYYY') : moment(this.key).format('MMM YYYY');
let tooltip = `
<span style="font-weight:500;">${date_format}</span>
<br />
<span>${this.y}</span>
`;
return tooltip;
},
useHTML: true
},
plotOptions: {
series: {
fillColor: null,
marker: {
enabled: false,
symbol: 'circle'
}
}
},
series: series
});
});
反正我可以将其更改为默认值吗?
答案 0 :(得分:1)
您可以通过设置以下选项来设置区域颜色:
plotOptions: {
areaspline: {
fillColor: 'rgba(123, 181, 236, 0.7)',
lineColor: '#7BB5EC',
marker: {
fillColor: '#7BB5EC'
}
}
}
演示:
答案 1 :(得分:0)
您可以如下设置颜色主题
Highcharts.setOptions({
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
});