我通过vis.js编写了时间表。 我使用addCustomTime()附加自定义时间项。
我的情况是。
我想添加固定的自定义时间,但是当我拖动它时会移动。 Anbybody知道如何防止自定义项目移动吗?
// DOM element where the Timeline will be attached
var container = document.getElementById('visualization');
// Create a DataSet (allows two way data-binding)
var items = new vis.DataSet([
{id: 1, content: 'item 1', start: '2013-04-20'},
]);
// Configuration for the Timeline
var options = {};
// Create a Timeline
var timeline = new vis.Timeline(container, items, options);
timeline.addCustomTime('2013-04-21'); // I want this item not moving.

<link href="https://cdnjs.cloudflare.com/ajax/libs/vis/4.19.1/vis.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.19.1/vis-timeline-graph2d.min.js"></script>
<div id="visualization"></div>
&#13;
答案 0 :(得分:2)
答案 1 :(得分:2)
正如@dapriett在GitHub问题中的this comment中所说,@ lv0gun9链接在一起,您可以改为:
team stat explain
7 red 10 inc due to..
6 red 5 inc due to..
8 red -2 dec due to..
0 green 10 inc due to..
1 green -8 dec due to..
2 green 2 inc due to..
5 blue 8 inc due to..
3 blue -6 dec due to..
4 blue 5 inc due to..
这将禁用自定义时间元素上的移动事件。使用@ lv0gun9的CSS解决方案,您还可以禁用工具提示,该提示会在您将元素悬停在元素上时告诉您元素的确切日期。