如何在注释上设置不同的颜色?

时间:2017-04-04 14:28:41

标签: google-api annotations google-visualization

我想在Google combo图表上为注释添加不同的colorauraColor。任何人都可以说它是否可行以及如何?

这是当前选项;

annotations: {
            stemColor: 'none',
            textStyle: {
                fontName: 'Arial',
                color: 'white',
                auraColor: 'grey',
                fontSize: 11,
                alwaysOutside: true,
            }
        },

我也试过这个,但它不起作用;

annotations: {
             0:{stemColor: 'none',
                textStyle: {
                    fontName: 'Arial',
                    color: 'white',
                    auraColor: 'grey',
                    fontSize: 11,
                    alwaysOutside: true
                }},
             1:{stemColor: 'none',
                textStyle: {
                    fontName: 'Arial',
                    color: 'black',
                    auraColor: 'red',
                    fontSize: 11,
                    alwaysOutside: true,
                 }},
            2:{stemColor: 'none',
                textStyle: {
                    fontName: 'Arial',
                    color: 'blue',
                    auraColor: 'white',
                    fontSize: 11,
                    alwaysOutside: true,
                }}                
        },

提前致谢

1 个答案:

答案 0 :(得分:0)

尝试使用series选项...

series: {
  0:{
    annotations: {
      stemColor: 'none',
      textStyle: {
        fontName: 'Arial',
        color: 'white',
        auraColor: 'grey',
        fontSize: 11,
        alwaysOutside: true
      }
    }
  },
  1:{
    annotations: {
      stemColor: 'none',
      textStyle: {
        fontName: 'Arial',
        color: 'black',
        auraColor: 'red',
        fontSize: 11,
        alwaysOutside: true,
      }
    }
  },
  ...