Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with timeline #188

Open
jaygray0919 opened this issue Oct 12, 2017 · 0 comments
Open

Problem with timeline #188

jaygray0919 opened this issue Oct 12, 2017 · 0 comments

Comments

@jaygray0919
Copy link

We want to use Exhibit 3 timeline extension for biological sequences rather than time.

We propose to use CENTURY and DECADE level displays but treat the year as a position along a sequences (generally starting from 0 up to 500 and in some cases low thousands).

Here is an example:
https://afdsi.org/test/exhibit/protein_3/index.html

As you see, we failed to replaced the CENTURY and DECADE level displays with the biological sequence.

David Huynh developed an example illustrating how to do so using:
http://static.simile.mit.edu/exhibit/api-2.0/exhibit-api.js
and
http://static.simile.mit.edu/exhibit/extensions-2.0/time/time-extension.js

The example is here:
http://people.csail.mit.edu/dfhuynh/misc/debug/ksd/protein_noBC.html
and here:
https://afdsi.org/test/exhibit/protein_2_0/index_2_0_.html

However, the example fails because the 2.0 libraries are not online.

Here is a screen shot of what the DavidH example produced, and what we want to reproduce:
https://afdsi.org/test/exhibit/protein_1/images.html

we attempted to use:
http://api.simile-widgets.org/exhibit/2.2.0/exhibit-api.js
and
http://api.simile-widgets.org/exhibit/2.2.0/extensions/time/scripts/timeline-view.js
but that attempted failed as seen here:
https://afdsi.org/test/exhibit/protein_2_2_0/index_2_2_0_.html

here is the DavidH code:

<script type='text/javascript'>
var oldLabelInterval = Timeline.GregorianDateLabeller.prototype.labelInterval;
    Timeline.GregorianDateLabeller.prototype.labelInterval = function(date, intervalUnit) {
        if (date.getUTCFullYear() < 1) {
            return { text: "", emphasized: false };
        }
        else if (date.getUTCFullYear() > 1640) {
            return { text: "", emphasized: false };
        }
        else {
            return oldLabelInterval.call(this, date, intervalUnit);
        }
    };
// override http://static.simile.mit.edu/exhibit/extensions-2.0/time/scripts/timeline-view.js
    Exhibit.TimelineView.prototype._fillInfoBubble = function(evt, elmt, theme, labeller) {
        var doc = elmt.ownerDocument;
        var title = evt.getProperty('name');
        var divTitle = doc.createElement("div");
        var textTitle = doc.createTextNode(title);
            divTitle.appendChild(textTitle);
            theme.event.bubble.titleStyler(divTitle);
            elmt.appendChild(divTitle);
        var desc = evt.getProperty('description');
        var divDesc = doc.createElement("div");
        var textDesc = doc.createTextNode(desc);
            divDesc.appendChild(textDesc);
            theme.event.bubble.bodyStyler(divDesc);
            elmt.appendChild(divDesc);
    };
</script> 

the second part of the code is successful:
Exhibit.TimelineView.prototype._fillInfoBubble = function(evt, elmt, theme, labeller)
as seen here:
https://afdsi.org/test/exhibit/protein_2/index.html

however the date substitution fails:
var oldLabelInterval = Timeline.GregorianDateLabeller.prototype.labelInterval

we are willing to write new JavaScript for Exhibit 3 that does the date-to-sequence conversion, but need to see the Exhibit 2.0 libraries to go from 2.0 to 3.0.

Alternatively, can you show us how to do it?

Thanks for advice, guidance and solutions

/jay gray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant