zoukankan      html  css  js  c++  java
  • 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');
                        })
                    }
                },
  • 相关阅读:
    STL中set底层实现方式? 为什么不用hash?
    main 主函数执行完毕后,是否可能会再执行一段代码?(转载)
    计算机网络(转载)
    2014! 的末尾有多少个0
    最常见的http错误
    内存分配(转载)
    delphi中指针操作符^的使用
    虚拟方法virtual的用法
    调用父类方法
    指针
  • 原文地址:https://www.cnblogs.com/whlBooK/p/15619903.html
Copyright © 2011-2022 走看看