Dja*_*ous 15 javascript api google-visualization background-color
这是饼图char的谷歌代码:
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
var options = {backgroundColor: '#676767',
'width':400,
'height':300};
var chart = new google.visualization.PieChart(document.getElementById('priority_customers_report'));
chart.draw(data, options);
}
</script>
Run Code Online (Sandbox Code Playgroud)
这里backgroundColor: '#676767'给我们的颜色现在我希望它是透明的,我该怎么做?
以及如何在底部设置文本?由于在Google文档中不太清楚,因此很难理解.
MrC*_*ode 28
透明背景可以设置为:
var options = {backgroundColor: 'transparent',
'width':400,
'height':300};
Run Code Online (Sandbox Code Playgroud)
你也可以在那里设置标题:
var options = {backgroundColor: 'transparent',
'width':400,
'height':300,
'title' : 'My Chart'};
Run Code Online (Sandbox Code Playgroud)
编辑: 要设置要在底部显示的右手项目使用:
var options = {backgroundColor: 'transparent',
'width':400,
'height':300,
'title' : 'My Chart'
legend : { position : 'bottom' }
};
Run Code Online (Sandbox Code Playgroud)
可能的选项列表在这里.
| 归档时间: |
|
| 查看次数: |
18531 次 |
| 最近记录: |