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

后端 未结 14 647
伪装坚强ぢ
伪装坚强ぢ 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:57

    Set the text field to null

    From the documentation at http://api.highcharts.com/highcharts#title.text

    text: String

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

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

    Setting the title text to an empty string is the way to do it.

    No space is created for the title in that case:

    without text: http://jsfiddle.net/jlbriggs/JVNjs/284/

    with text: http://jsfiddle.net/jlbriggs/JVNjs/286/

    title:{
        text:''
    }
    

    If you want less space than is left in that case, simply set your 'marginTop' to 0

    {{edit due to numerous comments:

    As pointed out a number of times below, the documentation now states text: null as the method to achieve this.

    Either method achieves the desired result.

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

    This works for me!!!

    title:false

    0 讨论(0)
  • 2020-12-25 10:00

    For those that use Typescript you can set the Highcharts.TitleOptions to hide the chart title.

    title: {
      text: undefined
    },
    subtitle: {
      text: undefined
    }
    
    0 讨论(0)
  • 2020-12-25 10:00

    In react-native below code worked for me,

      title: {
        style : {
          display : 'none'
        }
     }
    

    Hope it helped.

    0 讨论(0)
  • 2020-12-25 10:00

    Just write a JSON object

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