vis-timeline
vis-timeline copied to clipboard
Bug applying options to a timeline when more than one is instantiated
It seems that internally it establishes the same options for both regardless of the options passed on to the other instances.
It also happens with the methods: timeline1.setOptions({}); (I imagine that internally it will do the same).
In the example you can see that even though only the first one has the format of the labels, the result appears in the two timelines.
<!DOCTYPE HTML>
<html>
<head>
<title>Timeline | Basic demo</title>
<script type="text/javascript"
src="https://unpkg.com/vis-timeline@latest/standalone/umd/vis-timeline-graph2d.min.js"></script>
<link href="https://unpkg.com/vis-timeline@latest/styles/vis-timeline-graph2d.min.css" rel="stylesheet"
type="text/css" />
</head>
<body>
<div id="timeline1"></div>
<div id="timeline2"></div>
<script type="text/javascript">
var container = document.getElementById('visualization');
var items = new vis.DataSet();
var options1 = {
format: {
minorLabels: function (date, scale, step) {
return "abc";
},
}
};
var options2 = {};
var timeline1 = new vis.Timeline(document.getElementById('timeline1'), items, options1);
var timeline2 = new vis.Timeline(document.getElementById('timeline2'), items, options2);
</script>
</body>
</html>
Maybe related:
https://github.com/almende/vis/issues/109