提交 3d6ab40c 编写于 作者: zhujiamin's avatar zhujiamin

feat: 删除重发

上级 ef7380da
.am-pie-threed-echarts {
width: 100%;
height: 600px;
/* stylelint-disable-next-line selector-id-pattern */
#myChart {
width: 100%;
height: 100%;
}
}
import { defineComponent, ref, onMounted } from 'vue';
import * as am4core from '@amcharts/amcharts4/core';
import * as am4charts from '@amcharts/amcharts4/charts';
// eslint-disable-next-line camelcase
import am4themes_animated from '@amcharts/amcharts4/themes/animated';
import './am-pie-threed-echarts.scss';
export const AmPie3D = defineComponent({
name: 'Pie3D',
props: {
pieData: {
type: Array<IData>,
default: () => [],
},
},
setup(_props) {
const pieChart = ref(null);
onMounted(() => {
// Set theme
am4core.useTheme(am4themes_animated);
// Create chart instance
const chart = am4core.create('myChart', am4charts.PieChart3D);
// 角度
chart.angle = 50;
// 厚度
chart.depth = 20;
// Add data
chart.data = [
{
category: 'Lithuania',
value: 501.9,
sliced: true,
color: am4core.color('#F44336'),
},
{
category: 'Czechia',
value: 301.9,
sliced: true,
color: am4core.color('#4CAF50'),
},
{
category: 'Ireland',
value: 201.1,
sliced: true,
color: am4core.color('#2196F3'),
},
{
category: 'Germany',
value: 165.8,
sliced: true,
color: am4core.color('#FFC107'),
},
{
category: 'Australia',
value: 139.9,
sliced: true,
color: am4core.color('#9C27B0'),
},
{
category: 'Austria',
value: 128.3,
sliced: true,
},
{
category: 'UK',
value: 99,
sliced: true,
},
{
category: 'Belgium',
value: 60,
sliced: true,
},
{
category: 'The Netherlands',
value: 50,
sliced: true,
},
];
// Add and configure Series
const pieSeries = chart.series.push(new am4charts.PieSeries3D());
pieSeries.dataFields.value = 'value';
pieSeries.dataFields.category = 'category';
pieSeries.slices.template.stroke = am4core.color('#fff');
pieSeries.slices.template.strokeWidth = 2;
pieSeries.slices.template.strokeOpacity = 1;
// 设置图例
chart.legend = new am4charts.Legend();
chart.legend.position = 'right';
// 设置 isActive 属性为数据项的 sliced 属性
pieSeries.slices.template.propertyFields.isActive = 'sliced';
// 设置颜色字段为 "color"
pieSeries.slices.template.propertyFields.fill = 'color';
});
return {
pieChart,
};
},
render() {
return (
<div class='am-pie-threed-echarts'>
<div id='myChart' ref='pieChart' />
</div>
);
},
});
.chart-wrapper {
width: 100%;
height: 600px;
/* stylelint-disable-next-line selector-id-pattern */
#myChart {
width: 100%;
height: 100%;
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册