2013-07-18 1 views
0

그래프를 만들 때 zingcharts를 사용하고 있습니다. 내 그래프에는 많은 항목이있는 범례가 있으며 그래프와 상당히 겹칩니다. 내가zingcharts legend adjustLayout 속성이 아무 것도하지 않습니까?

adjustLayout를 읽을 API를 통해가는

은 : 범례 위치를 고려하고 그것으로 중복 방지하기 위해 plotarea을 강제로.

나는 완벽하게 들린다. 나는 그것을 진실로 설정하고 아무 일도 일어나지 않는다. wtf. 누구나이 경험이 있습니까?

{ 
     "gui":{ 
      "behaviors":[ 
       { 
        "id": "SaveAsImage", 
        "text": "Save As Image", 
        "function": "exportimageurl" 
       } 
      ] 

     }, 
     "graphset":[ 
     { 
      "type":"mixed", 
      "background-color":"#E6E6E6", 
      "stacked":"0", 
      "plotarea":{ 
       "margin":"'.$margin.'" 
      }, 
      "title":{ 
       "text":"'.$title.'", 
       "align":"center", 
       "font-family":"Arial", 
       "font-size":"18px", 
       "font-color":"#000000", 
       "font-weight":"bold", 
       "background-color":"#E6E6E6" 
      }, 
      "legend":{ 
            "adjustLayout": true, 
       "position":"50% 100%", 
       "margin":"30 3 5 3", 
       "layout":"x2", 
       "font-family":"arial", 
       "font-size":"8px", 
       "background-color":"#E6E6E6", 
       "toggle-action":"remove", 
       "width":"435px", 
       "item":{ 
        "marker-style":"square", 
        "font-color":"#000000", 
        "border-width":"0px" 
       } 
      } 

답변

1
나는 당신이 ZingChart를 만들기 위해 제공되는 JSON을 사용

(일부 시리즈 데이터를 간단하게 제거 GUI 객체를 추가하고 변수에 의존하는 속성 제거)은 "adjustLayout"속성에서 근무

 

    { 
     "graphset":[ 
      { 
      "type":"bar", 
      "background-color":"#E6E6E6", 
      "stacked":"0", 
      "plotarea":{ 

      }, 
      "title":{ 
       "text":"X", 
       "align":"center", 
       "font-family":"Arial", 
       "font-size":"18px", 
       "font-color":"#000000", 
       "font-weight":"bold", 
       "background-color":"#E6E6E6" 
      }, 
      "legend":{ 
       "adjustLayout":true, 
       "position":"50% 100%", 
       "margin":"30 3 5 3", 
       "layout":"x2", 
       "font-family":"arial", 
       "font-size":"8px", 
       "background-color":"#E6E6E6", 
       "toggle-action":"remove", 
       "width":"435px", 
       "item":{ 
        "marker-style":"square", 
        "font-color":"#000000", 
        "border-width":"0px" 
       } 
      }, 
       "series":[ 
      { 
       "values":[69,68,54,48,70,74,98,70,72,68,49,69], 
       "text":"Apple" 
      }, 
      { 
       "values":[51,53,47,60,48,52,75,52,55,47,60,48], 
       "text":"Microsoft" 
      }, 
      { 
       "values":[42,43,30,40,31,48,55,46,48,32,38,38], 
       "text":"Oracle" 
      }, 
      { 
       "values":[25,15,26,21,24,26,33,25,15,25,22,24], 
       "text":"Dell" 
      } 
     ] 
    } 
    ] 
    } 

을 LEGEND는 "margin"속성이 PLOTAREA에서 제거되었을 때 나타납니다. 이것이 공유 한 코드와이 게시물에서 공유 한 코드의 가장 큰 차이점입니다.

관련 문제