2016-02-12 24 views
0

我想將標籤對齊到餅圖的右側。目前它是最重要的。我該如何改變它?jQuery Flot庫標籤格式化和調整

這裏是我的代碼:

$json_ar = array(
        ["label"=> "Management Frames", "data"=> $cnt_mgt, "color"=> "#50D050"], 
        ["label"=> "Control frames", "data"=> $cnt_control, "color"=> "#005CDE" ], 
        [ "label"=> "Data Frames", "data"=> $cnt_data, "color"=> "#A52A2A" ], 
        ); 

     //Control vs Data vs Management 
     $json = encode_to_json($json_ar); 
     $pie = " <script type='text/javascript'> 
         $(function() { $.plot($('#cdm_pie'),$json,{series: {pie: {radius:120, show: true, label:{show:true, radius:0.5, formatter:function(label,series){var percent = Math.round(series.percent);return('&nbsp;<b>'+percent+ '%</b>');} }}},legend:{show:true,}}); }); 
         </script>"; 
     $tables["cdm"]="<div id='wrapper' style='display: inline-flex'> 
           <div id='cdm_pie' style='float: none;width: 250px;height: 250px;'></div> 
           $pie 
         </div>"; 

它產生的輸出如下:

enter image description here

而且,我如何更改標籤的顏色從黑到白?

+0

AKHIL嗨,只要改變容器的寬度。看到我張貼在下面的圖片.. –

回答

1

只需增加容器的寬度即可。圖例標記

默認位置是正確的..所以沒有必要擔心..

enter image description here

+0

容器,你的意思是ID ='包裝'的div。另外,理想的寬度應該是多少? –

+0

你能分享你的css代碼和html結構嗎... –

+0

非常感謝。得到它了 :) –