Dan wrote:
> Hello SIMILE enthusiasts-
> I've got some data that stores time values as epoch seconds, and I'd
> like to load this data into Exhibit. I've done a bit of poking around
> the code, and it looks like the time parsing and storage functions are
> in a few different places.
>
> I'd like to write something that will be ready for inclusion into the
> code base, so am requesting suggestions from this group to get
> started:
>
> How is time stored in Exhibit? In particular, I'm working with the
> Timeplot extension.
>
> Is it as simple as creating two functions to translate between epoch
> seconds and Exhibit's time storage format?
>
> Which files and functions are involved?
>   
This is the file
    
http://api.simile-widgets.org/exhibit/2.2.0/extensions/timeplot/scripts/timeplot-view.js

Look for
    Exhibit.TimeplotView.prototype._reconstruct

[1] For time series, look for
    idx = SimileAjax.DateTime.parseIso8601DateTime(seriesTime[i]).getTime();

[2] For discrete events, look for
    self._getTime(itemID, database, function(v) { time = v; return true; });
_getTime is created in
    Exhibit.TimeplotView._configure
from accessors.getTime, which in turn was created from the second element in
    Exhibit.TimeplotView._accessorSpecs
Note
    type: "date"

Exhibit.TimeplotView._accessorSpecs is passed into the functions in
    http://api.simile-widgets.org/exhibit/2.2.0/scripts/util/settings.js
and type:"date" ultimately causes 
Exhibit.SettingsUtilities._typeToParser to choose 
Exhibit.SettingsUtilities._dateParser, which calls 
SimileAjax.DateTime.parseIso8601DateTime to parse strings into 
Javascript Date objects. If you set

    Exhibit.TimeplotView._accessorSpecs[1].type = "text";

then those string values will be left as-is, and you can do your own 
parsing by overriding Exhibit.TimeplotView._configure

    <script>
        Exhibit.TimeplotView._configure = function(view, configuration) {
            Exhibit.SettingsUtilities.createAccessors(configuration, 
Exhibit.TimeplotView._accessorSpecs, view._accessors);
            Exhibit.SettingsUtilities.collectSettings(configuration, 
Exhibit.TimeplotView._settingSpecs, view._settings);
           
            var accessors = view._accessors;
            view._getTime = function(itemID, database, visitor) {
                accessors.getProxy(itemID, database, function(proxy) {
                    accessors.getTime(proxy, database, function(v) {
                        var v2 = // parse v yourself
                        visitor(v2);
                    });
                });
            };
        };
    </script>

David

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to