dc.js - Dimensional Charting with Non-Exclusive Attributes -
the following schematic, simplified, table, showing http transactions. i'd build dc analysis using dc
, of columns don't map crossfilter
.
in settings of question, http transactions have fields time
, host
, requestheaders
, responseheaders
, , numbytes
. however, different transactions have different specific http request , response headers. in table above, 0 , 1 represent absence , presence, respectively, of specific header in specific transaction. sub-columns of requestheaders
, responseheaders
represent unions of headers present in transactions. different http transaction datasets surely generate different sub-columns.
for question, row in chart represented in code this:
{ "time": 0, "host": "a.com", "requestheaders": {"foo": 0, "bar": 1, "baz": 1}, "responseheaders": {"shmip": 0, "shmap": 1, "shmoop": 0}, "numbytes": 12 }
the time
, host
, , numbytes
translate crossfilter
, , it's possible build charts answering things total number of bytes seen transactions between 2 , 4 host a.com
. e.g.,
var ndx = crossfilter(data); ... var hostdim = ndx.dimension(function(d) { return d.host; }); var hostbytes = hostdim.group().reducesum(function(d) { return d.numbytes; });
the problem that, slices of time
, host
, i'd show (capped) bar charts of (leading) request , response headers bytes. e.g. (see first row), time 0 , host a.com
, request headers bar chart should show bar
, baz
each have 12.
there 2 problems, minor 1 , major one.
minor problem
this doesn't fit quite naturally dc
, it's one-directional. these bar charts should updated other slices, can't used slicing themselves. e.g., shouldn't able select bar
, deselect baz
, , resulting breakdown of hosts bytes, because mean: hosts in transactions have bar
don't have baz
? hosts in the transactions have bar
, either or don't have baz
? it's unintuitive.
how can make dc
charts 1 directional. through hack of disabling mouse inputs?
major problem
as opposed host
, foo
, bar
non-exclusive. each transaction's host either or other, transaction's headers might include combination of foo
, bar
.
how can define crossfilter dimensions requestheaders
, then, , how can use dc
? is
var ndx = crossfilter(data); ... var requestheadersdim = ndx.dimension(function(d) { // should go here? });
the way deal major problem state transform data there separate record each header (all other fields in these duplicate records same). use custom group aggregations avoid double-counting. these custom aggregations bit hard manage built reductio using 'exception' function - github.com/esjewett/reductio
Comments
Post a Comment