我正在尝试找到正确的 css 类来为 vis 时间轴的组标签分配新的背景颜色。这是我的 jsfiddle 示例。 I want to give the Label in front of the coloured area a background colour
var container = document.getElementById('visualization');
var 时间轴 = new vis.Timeline(container);
var options = {
editable: true
};
var groups = new vis.DataSet([
{id: 0, content: 'First', value: 1, className: "default"},
{id: 1, content: 'Third', value: 3, className: "red"},
{id: 2, content: 'Second', value: 2, className: "blue"}
最佳答案
如果您指的是红色元素(“第三”),那么您可以设置组标签颜色,如下所示:
.vis-labelset .vis-label.red {
background-color: red;
}
根据 CSS 结构的其余部分,可能有更好的方法来执行此操作 - 这与您执行 jsfiddle 的方式一致。
关于css - vis 时间线组标签背景颜色取决于 className,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42596401/