dc-js / dc.js

Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js
Apache License 2.0
7.42k stars 1.81k forks source link

Zooming for ordinal charts #416

Closed matthull closed 5 years ago

matthull commented 10 years ago

Currently mouse scrolling causes a series of errors on the box plot example if you enable mouse zooming. Looks like this is an issue with ordinal charts in general.

What is the expected behavior for mouse zooming on ordinal charts? Brushing is disabled if chart is ordinal - should zooming be disabled too?

jrideout commented 10 years ago

Brushing is disabled if chart is ordinal - should zooming be disabled too?

I think it probably should be disabled. But then again we also have #348. Maybe we need a "focus" for ordinal charts that allows for arbitrary categorical filtering?

matthull commented 10 years ago

So I could do ordinalChart.focus(["exp-2", "exp-4", "exp-5"]) and it would select just those three items? That could be useful - the one downside I see is that it is inconsistent with focus(rangeFilter) semantics of non-ordinal coordinate grid where focus always takes 2-element array as argument. But ordinal chart is a different kind of beast so probably that's OK...

Something to note - right now filter() getter for ordinal chart has weird behavior (only returns first selection after you click multiple items.) So it seems like both focus() and filter() need to be defined - perhaps filter() should just be an alias for filters() in ordinal chart.

One final thought - if I focus(["exp-2", "exp-4", "exp-5"]), perhaps it zooms in based on min/max of focused set and excludes "exp-1"? Not really useful for typical ordinal with small set of categories, but keeps ordinal chart behavior more consistent with non-ordinal and could be useful if someone wants to do a giant boxplot with associated range selection chart.

gordonwoodhull commented 5 years ago

The new ordinal range/focus example demonstrates zooming on an ordinal chart, by mapping the keys to and from integers and using a linear scale.