Programing

Highcharts에서 제목과 부제목을 비활성화하는 방법이 있습니까?

lottogame 2020. 8. 18. 08:07
반응형

Highcharts에서 제목과 부제목을 비활성화하는 방법이 있습니까?


그래프 주위에있는 html을 사용하여 하드 코딩 할 것입니다. 내장 된 것을 사용하고 싶지 않습니다.

API에 "disable : true"옵션이 표시되지 않습니다.

아무도 여기서 나를 도울 수 있습니까?

하이 차트에서 제목 / 부제목을 어떻게 비활성화합니까?

(단순히 텍스트를 비워두면 제목이있는 곳에 공백이 남아 있습니다. 이런 일이 발생하지 않게하고 싶습니다.)


제목 텍스트를 빈 문자열로 설정하는 것이이를 수행하는 방법입니다.

이 경우 제목에 대한 공간이 생성되지 않습니다.

텍스트없이 : http://jsfiddle.net/jlbriggs/JVNjs/284/

텍스트 포함 : http://jsfiddle.net/jlbriggs/JVNjs/286/

title:{
    text:''
}

이 경우 남은 공간보다 적은 공간을 원하면 'marginTop'을 0으로 설정하십시오.

{{ 수많은 댓글로 인해 수정 :

아래에서 여러 번 지적했듯이 문서는 이제 text: null이를 달성하는 방법으로 명시 되어 있습니다.

두 방법 모두 원하는 결과를 얻습니다.


로부터 highcharts의 문서 :

text : String 차트의 제목입니다. 제목을 비활성화하려면 텍스트를 null로 설정하십시오. 기본값은 차트 제목입니다.

바이올린 : http://jsfiddle.net/daub10dr/

title:{
      text: null
      }

이 방법을 선호합니다.

title: {
    text: '',
    style: {
        display: 'none'
    }
},
subtitle: {
    text: '',
    style: {
        display: 'none'
    }
},

아주 간단합니다! 최신 버전의 Highcharts에서는 제목 및 자막 속성을 false로 설정하기 만하면됩니다.

{
title: false,
subtitle: false
}

여기에서 작동하는 바이올린을 찾으십시오 : https://jsfiddle.net/samuellawrentz/hkqnvm7k/4/


간단합니다 ... 제목의 텍스트 만 null로 설정합니다. 이렇게

    $(function () {
$('#container').highcharts({
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    title: {
        text: null  
    },
    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]        
    }]
});

});

see @ APIreference : http://api.highcharts.com/highcharts#title.text


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.


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.


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


Here is the solution

title: {
    text: null
},
subtitle: {
    text: null
}

Just write a JSON object

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

In react-native below code worked for me,

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

Hope it helped.


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
}

참고URL : https://stackoverflow.com/questions/15930661/is-there-a-way-to-disable-the-title-and-subtitle-in-highcharts

반응형