Vis Js时间轴绘制项目工具提示,直到结束日期

时间:2019-07-12 10:27:58

标签: javascript

这是我的时间轴配置

 function InitChartVis() {

            $.ajax({
                url: '/Abastecimento/GetCurrentDayTimeline',
                method: 'GET',
                beforeSend: function () {
                    $('#loader').show();
                },
                success: function (response) {

                    var timelineDataset = [];

                    $.each(response, function (index, value) {

                        var timelineObject = {};

                        timelineObject.id = value.id;
                        timelineObject.content = `<i class="fas fa-truck"></i><b> Abastecimento Nº ${value.id} - ${value.uap}</b>`;
                        timelineObject.start = value.dataCriacao;
                        timelineObject.end = new Date(Date.parse(value.dataFim));
                        timelineDataset.push(timelineObject);

                    });

                    // 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(timelineDataset);

                    // Configuration for the Timeline
                    var options = {
                        min: new Date().getDate(),
                        zoomMax: 1000 * 60 * 60 * 24, // about 3 months in milliseconds
                        zoomMin: 1000 * 60 * 60 * 24,
                        height: '60vh',
                        margin: {
                            axis: 35
                        }
                    }

                    // Create a Timeline
                    timeline = new vis.Timeline(container, items, options);
                },
                complete: function () {
                    $('#loader').hide();
                },
                error: function (response) {
                    console.log(response);
                },
            });
   }

我想要的是项目工具提示一直用红线绘制,直到它具有结束日期为止,这样就可以看到该项目处于活动状态。有这样的功能吗?

0 个答案:

没有答案