• Highcharts 点击多选框取消,添加数据上绑定最大,最小值和图例上绑定提示框数据


    // 自定义图例
     <div class="left">
                    <el-checkbox-group v-model="checkList" @change="changCheck">
                        <el-checkbox v-for="item in legendData" :label="item.index" :key="item.index" @change="handleCheck($event,item.index, item.name)">{{item.name}}<span class="legendNum" :style="{color: item.color}">{{item.legendNum}}</span></el-checkbox>
                    </el-checkbox-group>
                </div>
    import Highcharts from 'highcharts'; 
    import annotations from 'highcharts/modules/annotations';  // 主要引入annotations
     
    当鼠标移在图上移动图例上也显示当前值
    Highcharts  图例提示框代码
    tooltip: {
                                    useHTML: true,
                                    backgroundColor: '#fff',
                                    borderWidth: 0,
                                    valueDecimals: 2,
                                    shared: true, // 提示框显示所有数据
                                    formatter: function () {
                                        // 图例右侧数据
                                        this.points.map((item) => {
                                            that.$set(that.legendData[i],'legendNum',item.y)   // 主要这段
                                        })
                                        return tooltip(this.points);
                                    }
                                },
     
    //  点击按钮取消、添加最大,最小值  绑定id
    chartSetMaxMinCheck(type) {
                    console.log(type)
                    if(type) {
                        this.chartData.map(item => {
                            item.addAnnotation( {
                                id: 'max',
                                labels: [{
                                    point: {
                                        xAxis: 0,
                                        yAxis: 0,
                                        x: 1609257600000,   // 我的图表x轴是时间,1609257600000是时间戳
                                        y: 0
                                    },
                                    text: 'min value'
                                }]})
                        })
                    } else {
                        this.chartData.map(item => {
                            item.removeAnnotation('max');
                        })
                    }
                },
  • 相关阅读:
    jQuery实现鼠标点击Div区域外隐藏Div
    JS判断输入值为正整数
    trim()不兼容ie的问题及解决方法
    傻问题就用傻办法:解决问题有时候不需要探究根源,依据表象就能直接解决
    /vendor/lib64/libOpenCL.so在安卓应用中无访问权限的解决办法
    复数域上的人工神经网络与量子计算
    中国移动CMCC家庭路由器的默认登陆账号
    717. 1-bit and 2-bit Characters
    219. Contains Duplicate II
    1346. Check If N and Its Double Exist
  • 原文地址:https://www.cnblogs.com/whlBooK/p/15619903.html
Copyright © 2020-2023  润新知