如何利用echarts畫雷達(dá)圖和折柱混合
更新時間:2022年04月07日 11:39:05 作者:啾啾哼
最近使用echarts做的一個H5的成績數(shù)據(jù)報告,里面使用了雷達(dá)圖已經(jīng)折線圖和柱狀圖,下面這篇文章主要給大家介紹了關(guān)于如何利用echarts畫雷達(dá)圖和折柱混合的相關(guān)資料,需要的朋友可以參考下
導(dǎo)語
通常在根據(jù)設(shè)計圖寫echarts的時候,很多效果是官方實例里沒有的,我在代碼里加上了一些常用的效果,并做了注釋。
雷達(dá)圖
var option = {
radar: [{
//數(shù)據(jù)名稱
indicator: [{
text: 'AIS未登記'
},
{
text: '巡邏發(fā)現(xiàn)'
},
{
text: '群眾舉報'
},
{
text: '其他'
},
{
text: '雷達(dá)發(fā)現(xiàn)'
}
],
center: ['50%', '50%'],
radius: 120,
startAngle: 90,
splitNumber: 4,
shape: 'circle',
axisName: {
formatter: '【{value}】',
color: '#428BD4'//顏色
},
splitArea: {
areaStyle: {
color: ['#7BD685', '#34B54B', '#70DEB3', '#4FC7A0'], //內(nèi)部圈圈的顏色
shadowColor: 'rgba(0, 0, 0, 0.1)', //內(nèi)部線的顏色
shadowBlur: 10
}
},
//線顏色
axisLine: {
lineStyle: {
color: '#428BD4'
}
},
splitLine: {
lineStyle: {
color: 'rgba(211, 253, 250, 0.8)'
}
}
}],
//鼠標(biāo)放上懸浮展示的內(nèi)容
tooltip: {
trigger: 'item'
},
series: [{
name: '表特征分布',
type: 'radar',
symbol: 'circle', //拐點樣式
symbolSize: 6, // 拐點的大小
emphasis: {
lineStyle: {
width: 4
}
},
data: [{
value: [60, 5, 1, 1, 1500],
name: '',
areaStyle: {
color: '#C1BFA1'
}
}
]
}]
};
var myChartecharts = echarts.init(document.getElementById('btzfb'));
myChartecharts.setOption(option);效果


折柱圖
//
var optionbdtj = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
title: {},
legend: {
data: ['系統(tǒng)預(yù)警', '線下發(fā)現(xiàn)', '數(shù)量變動'],
textStyle: {
color: '#7A7A7A'
},
},
xAxis: [{
type: 'category',
data: ['1月', '2月', '3月', '4月'],
axisPointer: {
type: 'shadow'
},
axisLine: {
lineStyle: { //改變xy軸線條的顏色
color: "#C3DCEA",
width: 1 //這里是為了突出顯示加上的
}
},
axisLabel: {
textStyle: { //改變xy軸上文字的顏色
color: "#75B4FC"
}
}
}],
yAxis: [{
type: 'value',
name: '單位(艘)',
min: 0,
max: 1000,
interval: 200,
axisLine: {
lineStyle: { //改變xy軸線條的顏色
color: "#E5F0F6",
width: 1 //這里是為了突出顯示加上的
}
},
axisLabel: {
formatter: '{value} ',
color: '#B7B7B7'
},
splitLine: {
lineStyle: { //改變xy軸線條的顏色
color: "#E5F0F6",
width: 1 //這里是為了突出顯示加上的
}
},
nameTextStyle: {
color: '#B7B7B7'
}
},
{
type: 'value',
name: '單位(%)',
min: 0,
max: 100,
interval: 20, //間隔數(shù)
axisLine: {
lineStyle: { //改變xy軸線條的顏色
color: "#E5F0F6",
width: 1 //這里是為了突出顯示加上的
}
},
axisLabel: {
formatter: '{value} ',
color: '#B7B7B7'
},
splitLine: {
lineStyle: { //改變xy軸線條的顏色
color: "#E5F0F6",
width: 1 //這里是為了突出顯示加上的
}
},
nameTextStyle: {
color: '#B7B7B7'
}
}
],
series: [{
name: '系統(tǒng)預(yù)警',
type: 'bar',
barWidth: 15, // 柱子寬度
tooltip: {
valueFormatter: function(value) {
return value + ' ';
}
},
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#96DBCA'
},
{
offset: 0.5,
color: '#6EC9C6'
},
{
offset: 1,
color: '#43B6C3'
}
])
},
emphasis: {
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#96DBCA'
},
{
offset: 0.7,
color: '#6EC9C6'
},
{
offset: 1,
color: '#43B6C3'
}
])
}
},
data: [600, 400, 700, 230, 250, 760, 135, 162, 320, 200, 600, 300]
},
{
name: '線下發(fā)現(xiàn)',
type: 'bar',
barWidth: 15, // 柱子寬度
tooltip: {
valueFormatter: function(value) {
return value + ' ';
}
},
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FEC52F'
},
{
offset: 0.5,
color: '#FEB32C'
},
{
offset: 1,
color: '#FE9F29'
}
])
},
emphasis: {
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FEC52F'
},
{
offset: 0.7,
color: '#FEB32C'
},
{
offset: 1,
color: '#FE9F29'
}
])
}
},
data: [200, 200, 300, 400, 600, 100, 200, 230, 230, 160, 120, 610]
},
{
name: '數(shù)量變動',
type: 'line',
symbolSize: 8, //實心大小
symbol: 'circle', //實心
yAxisIndex: 1,
lineStyle: {
width: 3,
shadowColor: 'rgba(0, 216, 255, 1)', //陰影
shadowBlur: 8,
shadowOffsetY: 2
},
tooltip: {
valueFormatter: function(value) {
return value + ' ';
}
},
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#14D8FD'
},
{
offset: 0.5,
color: '#14D8FD'
},
{
offset: 1,
color: '#14D8FD'
}
])
},
data: [65, 46, 83, 57]
}
]
};
var myChartbdtj = echarts.init(document.getElementById('bdtj'));
myChartbdtj.setOption(optionbdtj);效果


總結(jié)
到此這篇關(guān)于如何利用echarts畫雷達(dá)圖和折柱混合的文章就介紹到這了,更多相關(guān)echarts雷達(dá)圖和折柱混合內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
微信小程序 導(dǎo)入圖標(biāo)實現(xiàn)過程詳解
這篇文章主要介紹了微信小程序 導(dǎo)入圖標(biāo)實現(xiàn)過程詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2019-10-10
JavaScript中誤用/g導(dǎo)致的正則test()無法正確重復(fù)執(zhí)行的解決方案
這篇文章主要介紹了JavaScript中誤用/g導(dǎo)致的正則test()無法正確重復(fù)執(zhí)行的解決方案的相關(guān)資料,需要的朋友可以參考下2016-07-07

