echart在ie8下的bug

echart在多个div上实例化后自己会有联系。标准的例子如下:

  <div id='main' style="height: 500px;margin:50px; display:block"></div>

//初始化
   var option = {
                title: {
                    text: "车辆费用统计图",
                    x: "center",
                    y: "top"
                },
                tooltip: {
                    trigger: 'item', //触发类型,默认数据触发,可选为:'item' | 'axis'
                    formatter: "{a} <br/>{b} : {c} ({d}%)"  //内容格式器:{string}(Template) | {Function},支持异步回调
                },
                legend: {
                    orient: 'vertical',
                    x: 'left',
                    data: name1,
                    legendHoverLink: true,
                },
                toolbox: {
                    show: true,
                    feature: {
                        mark: { show: true },
                        dataView: { show: true, readOnly: false },
                        magicType: {
                            show: true,
                            type: ['pie', 'funnel'],
                            option: {
                                funnel: {
                                    x: '25%',
                                    width: '50%',
                                    funnelAlign: 'left',
                                    max: 1548
                                }
                            }
                        },
                        restore: {
                            show: true
                        },
                        saveAsImage: { show: true }
                    }
                },
                calculable: true,//是否数据拖拽合并
                series: [{
                    //clickable: true,
                    name: '费用(元)',
                    type: 'pie',
                    minAngle: 5,
                    radius: ['30%', '45%'],//'25%',   //半径,支持绝对值(px)和百分比,百分比计算比,min(width, height) / 2 * 75%, 传数组实现环形图,[内半径,外半径]
                    center: ['50%', '60%'],//圆心坐标,支持绝对值(px)和百分比,百分比计算min(width, height) * 50%
                    data: vvv1,
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                formatter: '{b} : {c} ({d}%)'
                            },
                            labelLine: { show: true }
                        }
                    }

                }],


            };
            require(['echarts', 'echarts/chart/pie', 'echarts/chart/line'], function (ec) {
                myChart = ec.init(document.getElementById('main'), 'macarons');
                //var ecConfig = require('echarts/config');

                //myChartPie.on(ecConfig.EVENT.CLICK, eConsole);
                myChart.setOption(option, true);
            });

//切换视图  

  var     option = {
                tooltip: {
                    show: true
                },
                title: {
                    x: 'center',
                    text: '车辆费用统计图',

                },

                legend: {
                    y: 'bottom',
                    data: ['费用(元)']
                },
                toolbox: {
                    show: true,
                    feature: {

                        mark: { show: true },
                        dataView: { show: true, readOnly: false },
                        magicType: { show: true, type: ['bar'] },
                        restore: { show: true },
                        saveAsImage: { show: true }
                    }
                },
                xAxis: [
                    {
                        type: 'category',
                        data: name1
                    }
                ],
                yAxis: [
                    {
                        name: '费用(元)',
                        type: 'value'
                    }
                ],
                series: [{
                    name: '费用)',
                    type: 'bar',
                    data: value1,
                    barWidth: 100,//固定柱子宽度
                }

                ]
            };
myChart.clear();
       myChart.setOption(option);

如果想动态调整大小,可以
$(“#echart1”).width(widthHalf);
echart1.resize();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值