效果展示:
分析:
(1)如果不展示内部的 百分比 数字,那么这个饼图没什么难度。但是要是实现内外部同时展示文字,就需要思考下。
(2)实现内外部同时展示:需要两份饼图,叠在一起(看下下面代码就很清楚了)。
代码展示:
<template>
<div id="echartPie" style="width: 100%;height: 300px;"></div>
</template>
<script>
let echarts = require("echarts/lib/echarts"); // 引入基本模板
require("echarts/lib/chart/line"); // 引入折线图组件
require("echarts/lib/chart/bar"); // 引入柱状图组件
require("echarts/lib/component/tooltip"); // 引入提示框
require("echarts/lib/component/title"); // title组件
export default {
name: "eCharts",
data() {
return {
msg: "",
pieData:[
{ value: 335, name: "非常满意", itemStyle: { color: "#8cb1f9" } },
{ value: 310, name: "满意", itemStyle: { color: "#f8d27a" } },