Class TimeMapDataset
- Defined in:
- timemap.js
The TimeMapDataset object holds an array of items and dataset-level options and settings, including visual themes.
Constructor
TimeMapDataset(timemap, options)
Static Methods
Method | |
---|---|
TimeMapDataset.gregorianParser(s)
Better Timeline Gregorian parser.
|
|
TimeMapDataset.hybridParser(s)
Parse date strings with a series of date parser functions, until one works.
|
Fields
Field | |
---|---|
eventSource
:{Timeline.EventSource}
EventSource for timeline events
|
|
items
:{Array}
Array of child TimeMapItems
|
|
opts
:{Object}
Container for optional settings passed in the "options" parameter
|
|
Reference to parent TimeMap
|
|
visible
:{Boolean}
Whether the dataset is visible
|
Methods
Method | |
---|---|
addExportData(data)
Specify additional data for export.
|
|
changeTheme(theme)
Change the theme for every item in a dataset
|
|
clear()
Delete all items, clearing them from map and timeline
|
|
deleteItem(item)
Delete one item, clearing it from map and timeline
|
|
each(f)
Run a function on each item in the dataset.
|
|
getItems(index)
Return an array of this dataset's items
|
|
getTitle()
Return the title of the dataset
|
|
hide()
Hide dataset
|
|
loadItem(data, options, transform)
Add one item to map and timeline.
|
|
loadItems(data, transform)
Add an array of items to the map and timeline.
|
|
show()
Show dataset
|
|
toJSON()
Clean up dataset into a nice object for serialization
This is called automatically by the JSON.stringify() function.
|
Class Detail
TimeMapDataset(timemap, options)
Parameters (optional) | ||
---|---|---|
timemap | {TimeMap} | Reference to the timemap object |
options | {Object} | Object holding optional arguments |
options.id | {String} | Key for this dataset in the datasets map |
options.title | {String} | Title of the dataset (for the legend) |
options.theme | {String|TimeMapTheme} | Theme settings. |
options.dateParser | {String|Function} | Function to replace default date parser. |
options.infoTemplate | {String} | HTML template for info window content |
options.templatePattern | {String} | Regex pattern defining variable syntax in the infoTemplate |
options.openInfoWindow | {Function} | Function redefining how info window opens |
options.closeInfoWindow | {Function} | Function redefining how info window closes |
options[...] | {mixed} | Any of the options for TimeMapTheme may be set here, to cascade to the dataset's objects, though they can be overridden at the TimeMapItem level |
Static Method Details
TimeMapDataset.gregorianParser(s)
:{Date}
Better Timeline Gregorian parser... shouldn't be necessary :(.
Gregorian dates are years with "BC" or "AD"
Parameters (optional) | ||
---|---|---|
s | {String} | String to parse into a Date object |
- Returns:
- {Date} Parsed date or null
TimeMapDataset.hybridParser(s)
:{Date}
Parse date strings with a series of date parser functions, until one works.
In order:
- Date.parse() (so Date.js should work here, if it works with Timeline...)
- Gregorian parser
- The Timeline ISO 8601 parser
Parameters (optional) | ||
---|---|---|
s | {String} | String to parse into a Date object |
- Returns:
- {Date} Parsed date or null
Field Details
eventSource
:{Timeline.EventSource}
EventSource for timeline events
items
:{Array}
Array of child TimeMapItems
opts
:{Object}
Container for optional settings passed in the "options" parameter
timemap
:{TimeMap}
Reference to parent TimeMap
visible
:{Boolean}
Whether the dataset is visible
Method Details
addExportData(data)
:{Object}
Specify additional data for export. Replace this function to change settings.
Parameters (optional) | ||
---|---|---|
data | {Object} | Initial map of export data |
- Returns:
- {Object} Expanded map of export data
- Defined in:
- export.js
changeTheme(theme)
Change the theme for every item in a dataset
Parameters (optional) | ||
---|---|---|
theme | {TimeMapTheme} | New theme settings |
- Defined in:
- manipulation.js
clear()
Delete all items, clearing them from map and timeline
- Defined in:
- manipulation.js
deleteItem(item)
Delete one item, clearing it from map and timeline
Parameters (optional) | ||
---|---|---|
item | {TimeMapItem} | Item to delete |
- Defined in:
- manipulation.js
each(f)
Run a function on each item in the dataset. This is the preferred
iteration method, as it allows for future iterator options.
Parameters (optional) | ||
---|---|---|
f | {Function} | The function to run |
Return an array of this dataset's items
Parameters (optional) | ||
---|---|---|
index | {Number} | Index of single item to return |
- Returns:
- {TimeMapItem[]} Single item, or array of all items if no index was supplied
getTitle()
:{String}
Return the title of the dataset
- Returns:
- {String} Dataset title
hide()
Hide dataset
- Defined in:
- manipulation.js
Add one item to map and timeline.
Each item has both a timeline event and a map placemark.
Parameters (optional) | ||
---|---|---|
data | {Object} | Data to be loaded |
data.title | {String} | Title of the item (visible on timeline) |
data.start | {String|Date} | Start time of the event on the timeline |
data.end | {String|Date} | End time of the event on the timeline (duration events only) |
data.point | {Object} | Data for a single-point placemark: |
data.point.lat | {Float} | Latitude of map marker |
data.point.lon | {Float} | Longitude of map marker |
data.polyline | {Object[]} | Data for a polyline placemark, as an array in "point" format |
data.polygon | {Object[]} | Data for a polygon placemark, as an array "point" format |
data.overlay | {Object} | Data for a ground overlay: |
data.overlay.image | {String} | URL of image to overlay |
data.overlay.north | {Float} | Northern latitude of the overlay |
data.overlay.south | {Float} | Southern latitude of the overlay |
data.overlay.east | {Float} | Eastern longitude of the overlay |
data.overlay.west | {Float} | Western longitude of the overlay |
data.placemarks | {Object[]} | Array of placemarks, e.g. [{point:{...}}, {polyline:[...]}] |
options | {Object} | Optional arguments - see the TimeMapItem constructor for details |
transform | {Function} | If data is not in the above format, transformation function to make it so |
- Returns:
- {TimeMapItem} The created item (for convenience, as it's already been added)
- See:
- TimeMapItem
loadItems(data, transform)
Add an array of items to the map and timeline.
Each item has both a timeline event and a map placemark.
Parameters (optional) | ||
---|---|---|
data | {Object} | Data to be loaded. See loadItem() for the format. |
transform | {Function} | If data is not in the above format, transformation function to make it so |
show()
Show dataset
- Defined in:
- manipulation.js
toJSON()
Clean up dataset into a nice object for serialization
This is called automatically by the JSON.stringify() function.
Note that, at the moment, this function only supports fully-serialized datasets - so external data imported with JSON or KML will be serialized in full and no longer connected to their original file.
- Defined in:
- export.js
©2010 Nick Rabinowitz
Documentation generated by JsDoc Toolkit 2.3.2 on Thu Jun 24 2010 13:58:03 GMT-0700 (PDT)
Documentation generated by JsDoc Toolkit 2.3.2 on Thu Jun 24 2010 13:58:03 GMT-0700 (PDT)