在明喻时间线中添加叠加

发布于 2024-12-15 13:25:12 字数 512 浏览 0 评论 0原文

我有一个问题,我想在时间线的两侧添加两个叠加层。 我们的想法是让它看起来像这样的模型: <一href="https://lh4.googleusercontent.com/-EUgq5L-gFgc/TsEgpPpyJ1I/AAAAAAAACEA/vbByi9CTIhk/s592/Capture%252520du%2525202011-11-14%25252014%25253A55%25253A14-m.png" rel="nofollow">https://lh4.googleusercontent.com/-EUgq5L-gFgc/TsEgpPpyJ1I/AAAAAAAACEA/ vbByi9CTIhk/s592/Capture%252520du%2525202011-11-14%25252014%25253A55%25253A14-m.png

但更重要的是,它将在时间轴中包含多个轨道(应用程序中代表每个人一个),并且我需要在每个轨道的两侧添加数据。我可以以任何我想要的方便形式获得数据,但我就是找不到如何实现它。 如果有人可以提供帮助,那将对我有很大帮助。 谢谢 !

I've got a problem I would like to add two overlays on both side of a timeline.
The idea is to make it look like this mock-up :
https://lh4.googleusercontent.com/-EUgq5L-gFgc/TsEgpPpyJ1I/AAAAAAAACEA/vbByi9CTIhk/s592/Capture%252520du%2525202011-11-14%25252014%25253A55%25253A14-m.png

But the more important is that it will have several tracks in the timeline (one per person represented in the app) and I need to add data on both side of each track. I can have the data in any convenient form I want, but I just can't find how to implement it.
If someone can help it will help me a lot.
Thanks !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若沐 2024-12-22 13:25:12

我回答我自己的问题,如果其他人有同样的问题,这里是代码:

var timeline;
function onLoad() {
if (typeof(timelineJsonObject)=='undefined' || timelineJsonObject===null) 
{
    return;
}

var overviewEvents = new Timeline.DefaultEventSource();
var events = new Array(timelineJsonObject.length);

var theme = Timeline.ClassicTheme.create();
    theme.event.tape.height = 24;

var overviewTheme = Timeline.ClassicTheme.create();
    overviewTheme.event.tape.height = 8;

var bandInfos = new Array(timelineJsonObject.length+1);
bandInfos[0] = Timeline.createBandInfo
    ({
        theme:          overviewTheme,
        layout:         'overview',
        eventSource:    overviewEvents,
        width:          "96px",
        intervalUnit:   Timeline.DateTime.MONTH, 
        intervalPixels: 32
    });

$($("td",  $($("#timelineTable tbody tr")[0]))[1]).attr("rowspan", timelineJsonObject.length+1);

$("#timeline").height((timelineJsonObject.length+1) * 96);

var cssClassMod = new Array(2);
cssClassMod[0] = "even";
cssClassMod[1] = "odd";

tableBody = $("#timelineTable tbody");

for (i = 0; i < timelineJsonObject.length; i++)
{
    events[i] = new Timeline.DefaultEventSource();

    bandInfos[i+1] = Timeline.createBandInfo
        ({
            theme:          theme,
            layout:         'original',
            eventSource:    events[i],
            width:          "96px",
            intervalUnit:   Timeline.DateTime.MONTH, 
            intervalPixels: 128
        });
    bandInfos[i+1].syncWith = i;
    bandInfos[i+1].highlight = true;

    events[i].loadJSON(timelineJsonObject[i][2], document.location.href);
    overviewEvents.loadJSON(timelineJsonObject[i][2], document.location.href);

    tableBody.append('<tr><td>' + timelineJsonObject[i][0] + '</td><td>' + timelineJsonObject[i][1] + '</td></tr>');
    $("tr", tablebody).last().addClass(cssClassMod[i%2]);
}

timeline = Timeline.create(document.getElementById("timeline"), bandInfos);

timeline.finishedEventLoading();
}

I respond to my own question and here is the code if someone else have the same issue :

var timeline;
function onLoad() {
if (typeof(timelineJsonObject)=='undefined' || timelineJsonObject===null) 
{
    return;
}

var overviewEvents = new Timeline.DefaultEventSource();
var events = new Array(timelineJsonObject.length);

var theme = Timeline.ClassicTheme.create();
    theme.event.tape.height = 24;

var overviewTheme = Timeline.ClassicTheme.create();
    overviewTheme.event.tape.height = 8;

var bandInfos = new Array(timelineJsonObject.length+1);
bandInfos[0] = Timeline.createBandInfo
    ({
        theme:          overviewTheme,
        layout:         'overview',
        eventSource:    overviewEvents,
        width:          "96px",
        intervalUnit:   Timeline.DateTime.MONTH, 
        intervalPixels: 32
    });

$($("td",  $($("#timelineTable tbody tr")[0]))[1]).attr("rowspan", timelineJsonObject.length+1);

$("#timeline").height((timelineJsonObject.length+1) * 96);

var cssClassMod = new Array(2);
cssClassMod[0] = "even";
cssClassMod[1] = "odd";

tableBody = $("#timelineTable tbody");

for (i = 0; i < timelineJsonObject.length; i++)
{
    events[i] = new Timeline.DefaultEventSource();

    bandInfos[i+1] = Timeline.createBandInfo
        ({
            theme:          theme,
            layout:         'original',
            eventSource:    events[i],
            width:          "96px",
            intervalUnit:   Timeline.DateTime.MONTH, 
            intervalPixels: 128
        });
    bandInfos[i+1].syncWith = i;
    bandInfos[i+1].highlight = true;

    events[i].loadJSON(timelineJsonObject[i][2], document.location.href);
    overviewEvents.loadJSON(timelineJsonObject[i][2], document.location.href);

    tableBody.append('<tr><td>' + timelineJsonObject[i][0] + '</td><td>' + timelineJsonObject[i][1] + '</td></tr>');
    $("tr", tablebody).last().addClass(cssClassMod[i%2]);
}

timeline = Timeline.create(document.getElementById("timeline"), bandInfos);

timeline.finishedEventLoading();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文