Hello,
As ever, thanks for a great set of tools and helpful list.
I’m (again) having difficulty manipulating dates in Exhibit. I followed the code at http://groups.google.com/group/simile-widgets/browse_thread/thread/78063be86c4d2ca4 and got a facet (I hope that’s the correct term) working that displays months of the year, so I thought I’d be clever and do the same for years… of course I don’t really know what I’m doing so it didn’t work!
To extract the year from a date I used:
var yearNames
= [ "2007", "2008", "2009", "2010", "2011"
];
Exhibit.Functions["year"] = {
f: function(args) {
var set = new Exhibit.Set();
args[0].forEachValue(function(v) {
var d = SimileAjax.DateTime.parseIso8601DateTime(v);
var y = d.getFullYear();
set.add(yearNames[y]);
});
return new Exhibit.Expression._Collection(set, "number");
}
};
and then had the following:
<div ex:role="facet"
ex:expression="year(.startdate)"
ex:fixedOrder="2007;2008;2009;2010;2011"
ex:facetLabel="Year"></div>
But to no avail… all I’m getting is “undefined” for all the items in my Exhibit.
I’m wondering if this is totally the wrong way to go about it as maybe I would need to have an infinite list of years for this to work?
Thanks for any assistance,
Anthony
C. Anthony Lewis
Petroleum & Environmental Geochemistry Group,
School of Earth, Ocean and Environmental Sciences,
University of Plymouth,
Plymouth, Devon PL4 8AA, U.K.
tel: +44 (0)1752 584554
email: cal...@plymouth.ac.uk
http://www.plymouth.ac.uk/chemistry
ecause you are subscribed to the Google Groups "SIMILE Widgets" group.
To post to this group, send email to simile-...@googlegroups.com
To unsubscribe from this group, send email to simile-widget...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---
ml>
David,
Many thanks for the speedy response.
If I understand correctly, you’re suggesting that a “year” property can be added on the fly from the original property as the data loads. I fear this is a little beyond my current skills so I’m wondering if you can suggest an existing Exhibit that I can look at.
Does this mean that it’s not possible to do it the way I was attempting?
All the best and thanks for any further assistance,
Anthony