2014-10-06 2 views
4

예제에서 범례 제목 'City'는 왼쪽에 수평으로 정렬되어 있습니다. 전설 영역의 중심에 제목을 수평으로 정렬 할 수있는 방법이 있습니까?하이 차트 범례 제목 가로 맞춤

legend: { 
     title: { 
      text: 'City<br/><span style="font-size: 9px; color: #666; font-weight: normal">(Click to hide)</span>', 
      style: { 
       fontStyle: 'italic' 
      } 
     } 
    }, 

위의 범례 제목에서 스타일을 편집해도 아무 것도 보이지 않습니다.

예 : http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/legend/title/

감사합니다.

답변

4

힘든 부분. 내가 가지고 올 수

만 것은 차트 부하에 프로그래밍을하는 것입니다 : fiddle

function(){ 
    var legWidth = this.legend.maxItemWidth; // width of legend 
    $.each(this.legend.title.element.children[0].children, function(i,j){ 
     j = $(j); // for each span in title 
     var spanWidth = j.width(); 
     j.attr('dx', (legWidth/2) - (spanWidth/2)); // move it to center 
    }); 
} 

업데이트되었습니다.

+0

이것은 설정 일 것입니다. 이는 특히 그들이 지원하는 다른 모든 스타일을 고려할 때 분명한 스타일 요구 사항입니다. – leigero

관련 문제