简体   繁体   English

Google图表时间表

[英]Google charts Timeline

I have a timeline chart with 5 rows, and I have defined the color for each row: 我有一个包含5行的时间表图表,并且为每行定义了颜色:

var options = {         
        colors: ['#FFF000', '#0094FF', '#FF6A00', '#26BA00', '#FF0000'],         
        timeline: {            
            colorByRowLabel: true
        }
};

I would like to know if it is possible to have bars of different colors in the same row. 我想知道是否可以在同一行中放置不同颜色的条。 I want to combine row 1 and row 2 in one single row. 我想将第1行和第2行合并为一行。

在此处输入图片说明

There's a groupByRowLabel option which could match your needs, take a look at it in the doc . 有一个groupByRowLabel选项可以满足您的需求,请在doc中进行查看。

More specifically, it says : 更具体地说,它说:

When there are four columns in a timeline dataTable, the first is interpreted as the row label, the second as the bar label, and the third and fourth as start and end. 当时间轴dataTable中有四列时,第一列解释为行标签,第二列解释为条形标签,第三和第四列解释为开始和结束。

So if you set the bars you want to have different colors with the same row name, and groupByRowLabel option, they'll appear on the same line with different colors. 因此,如果您要设置具有相同行名和groupByRowLabel选项的不同颜色的条,它们将以不同颜色显示在同一行上。

However, it seems logically incompatible with your colorByRowLabel option. 但是,从逻辑上看,它与colorByRowLabel选项不兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM