Граф коммитов

25 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock c29d4dc1a7 Better box chart transitions.
Preserving object constancy across transitions is tricky! For example, what
happens if we remove the whiskers in a transition? How do we join outliers? This
commit makes a few assumptions explicit:

1. The `quartiles` function must return exactly three elements. This property
must be specified as a function.

2. The `whiskers` function must return exactly 2 elements, or null if no
whiskers are to be displayed. This property must be specified as a function.

3. The `domain` function must return exactly 2 elements, or null if the default
domain should be used. This property can be specified either as a constant or as
a function.

We could generalize this chart to support more than two whiskers, but it doesn't
seem urgent, and it would complicate the transition if the number of whiskers
changes. In a related change, the `whiskers` function does not receive a third
argument containing the quartiles; instead, this is made available by the
`quartiles` property on the values array (the first argument).

The outliers are joined using the `Number` key function. The outlier data is now
stored as indices; this allows reasonable object constancy across transitions
with outliers. Similarly, the tick labels for the quartiles are whiskers are now
separated, such that the whisker labels can be added or removed without spurious
transition.
2011-04-13 17:44:20 -07:00
Mike Bostock d9d85f0e03 No initial transition. 2011-04-09 13:00:38 -07:00
Mike Bostock 40be541c4c Restructure bullet chart example. 2011-04-09 12:38:48 -07:00
Jason Davies ef7b5ccb3c Push bullet chart state into ticks element data.
This means chart state (the original x-scale) is no longer bound to the
chart instance, so a single instance can be reused on multiple elements.
2011-04-09 16:41:26 +01:00
Michael Bostock e8b345d0f8 Make randomizer a bit more exciting. 2011-04-08 16:42:43 -07:00
Michael Bostock 448b72622c Rename var. 2011-04-08 16:36:16 -07:00
Michael Bostock 17259b94ff Add another bullet example.
This example shows how to preserve scales across multiples using a single chart
instance, as opposed to bullet-multiples which uses distinct chart instances to
supply separate scales. I still think it'd be better to use a single chart
instance in both cases, but then I need a different place to hide the scale
state.
2011-04-08 16:03:01 -07:00
Michael Bostock 4fda3a3ebf Use separate charts for bullet-multiples.
This way, we get separate scales for the small multiples, which makes sense
given our data. However, I'm not totally convinced this is the right way to
implement separate scales, because it's a bit awkward to create separate chart
instances that look identical. Also, it's unfortunate that the charts are
stateful; it'd be better to somehow store the scale as data on the nodes, so
that chart specifications could be more easily reused. Then, there might be a
method to fix the domain rather than computing the domain per-chart.
2011-04-08 15:46:14 -07:00
Michael Bostock 33260423a3 Extract title & subtitle from bullet chart.
It's nice, but I think it's a bit more flexible to not have it as part of the
chart specification. This way, people can define titles however they like. It
might be nice to take a similar approach with reference ticks in the future.
2011-04-08 14:40:29 -07:00
Jason Davies 598f47e1c9 Simplify bullet charts as per Mike's suggestions. 2011-04-08 18:37:59 +01:00
Jason Davies 0f82a4d047 Simplify bullet multiples example.
Thanks Mike!
2011-04-08 18:25:08 +01:00
Jason Davies 21c7ec3c26 Bullet charts: title and subtitle support. 2011-04-08 11:24:51 +01:00
Jason Davies 202205fa5e Add some missing semicolons. 2011-04-08 10:56:41 +01:00
Jason Davies 6aba18bc61 Bullet charts: support for "right" orientation. 2011-04-08 10:54:12 +01:00
Michael Bostock 1b1a9485cb Bullet chart transitions.
We now preserve object constancy for ticks across transitions. By caching a
reference to the previous x-scale, we can initialize entering objects in the
correct location, then transition them to the new scale as they fade in. Also,
we use the `map` operator to convert the data to a standard representation that
is suitable for the bullet chart, and compute derivate data needed across
multiples.
2011-04-07 16:57:33 -07:00
Jason Davies 34ffbbf1d0 Define bullet chart duration as property. 2011-04-07 22:36:25 +01:00
Jason Davies 34a055adc4 Add optional duration for bullet chart transitions. 2011-04-07 22:29:04 +01:00
Jason Davies 28c54a822f Bullet charts: support dynamic data. 2011-04-07 19:32:48 +01:00
Jason Davies 0e54ee835d Remove extraneous CSS styles from bullet example. 2011-04-07 19:05:15 +01:00
Jason Davies 73de44469b Add example and fixes for bullet multiples. 2011-04-07 18:54:31 +01:00
Jason Davies 344d7da26d Use bound data for bullet chart.
As per Mike's suggestion.
2011-04-07 18:39:35 +01:00
Jason Davies edf75a3c36 Move bullet to new `chart` module. 2011-04-07 17:54:03 +01:00
Jason Davies b08ecad5ed Replace percentages with width/height properties.
Percentages were too tricky for adding margins.
2011-04-06 20:49:15 +01:00
Jason Davies c85195b14b Use percentages for simpler flexibility. 2011-04-06 20:16:12 +01:00
Jason Davies 28fbabf768 First stab at bullet layout. 2011-04-06 19:47:55 +01:00