本文介绍了注释颜色仅在Google条形图之外的文本时显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Google
解决方案
关闭 annotations.highContrast
来自文档...
请参阅以下示例,请注意 textStyle.auraColor
google.charts.load('current',{回调:函数(){新的google.visualization.ColumnChart(document.getElementById('chart_div')).draw(google.visualization.arrayToDataTable([['Element','Density',{角色:'annotation'}],['Copper',8.94,'Cu'],['Silver',10.49,'Ag'],['Gold',19.30,'Au'],['Platinum',21.45,'Pt']]),{注释:{highContrast:否,textStyle:{auraColor:石灰",颜色:#000000",字体大小:18}},颜色:['石灰']});},软件包:['corechart']});
< script src ="https://www.gstatic.com/charts/loader.js"></script>< div id ="chart_div"></div>
另一个选项可能是 annotations.alwaysOutside
I have a google bar chart and I am setting the font size and the color, however the color only applies when the text is outside of the bar. How do I force the color to apply?
annotations: {
textStyle: {
fontSize: 18,
color:'#000000'
}
}
解决方案
turn off annotations.highContrast
from the documentation...
see following example, note the use of textStyle.auraColor
google.charts.load('current', {
callback: function () {
new google.visualization.ColumnChart(document.getElementById('chart_div')).draw(
google.visualization.arrayToDataTable([
['Element', 'Density', { role: 'annotation' } ],
['Copper', 8.94, 'Cu' ],
['Silver', 10.49, 'Ag' ],
['Gold', 19.30, 'Au' ],
['Platinum', 21.45, 'Pt' ]
]),
{
annotations: {
highContrast: false,
textStyle: {
auraColor: 'lime',
color: '#000000',
fontSize: 18
}
},
colors: ['lime']
}
);
},
packages: ['corechart']
});
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
another option might be annotations.alwaysOutside
这篇关于注释颜色仅在Google条形图之外的文本时显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!