(function() { const dom = document.getElementById('chart-pict-bar'); const myChart = echarts.init(dom); const categories = ['类别A', '类别B', '类别C', '类别D', '类别E']; const values = [85, 72, 63, 58, 45]; const maxVal = Math.max(...values); // 通用菱形符号(可用实际 SVG path 替换) const diamond = 'path://M5 0 L10 5 L5 10 L0 5 Z'; myChart.setOption({ grid: { left: '12%', right: '8%', top: '8%', bottom: '12%' }, tooltip: { trigger: 'axis' }, xAxis: { type: 'category', data: categories }, yAxis: { type: 'value', max: maxVal * 1.2, name: '数值' }, series: [{ type: 'pictorialBar', data: values, symbol: diamond, symbolSize: [30, 18], symbolRepeat: true, symbolMargin: 4, symbolClip: true, itemStyle: { color: '#3b82f6' } }] }); window.addEventListener('resize', () => myChart.resize()); })();