Is there a way to disable the Title and Subtitle in Highcharts?

后端 未结 14 661
伪装坚强ぢ
伪装坚强ぢ 2020-12-25 09:04

I\'m just going to hardcode it in using html that is around the graph, I don\'t want to use the built in.

I don\'t see a \"disable: true\" option in the API.

相关标签:
14条回答
  • 2020-12-25 09:37

    You can always do this:

    chart:{
        marginTop: 30
    }
    
    title:{
        text: ''
    }
    

    That worked for me :-)

    note: this answer was for version 2.*, for newer versions there are better answers.

    0 讨论(0)
  • 2020-12-25 09:38

    This is a bit of a hack but you can also try that:

    title: {
        text: '<span class="hidden">My custom Hello</span>',
        align:"left",
        useHTML:true
    }
    
    0 讨论(0)
  • 2020-12-25 09:40

    Here is the solution

    title: {
        text: null
    },
    subtitle: {
        text: null
    }
    
    0 讨论(0)
  • 2020-12-25 09:41

    According the Highcharts doc, the correct way is to set 'text' to null.

    0 讨论(0)
  • 2020-12-25 09:52

    From the highcharts doc:

    text: String The title of the chart. To disable the title, set the text to null. Defaults to Chart title.

    fiddle: http://jsfiddle.net/daub10dr/

    title:{
          text: null
          }
    
    0 讨论(0)
  • 2020-12-25 09:56

    I prefer this method :

    title: {
        text: '',
        style: {
            display: 'none'
        }
    },
    subtitle: {
        text: '',
        style: {
            display: 'none'
        }
    },
    
    0 讨论(0)
提交回复
热议问题