2016-05-20 33 views
-1

我的結果是: enter image description herephantomjs/highchart:當導出到PNG/PDF如何處理傳奇溢出

任何建議歡迎。仍然陷在這個問題。 有時,圖例中的項目太多,如何處理圖例溢出。一種方法是根據系列的大小(下面的導出設置)設置高度和寬度。 有什麼更好的辦法?

{ 
    "subtitle": { 
    "text": "2016-05-19 12:09 to 2016-05-26 12:09" 
    }, 
    "title": { 
    "text": "Query" 
    }, 
    "series": [ 

    ], 
    "yAxis": { 
    "title": { 
     "text": "Count" 
    } 
    }, 
    "tooltip": { 
    "pointFormat": "<span style=\\\\"color:{point.color}\\\\">{series.name}</span>: <b>{point.y}</b><br/>" 
    }, 
    "credits": { 
    "enabled": false 
    }, 
    "plotOptions": { 
    "column": { 
     "colorByPoint": false 
    } 
    }, 
    "xAxis": { 
    "labels": { 
     "style": { 
     "fontSize": "9px" 
     } 
    }, 
    "type": "category" 
    }, 
    "exporting": { 
    "sourceHeight": 3000, 
    "chartOptions": { 
     "chart": { 
     "height": 2000 
     }, 
     "legend": { 
     "maxHeight": 1600 
     } 
    } 
    }, 
    "type": "chart", 
    "legend": { 
    "enabled": true 
    } 
} 

回答

0

有可能越過你指的是用一個簡單的函數,將只返回相同的值作爲第一個參數的函數。但是,禁用這樣的圖例導航會使您的圖例相當大 - 取決於實際數據。

實施例:在出口對象的maxHeight參數http://jsfiddle.net/zwL7v6by/

$(function() { 
    Highcharts.Legend.prototype.handleOverflow = function(legendHeight) { 
    return legendHeight; 
    }; 

    $('#container').highcharts({ 
    series: [{ 
     type: 'pie', 
     showInLegend: true, 
     data: [1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7] 
    }] 
    }); 
}); 
1

集未定義的值。

legend: { 
     layout: 'vertical', 
     align: 'right', 
     verticalAlign: 'top', 
     maxHeight: 40 
    }, 
    exporting:{ 
     chartOptions:{ 
     legend:{ 
      maxHeight: undefined 
     } 
     } 
    }, 

實施例:

+0

我試圖修改上述我的代碼來使用未定義作爲maxHeight(maxHeight =未定義)。但失敗了。 – BAE

+0

你可以更新我的代碼與你的介紹這個問題? –

+0

請參閱我的更新。謝謝 – BAE