2017-10-13 77 views
1

我想改變我的傳奇,我必須刪除分頁,並把所有標題放在一兩行。我想改變圖標。谷歌圖表 - 傳奇

它的外觀是現在這個樣子

,我想這樣的事情

enter image description here

我把scrollArrows: '無',但它不工作。 這是我在控制器代碼:

var optionsMobile = { 
width: '100%', 
height: '100%', 
pointSize: 5, 
series: { 
    pointShape: 'circle' 
}, 
chartArea: { 
    width: '80%', 
    height: '70%' 
}, 
legend: { 
    position: 'bottom', 
    textStyle: { 
     color: 'white' 
    }, 
    pagingTextStyle: { color: '#666' }, 
    scrollArrows: 'none' 
}, 
backgroundColor: 'transparent', 
titleTextStyle: { 
    color: 'white', 
    height: "40px" 
}, 
hAxis: { 
    textStyle: { 
     color: 'white' 
    } 
}, 
vAxis: { 
    textStyle: { 
     color: 'white' 
    } 
}, 
}; 

回答

1

根據configuration options ...

設置legend.maxLines到一個大於一個行添加到您的傳奇。
此選項目前僅適用於legend.position: 'top'
注意:用於確定實際渲染行數的確切邏輯仍處於不斷變化之中。

var options = { 
    legend: { 
    maxLines: 2, 
    position: 'top' 
    } 
}; 

看到下面的工作片段...

google.charts.load('current', { 
 
    packages: ['corechart'] 
 
}).then(function() { 
 
    var data = google.visualization.arrayToDataTable([ 
 
    ['x', 'NYCLS 2016 Boys', 'NYCLS 2016 Girls', 'NYCLS 2017 Boys', 'NYCLS 2017 Girls'], 
 
    [1, 10, 15, 20, 25], 
 
    [2, 12, 18, 24, 30], 
 
    [3, 14, 21, 28, 35], 
 
    [4, 16, 24, 32, 40] 
 
    ]); 
 

 
    var options = { 
 
    legend: { 
 
     maxLines: 2, 
 
     position: 'top' 
 
    }, 
 
    width: 360 
 
    }; 
 

 
    var chart = new google.visualization.LineChart(document.getElementById('chart_div')); 
 
    chart.draw(data, options); 
 
});
<script src="https://www.gstatic.com/charts/loader.js"></script> 
 
<div id="chart_div"></div>