How to change color of annotation text in google-charts

后端 未结 5 1110
醉梦人生
醉梦人生 2021-01-17 12:16

How do you change the color of an annotation text in Google Chart Tools LineChart ?

Here is an example

google.load(\'visualization\', \'1\', {package         


        
5条回答
  •  孤城傲影
    2021-01-17 12:43

    Has this been updated using the 'style' option where one could add a new column {"type":"string","role":"style"} and in each row we would have {"v":"point {size: 4; fill-color: #3366cc;}"}? This allows the annotation to have the same color as the point/marker (which could be changed for each point) but does not allow it to be bold. One example of the data to try would be,

    var data =new google.visualization.DataTable(
    {
    "cols":[
    {"label":"Log GDP Per-Capita ","type":"number"},
    {"label":"New Chart",
    "type":"number"},
    {"type":"string","role":"annotation"},
    {"type":"string","role":"style"}
    ],
    "rows":[
    {"c":[{"v":10.21932},{"v":12.3199676},{"v":"ABW"},{"v":"point {size: 4; fill-color: #3366cc;}"}]},
    {"c":[{"v":10.68416},{"v":8.4347518},{"v":"ARE"},{"v":"point {size: 4; fill-color: #3366cc;}"}]},
    {"c":[{"v":9.634226},{"v":12.0774068},{"v":"ATG"},{"v":"point {size: 4; fill-color: #3366cc;}"}]},
    {"c":[{"v":10.83869},{"v":1.8545959},{"v":"AUS"},{"v":"point {size: 4; fill-color: #3366cc;}"}]},
    {"c":[{"v":10.7687},{"v":7.4919999},{"v":"AUT"},{"v":"point {size: 4; fill-color: #3366cc;}"}]}
    ]
    }
    );
    

提交回复
热议问题