• highchart笔记第二天


    1.动态设置和获取标题
    1)动态设置和获取标题
    var chart = Highcharts.chart(el, options); // Highcharts构造函数
    var title = chart.title.textStr; // 通过chart对象获取标题内容
    2)Highcharts 提供了 setTitle() 函数供动态设置标题用
    setTitle (Object title, object subtitle, Boolean redraw)
    参数说明:

    title : 标题对象
    subtitle: 副标题对象
    redraw:是否重绘,即设置标题后是否重新绘制图表,默认是false
    var subtitle = {
    style:{
    color:"#000",
    fontWeight:"bold"
    }
    };

    chart.setTitle(null, subtitle); //设置副标题,第一个参数设置为null
    常见问题 设置usehtml 为true 然后在标题文字加入a标签
    1.1)如果添加链接
    title :{
    useHTML:true,
    text: "Highcharts中文网 | <a href='https://www.hcharts.cn' target='_blank'>中文教程</a>"
    }
    1.2如何隐藏标题
    title: {
    text: null
    }


    2.坐标轴
    默认情况下,x轴显示在图表的底部,y轴显示在左侧(多个y轴时可以是显示在左右两侧),通过设置chart.inverted = true 可以让x,y轴显示位置对调
    yAxis: {
    labels: {
    formatter:function(){
    if(this.value <=100) {
    return "第一等级("+this.value+")";
    }else if(this.value >100 && this.value <=200) {
    return "第二等级("+this.value+")";
    }else {
    return "第三等级("+this.value+")";
    }
    }
    }
    }

  • 相关阅读:
    记录Integer比较问题
    代码中获取git输出
    python open mode
    elasticsearch Unrecognized VM option 'UseParNewGC'
    应用商店显示无法加载页面 请稍后重试
    deep learning with python前五章笔记
    QWeb2: Template 'systray_odoo_referral.gift_icon' not found
    wifi scapy
    struct.pack, struct.unpack详解
    python f-string
  • 原文地址:https://www.cnblogs.com/930115586qq/p/9488984.html
Copyright © 2020-2023  润新知