hxlbites.js is a library to automate the generation of relevant and context aware data structures for charts, maps, tables and text of humanitarian data with HXL hastags.
HXL data -> hxlbites.js -> Data charts, maps plus relevant text
A tool visual for checking what bites are generated by the library link
With example dataset of Ebola Treatment centres
If a chart/map/table is missing that you want then please create an issue for it
Data should be an array of arrays - first line = headers, second line = hxl hashtags, third line onwards = data
var hb = hxbites.data(data)
hxlBitesMap.js needs to be included
hb.getMapBites();
return array of bites with following structure:
{
bite: array [...data for chart...],
geom_attribute: string "...field name in geometry file to join data by...",
geom_url: array [...URLs to download matchin geometry file],
id: string "...chart bite ID...",
priority: number,
subtype: string "...bite subtype - choropleth...",
title: string "...title of bite...",
type: string "...bite type...",
uniqueID: string "...unique ID combining bite and data structure...",
}
hxlBitesChart.js needs to be included
hb.getChartBites();
return array of bites with following structure:
{
bite: array [...data for chart...],
id: string "...chart bite ID...",
priority: number,
subtype: string "...bite subtype - row, pie...",
title: string "...title of bite...",
type: string "...bite type...",
uniqueID: string "...unique ID combining bite and data structure",
}
hxlBitesTable.js needs to be included
hb.getTableBites();
hxlBitesCrossTable.js needs to be included
hb.getCrossTableBites();
hxlBitesText.js needs to be included
hb.getTextBites();
{
bite: string "...generate text string...",
id: string "...chart bite ID...",
priority: number,
subtype: string "...bite subtype - main, headline figure...",
title: undefined,
type: string "...bite type...",
uniqueID: string "...unique ID combining bite and data structure",
}
This enables storing of just the ID and return the bite at a later date.
hb.reverse(uniqueID)
Return single bite related to unique ID. Data does not have to be the same and makes best attempt to recreate bite with new numbers.