12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <template>
- <div class="container">
- <!-- E-Profit 利润-->
- <div id="EGiveBirth" style="height:400px;"></div>
- </div>
- </template>
- <script>
- export default {
- name: "EGiveBirth",
- data() {
- return {};
- },
- mounted() {
- this.drawChart();
- },
- methods: {
- drawChart() {
- // 基于准备好的dom,初始化echarts实例
- let myChart = this.$echarts.init(
- document.getElementById("EGiveBirth")
- );
- // 指定图表的配置项和数据
- let option = {
- title: {
- text: "利润分析",
- left: "center",
- bottom: 0
- },
- color: ["#5bf0b2", "#FFB2FF", "#3ABAFF", "#FF6A01", "#ff8295"],
- tooltip: {
- trigger: "axis",
- axisPointer: {
- // 坐标轴指示器,坐标轴触发有效
- type: "shadow" // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- grid: {
- left: "8%",
- right: "4%",
- bottom: "10%",
- containLabel: true
- },
- xAxis: [
- {
- type: "category",
- data: ["销售总额", "总成本", "利润"],
- axisTick: {
- alignWithLabel: true
- }
- }
- ],
- yAxis: [
- {
- type: "value"
- }
- ],
- series: [
- {
- name: "数量",
- type: "bar",
- barWidth: "30%",
- data: [100, 36, 33],
- itemStyle: {
- normal: {
- color: function(params) {
- var colorList = [
- "#FF9900",
- "#999966",
- "#0099FF"
- ];
- return colorList[params.dataIndex];
- }
- }
- }
- }
- ]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- </style>
|