Google Diff条形图-更改条形颜色

萨蒂斯温

我有一个Google Diff条形图。我正在尝试更改外部栏的颜色。默认情况下,它是褪色的颜色。我可以在选项下使用color参数更改内部栏的颜色。有人可以指导我吗?这是我的下面的代码。

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
  <script type="text/javascript">
    google.load("visualization", '1.1', {packages:['corechart']});
    google.setOnLoadCallback(drawChart);
function drawChart() {
var oldData = google.visualization.arrayToDataTable([
  ['Name', 'Popularity'],
  ['Cesar', 250],
  ['Rachel', 4200],
  ['Patrick', 2900],
  ['Eric', 8200]
]);

var newData = google.visualization.arrayToDataTable([
  ['Name', 'Popularity'],
  ['Cesar', 370],
  ['Rachel', 600],
  ['Patrick', 700],
  ['Eric', 3500]
]);
var colChartDiff = new google.visualization.ColumnChart(document.getElementById('colchart_diff'));
var options = { 
diff: { newData: { widthFactor: 0.6 } },
legend: { position: 'top' } ,
colors: ['#f38eff', '#C0C0C0'],
backgroundColor: '#fffff5',
hAxis: {title: 'People'},
  vAxis: {title: 'Numbers'}};
var diffData = colChartDiff.computeDiff(oldData, newData);
colChartDiff.draw(diffData, options);
}
 </script>
鲍勃

您可以在diff对象中进行设置,例如,

var options = { ...
    diff: { 
        oldData: { opacity: 1, color: '#e6693e' }, 
        newData: { opacity: 1}
    }...
 }

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章