Stacked charts

49 views
Skip to first unread message

cwal...@gmail.com

unread,
Mar 8, 2015, 5:03:05 PM3/8/15
to dc-js-us...@googlegroups.com
I've scoured the net after getting stuck trying to bend this (http://www.codeproject.com/Articles/709735/Making-Dashboards-with-Dc-js-Part-4-Style
to my own will on a sizable chunk of data (~1M records) that I've parked in mongo and having seen something interesting mucking around in pandas, was trying to replicate and make more enduringly useful using dc.js.

I've attached some screen shots and my code and it's taken me quite some time to get even here.
While my questions are many, I'm hoping that getting past these few might help make everything else fall into place...

I'm guessing these two might be related, but:
1. Why are the nulls (first column, missing name) not collapsing into year stacks?
2. Why are the data stacks disembodied from the abscissa?

While the stack shot I attached are counts, I've found this:
var sum_2005 = icDim.group().reduceSum(function(d) {if (d.FY=="2005") return d.TOTAL_COST; else return 0; });

which leads to the stacks being shove to the ceiling, if not disappearing altogether (stack_sum).

Ideally, what I was going for was trying to not only do massive sums/counts of aggregated data, but in addition,
be able to do grouped counts/sums based on missing data-- what groups over time have the same missing fields,
aggregated by an indirect sum (total cost).

I'm very keen to understand what's going on here b/c I think it might resolve a few of my more fundamental don't-quite-get-it-yets

Is it possible to stack up a row chart as the stack charts attached are just a selection of a much longer list (row.tiff)?

I've a slew of other questions (like why are some pie labels missing?), but am guessing if I can get my head around these other issues the rest
will fall into place...

Many thanks in advance,
tripp







stack.tiff
pie.tiff
row.tiff
reporter_all_nulls.html
stack_sum.tiff

cwal...@gmail.com

unread,
Mar 9, 2015, 9:08:43 AM3/9/15
to dc-js-us...@googlegroups.com
Neglected to include query/data structure:

query::
@frontend.route('/reporterall/nulls')
@login_required
def reporter_all_nulls():
    conn = pymongo.MongoClient('mongodb://localhost:27017/')
    conn.orgs9.reporter.ensure_index([('FY',1), ('ADMINISTERING_IC',1), ('TOTAL_COST',1)])
    db = conn.orgs9.reporter.find({'_id':0, 'TOTAL_COST':1, 'ADMINISTERING_IC':1, 'FY':1}).sort([("FY", pymongo.DESCENDING)])
    return json.dumps(list(db), sort_keys=False, indent=4, default=json_util.default)

Please do let me know if I've still left something crucial out of my post.

Kind regards,
chris

cwal...@gmail.com

unread,
Mar 9, 2015, 12:35:17 PM3/9/15
to dc-js-us...@googlegroups.com
Update...  I removed the log on the y axis as well as its explicit domain range and voila!
Also, what I thought were null names, turned out to be other data in the set not included in the x domain subset, getting all stacked at the end.  This was me trying to turn the row chart into stacked chart, but then
having to back out again when I could only seem to make any headway with a bar.

I've read further that in crossfilter NaNs, nulls aren't supported so my task of trying to track missing data
over time might not even work here?:
"In particular, note that incomparable values such as NaN and undefined are not supported. In addition, care should be taken when mixing types, e.g., strings and numbers. If strings and numbers are mixed, the strings will be coerced to numbers, and hence the strings must all be coercible to number, otherwise unsupported NaN values will result."

Despite 'progress', any shoves towards an actual understanding would be appreciated...
stack_bing.tiff
reporter_all_nulls.html
Reply all
Reply to author
Forward
0 new messages