echarts-组合图

这里写图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>echarts.js案例一</title>
    <script type="text/javascript" src='lib/echarts/dist/echarts.js'></script>
</head>
<body>
    <div id="chart" style="width:100%;height:600px;"></div>
</body>
<script type="text/javascript">
    // 初始化图表标签
    var myChart = echarts.init(document.getElementById('chart'));


    var placeHolderStyle = {
        normal: {
            label: {
                show: false,
                position: "center"
            },
            labelLine: {
                show: false
            },
            color: "#dedede",
            borderColor: "#dedede",
            borderWidth: 0
        },
        emphasis: {
            color: "#dedede",
            borderColor: "#dedede",
            borderWidth: 0
        }
    };
    var options = {
        backgroundColor: "#404A59",
        color: ['#ffd285', '#ff733f', '#ec4863'],

        title: [{
            text: '组合图',
            left: '40%',
            top: '6%',
            textStyle: {
                color: '#ffd285'
            }
        }],
        tooltip: {
            /*trigger: 'item',
            formatter: "{a} <br/>{b} : {c}"
            formatter: function(params) {
                //return params.seriesType
                //return params.name+':'+params.value
            }*/
        },
        legend: {
            x: '30%',
            bottom: '1%',
            textStyle: {
                color: '#ffd285',
            },
            data: ['郑州', '永城', '新乡']
        },
        radar: {
            // shape: 'circle',
            indicator: [{
                name: '销售',
                max: 6500
            }, {
                name: '管理',
                max: 16000
            }, {
                name: '信息技术',
                max: 30000
            }, {
                name: '客服',
                max: 38000
            }, {
                name: '研发',
                max: 52000
            }, {
                name: '市场',
                max: 25000
            }],
            center: ['83%', '85%'],
            radius: 80
        },
        grid: {
            left: '10%',
            right: '35%',
            top: '16%',
            bottom: '6%',
            containLabel: true
        },
        toolbox: {
            "show": false,
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            "axisLine": {
                lineStyle: {
                    color: '#c0576d'
                }
            },
            "axisTick": {
                "show": false
            },
            axisLabel: {
                textStyle: {
                    color: '#ffd285'
                }
            },
            boundaryGap: true, //false时X轴从0开始
            data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        },
        yAxis: {
            "axisLine": {
                lineStyle: {
                    color: '#c0576d'
                }
            },
            splitLine: {
                show: true,
                lineStyle: {
                    color: '#c0576d'
                }
            },
            "axisTick": {
                "show": false
            },
            axisLabel: {
                textStyle: {
                    color: '#ffd285'
                }
            },
            type: 'value'
        },
        series: [{
                name: '郑州',
                smooth: true,
                type: 'bar',
                symbolSize: 8,
                //symbol: 'circle',
                data: [90, 50, 39, 50, 120, 82, 80]
            }, {
                name: '永城',
                smooth: true,
                type: 'bar',
                symbolSize: 8,
                //symbol: 'circle',
                data: [70, 50, 50, 87, 90, 80, 70]
            }, {
                name: '新乡',
                smooth: true,
                type: 'bar',
                symbolSize: 8,
                //symbol: 'circle',
                data: [290, 200, 20, 132, 15, 200, 90]
            }, {
                type: 'pie',
                center: ['83%', '20%'],
                radius: ['15%', '20%'],
                tooltip: {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                label: {
                    normal: {
                        position: 'center'
                    }
                },
                data: [{
                    value: 335,
                    name: '污染来源分析',
                    itemStyle: {
                        normal: {
                            color: '#ffd285'
                        }
                    },
                    label: {
                        normal: {
                            formatter: '{d} %',
                            textStyle: {
                                color: '#ffd285',
                                fontSize: 20

                            }
                        }
                    }
                }, {
                    value: 180,
                    name: '占位',
                    tooltip: {
                        show: false
                    },
                    itemStyle: {
                        normal: {
                            color: '#404A59'
                        }
                    },
                    label: {
                        normal: {
                            textStyle: {
                                color: '#ffd285',
                            },
                            formatter: '\n汽车尾气'
                        }
                    }
                }]
            }, {
                type: 'pie',
                center: ['83%', '50%'],
                radius: ['15%', '20%'],
                name: '饼图',
                tooltip: {
                    trigger: 'item',
                    formatter: "{a} <br/>{b} : {c} ({d}%)"
                },
                /* label: {
                         normal: {
                             textStyle: {
                                 color: '#ffd285',
                             },
                             formatter: "{b}: {c} ({d}%)"
                         }
                     },*/
                data: [{
                    value: 335,
                    name: '直接访问',
                    itemStyle: {
                        normal: {
                            color: '#FF3300'
                        }
                    }
                }, {
                    value: 310,
                    name: '邮件营销',
                    itemStyle: {
                        normal: {
                            color: '#FFFF00'
                        }
                    }
                }, {
                    value: 234,
                    name: '联盟广告',
                    itemStyle: {
                        normal: {
                            color: '#00FF00'
                        }
                    }
                }, {
                    value: 135,
                    name: '视频广告',
                    itemStyle: {
                        normal: {
                            color: '#1E90FF'
                        }
                    }
                }, {
                    value: 1548,
                    name: '搜索引擎',
                    itemStyle: {
                        normal: {
                            color: '#ADFF2F'
                        }
                    }
                }]
            },

            {
                type: 'radar',
                center: ['83%', '85%'],
                //radius: ['15%', '20%'],
                //name: '雷达',
                tooltip: {

                },
                data: [{
                    value: [4300, 10000, 28000, 35000, 50000, 19000],
                    name: '预算分配'
                }, {
                    value: [5000, 14000, 28000, 31000, 42000, 21000],
                    name: '实际开销'
                }]
            }
        ]
    }
    myChart.setOption(options);
</script>
</html>
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
是的,我可以使用ECharts绘制组合组合是一种将多种不同类型的组合在一起呈现的表类型,可以同时展示多种数据之间的关系和趋势。ECharts提供了多种组合的类型,例如折线与柱状组合、折线与散点组合等。 下面是一个使用ECharts绘制折线与柱状组合的示例代码: ``` option = { tooltip: { trigger: 'axis' }, legend: { data:['销量','收入'] }, xAxis: [ { type: 'category', data: ['周一','周二','周三','周四','周五','周六','周日'] } ], yAxis: [ { type: 'value', name: '销量', axisLabel: { formatter: '{value} 件' } }, { type: 'value', name: '收入', axisLabel: { formatter: '{value} 元' } } ], series: [ { name:'销量', type:'bar', data:[10, 20, 30, 40, 50, 60, 70] }, { name:'收入', type:'line', yAxisIndex: 1, data:[100, 200, 300, 400, 500, 600, 700] } ] }; ``` 在上面的示例代码中,我们定义了一个包含两个系列的组合,第一个系列是柱状,用于展示销量数据,第二个系列是折线,用于展示收入数据。在定义系列的时候,我们需要指定系列的类型、数据、名称等参数,以及系列所使用的坐标轴。通过这些参数的配置,我们就可以绘制出一个简单的折线与柱状组合。 当然,ECharts还提供了更多的组合类型供用户选择,用户可以根据自己的需求选择合适的组合类型进行数据可视化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值