Updated sheetsee-tables
to allow you to re-use a template (rather than duplicating it for each different table you wanted to create). Previously it assumed your HTML table div
id matched your script template id
. This means that you can pass in an extra key/value pair in your table options into Sheetsee.maketable()
. The new pair it takes is: "templateID" : "yourtemplateid"
. Example below, full sheetsee-tables
documentation here.
var tableOptions = {
"data": gData,
"pagination": 10,
"tableDiv": "#fullTable",
"filterDiv": "#fullTableFilter",
"templateID": "tableTemplte"
}
Sheetsee.makeTable(tableOptions)
Google recently updated their Google Spreadsheets and the API. For a bit this was breaking things using the old API, including Tabletop. This has been fixed and the latest version of tabletop.js works on both old and new spreadsheets. Be sure to include at least version 1.3.4 in your project.
D3 charts need an array of objects, and something to chart: the thing itself (aka labels) and the corresponding value (aka units). Your data usually contains more than D3 needs to make the chart, so you have to tell it what to chart from your data to chart.
Previously Sheetsee required you pass your data through a function, addUnitsAndLabels()
which took in your data and the things you wanted to chart, reformatted your data for you so that you could pass it into one of the d3 charts. This is one more step than actually needs to happen.
Now Sheetsee just asks for what you want your labels and units to be in the options you give it when calling the chart function. It then sorts the data correctly on the inside of the chart function. Yay, easier!
var options = {
labels: "name",
units: "cuddleability",
m: [60, 60, 30, 150],
w: 600, h: 400,
div: "#barChart",
xaxis: "no. of pennies",
hiColor: "#FF317D"
}
Thanks @maxogden for the help with this.