import * as echarts from 'echarts';
const option = {
title: {
text: 'Product Quality Distribution'
},
tooltip: {
trigger: 'item',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '10%',
right: '10%',
bottom: '15%'
},
xAxis: {
type: 'category',
data: ['Product A', 'Product B', 'Product C', 'Product D'],
boundaryGap: true,
splitArea: {
show: false
},
splitLine: {
show: false
}
},
yAxis: {
type: 'value',
name: 'Quality Score',
splitArea: {
show: true
}
},
series: [
{
name: 'boxplot',
type: 'boxplot',
data: [
[850, 870, 900, 950, 1000], // Product A: min, Q1, median, Q3, max
[750, 800, 850, 900, 950], // Product B
[700, 750, 800, 850, 900], // Product C
[800, 850, 900, 950, 1050] // Product D
],
itemStyle: {
color: '#fff',
borderWidth: 2
},
emphasis: {
scale: true,
itemStyle: {
borderWidth: 3,
shadowBlur: 5,
shadowOffsetX: 1,
shadowOffsetY: 1
}
}
}
]
};
const chart = echarts.init(document.getElementById('main'));
chart.setOption(option);