import * as echarts from 'echarts';
const option = {
title: {
text: 'Product Performance Analysis'
},
// Define the parallel coordinate system
parallel: {
left: '5%',
right: '15%',
bottom: '10%',
top: '10%',
layout: 'horizontal',
parallelAxisDefault: {
type: 'value',
nameLocation: 'end',
nameGap: 20,
nameTextStyle: {
fontSize: 12
},
axisLine: {
lineStyle: {
color: '#aaa'
}
},
axisTick: {
lineStyle: {
color: '#777'
}
},
splitLine: {
show: false
},
axisLabel: {
color: '#999'
}
}
},
// Define individual parallel axes
parallelAxis: [
{ dim: 0, name: 'Price', type: 'value' },
{ dim: 1, name: 'Quantity', type: 'value' },
{ dim: 2, name: 'Score', type: 'value', min: 0, max: 100 },
{
dim: 3,
name: 'Rating',
type: 'category',
data: ['Poor', 'Fair', 'Good', 'Excellent']
},
{ dim: 4, name: 'Satisfaction', type: 'value', min: 0, max: 10 }
],
visualMap: {
show: true,
min: 0,
max: 100,
dimension: 2, // Map color based on 'Score' dimension
inRange: {
color: ['#d94e5d', '#eac736', '#50a3ba']
}
},
series: [
{
name: 'Products',
type: 'parallel',
lineStyle: {
width: 2,
opacity: 0.5
},
emphasis: {
lineStyle: {
width: 4,
opacity: 1
}
},
data: [
[12.99, 100, 82, 'Good', 8.2],
[9.99, 80, 77, 'Good', 7.5],
[20.99, 120, 90, 'Excellent', 9.1],
[15.50, 95, 85, 'Good', 8.5],
[8.99, 60, 65, 'Fair', 6.8],
[25.00, 150, 95, 'Excellent', 9.5]
]
}
]
};
const chart = echarts.init(document.getElementById('main'));
chart.setOption(option);