Closed feomike closed 8 years ago
We need to add a type:
to the json to tell C3/D3 what type of chart to render.
{
"title": "Bank HMDA filings",
"bank": "Bank Name",
"description": "Bank data",
"layout": "bank-data",
"categories": "chart",
"type": "line" // add this
...
}
here is example one. i think i have this scripted ok;
{ "layout": "bank-data", "description": "Bank Data", "title": "Bank HMDA filings", "type": "line", "bank": "Golden One Credit Union", "data": { "years": [{ "count": 77, "loan_amount": 8651, "year": "1990" }, { "count": 1974, "loan_amount": 157401, "year": "1991" }, { "count": 2299, "loan_amount": 186109, "year": "1992" }, { "count": 2053, "loan_amount": 135870, "year": "1993" }, { "count": 2343, "loan_amount": 124430, "year": "1994" }, { "count": 2331, "loan_amount": 103579, "year": "1995" }, { "count": 3125, "loan_amount": 167923, "year": "1996" }, { "count": 3665, "loan_amount": 205260, "year": "1997" }, { "count": 2947, "loan_amount": 91010, "year": "1998" }, { "count": 1472, "loan_amount": 195661, "year": "1999" }, { "count": 1321, "loan_amount": 202071, "year": "2000" }, { "count": 3587, "loan_amount": 588491, "year": "2001" }, { "count": 15201, "loan_amount": 1356084, "year": "2002" }, { "count": 18774, "loan_amount": 1461294, "year": "2003" }, { "count": 12678, "loan_amount": 0, "year": "2004" }, { "count": 12824, "loan_amount": 0, "year": "2005" }, { "count": 12565, "loan_amount": 0, "year": "2006" }, { "count": 10397, "loan_amount": 0, "year": "2007" }, { "count": 7073, "loan_amount": 0, "year": "2008" }, { "count": 4704, "loan_amount": 851994, "year": "2013" }, { "count": 3823, "loan_amount": 658896, "year": "2014" }] }, "categories": "chart" }
am closing this, b/c example #1 is done. seems to work ok. might have to revisit, but for now this is good.
For the json format, below is the format that I have prototyped in the UI. We can likely change this as I learn more, but the library does use arrays (you'll see the
"years"
is an array and that the"year"
is a property). The meta-data we can change to whatever we need, for now there are a few placeholders. For example we may not need"layout"
since we're taking Jekyll out of the picture and probably"categories"
too, assuming for the time being these are all line charts. Plus, through the UI, there will be other ways to define the chart type.