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

59 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock d2ad436fed Don’t pollute an ordinal scale’s domain.
Fixes #1550. By using the copy of the new scale (which we make anyway for a
snapshot) we avoid polluting the scale’s domain with the old values when using
the scale as the key function for the tick data-join.
2013-09-26 14:08:16 -07:00
Mike Bostock 06e2077ff8 Use the scale as the tick key function.
Previously we were using string coercion as the key function for axis ticks.
However, when the stringified value of the tick does not fully capture the
representation (such as a date with millisecond precision, whose string form
only has second precision; fixes #1529), string coercion is insufficient.

Fortunately, there is an equivalently-simple key function for tick identity: the
scale! If the scale does not return a unique position for the given tick, then
the tick would be overlapping, so it serves perfectly as the key function.
2013-09-18 20:12:45 -07:00
Mike Bostock 08d791f69d Merge remote-tracking branch 'origin/remove-tick-subdivide' into 3.3 2013-08-13 14:17:26 -07:00
Mike Bostock f1e796a99f Restructure state to shave a few bytes. 2013-08-13 11:00:38 -07:00
Mike Bostock 3007e88970 Add axis.{inner,outer}TickSize. Fixes #1394. 2013-08-10 10:33:02 -07:00
Mike Bostock bd0ce6cab8 Remove axis.tickSubdivide. Fixes #1115. 2013-08-10 09:53:00 -07:00
Mike Bostock df18a153cf Merge branch 'fix-axis-no-ticks' into 3.2.4 2013-07-05 11:19:53 -07:00
Mike Bostock b745b32525 Fix axis for scales that don’t define ticks.
In addition to ordinal scales, quantile, quantize and threshold scales don’t
define a ticks method. Unlike ordinal scales, however, these quantitative scales
also don’t define a rangeBand method, so the axis was crashing trying to render
these scales. This fixes #1367 by checking for the required rangeBand method
rather than assuming scales without a ticks method define a rangeBand.

Note, however, that even with this change you probably still want to define tick
values explicitly when using one of these scales with an axis. That’s because
each tick in the axis represents a span of values in the domain; you can use the
invertExtent method to get the span for each tick value.
2013-07-05 10:00:29 -07:00
Mike Bostock c6bad2fb6c Fix line interpolation tests. 2013-07-03 10:05:14 -07:00
Erik Cunningham 40f5215710 clean up leading whitespace 2013-06-24 16:37:28 -06:00
Erik Cunningham 995c70cf6f simple test coverage of d3.svg.diagonal 2013-06-24 16:35:06 -06:00
Erik Cunningham aa18d82258 test setup for svg.diagonal 2013-06-24 15:28:54 -06:00
Jason Davies 85d156c3f7 brush.clamp: return null if there are no scales.
Similarly, if there are no scales, setting a clamp does nothing.

For consistency with brush.extent.
2013-06-14 10:10:00 +01:00
Mike Bostock 12875f46b2 Merge branch 'add-step-middle' of github.com:iterion/d3 into 3.2 2013-05-30 11:45:08 -07:00
Mike Bostock fbf8880a6f Merge branch 'master' of github.com:jisaacks/d3 into 3.2 2013-05-30 11:38:07 -07:00
JD Isaacks f676389b98 Make clamp implementation more similar to extent 2013-04-02 12:16:50 -04:00
JD Isaacks a829aa260c Add brush.clamp method to specify to clamp extent to range or not 2013-04-02 10:58:44 -04:00
Adam Sunderland fdf5f93797 cleaner formatting for step interpolation method 2013-03-26 17:11:06 -05:00
Adam Sunderland 0500aaea43 change step-middle to just step 2013-03-26 15:01:05 -05:00
Adam Sunderland 2f82165d5f adding step-middle as interpolation method 2013-03-26 14:50:54 -05:00
Jason Davies 34059e22c4 Minor code style fixes. 2013-03-21 22:01:51 +00:00
Mike Bostock 0d7c6c55e7 Use _ to disambiguate local vs. global d3. 2013-03-14 15:14:12 -07:00
Mike Bostock 68be0ac8c8 Rename assert and XMLHttpRequest. 2013-03-14 13:00:04 -07:00
Mike Bostock ecbf93d922 Standardize test environment. 2013-03-14 12:58:16 -07:00
Mike Bostock 0f2b61ae93 Refactor svg tests using smash. 2013-03-14 08:46:45 -07:00
Mike Bostock d0441e6170 Automatic precision for custom tick formats.
You can now pass a format specifier to scale.tickFormat (for linear, pow and
identity scales). If the format specifier doesn't have a defined precision, the
precision will be set automatically by the scale, returning the appropriate
format. This provides a convenient, declarative way of specifying a format whose
precision will be automatically set by the scale.

This works with axes, too! For example, `axis.ticks(10, "%")` will now use a
percentage format rather than the default format, while still computing the
appropriate precision.

This commit also includes a fix to make d3.format more robust when unreasonable
precisions are specified. Rather than throwing an error, the nearest reasonable
value is used instead.

Fixes #912.
2013-03-11 18:06:05 -07:00
Mike Bostock a3bb93a749 Fix vows clobbering our custom asserts. 2013-03-05 09:01:18 -08:00
Mike Bostock 093bd8485a Fix for invalid axis.orient. Fixes #905. 2013-02-06 10:25:19 -08:00
Mike Bostock 60a25641af Use style rather than attr for "text-anchor".
This makes it easier to override via stylesheet.
2012-10-05 14:50:34 -07:00
Mike Bostock 53fa8f1a4a Custom d3.svg.{area,line} interpolators.
You can now specify a function as the interpolate property of a line or area,
allowing you to define custom interpolation behavior.
2012-06-30 10:35:58 -07:00
Jason Davies fe6d0fd2f2 "Bundle" interpolation for single-element arrays.
In future we may want to generate some kind of loop, but it's not clear
what orientation such a loop should have, so perhaps a "non-line" like
this is better as a default.
2012-05-09 22:04:00 +01:00
Jason Davies 0200f6501c Fix typo. 2012-03-04 11:52:51 +00:00
Jason Davies dbee8568b3 Add simple tests for closed radial areas. 2012-03-04 11:37:24 +00:00
Mike Bostock 93c78c625e Fix drift in brush extent.
Previously, if you set the brush extent externally, the extent could drift
slightly because it was internally stored in pixel space rather than in data
space. To avoid drift, the brush now preserves the extent exactly as-set, only
nullifying the externally-set extent when the brush is moved.
2012-02-28 18:27:40 -08:00
Mike Bostock 0aed1e403d Merge branch 'customticks' of https://github.com/larskotthoff/d3 into v2.8.0 2012-02-21 22:42:41 -08:00
Mike Bostock d69cbbdaa7 Adopt d3.map for d3.svg.line and d3.svg.area. 2012-02-21 08:55:03 -08:00
Mike Bostock f1197ed8b6 Use d3.map for d3_svg_symbols.
This fixes a crash with the symbol type "hasOwnProperty", rather than defaulting
to "circle". This commit also adds new map methods to retrieve the keys, values
and entries. The map class now uses non-enumerable properties (if supported).
2012-02-20 21:30:23 -08:00
Mike Bostock 3081dd45ef Consolidate everything into d3.v2.js.
Rather than producing separate files for each module, the default build now
produces a single file. This should encourage better page-load performance as
the files were relatively small. Also, it's easier to deal with only one file
rather than many, especially if you're not quite sure what the dependencies are.
You may still create minimized builds, if you don't want every feature.

This commit also demotes the chart components to the examples directory, rather
than keeping them as part of the core library. As always, D3 is not a charting
library, and these were ever only intended to serve as examples.
2012-02-18 14:04:01 -08:00
Lars Kotthoff d043d1126a setting ticks()/tickValues() sets the other one to null (mbostock) 2012-01-19 20:45:19 +00:00
Lars Kotthoff 8c2204c680 separate variable and accessor method for ticks (mbostock) 2012-01-19 20:43:57 +00:00
Lars Kotthoff 29e39cf60a test for tick positions given as list 2012-01-19 20:40:43 +00:00
Jason Davies 1a98398be0 Fix d3.svg.axis path for explicit ordinal range. 2011-12-14 09:15:25 +00:00
Mike Bostock 552622da17 Ordinal scales for axes. 2011-11-23 12:05:52 -08:00
Mike Bostock d2ba3b2d2c Minor fixes for the axis component.
You can now change the orientation and the axis will redraw correctly. When an
axis is applied by a transition, the subtransitions will properly inherit the
transition id, allowing transitions on reselected elements to continue.
2011-10-10 16:45:08 -07:00
Mike Bostock 4d1de5e175 Fix a bug in area step interpolation.
When computing the reversed baseline, we need to switch between step-before and
step-after, since the points are in reverse order. Otherwise, we're effectively
filling the gap between step-before and step-after.
2011-10-07 11:32:06 -07:00
Jason Davies 3d064526d4 Reverse subpath direction for annulus. 2011-08-31 12:48:01 +01:00
Mike Bostock 0f4152e042 Fix the domain path for polylinear scales. 2011-08-24 16:20:59 -07:00
Mike Bostock ba2a68bb94 Allow tickFormat to be specified as a constant.
This was basically supported already, but there was a slight bug in the truthy
check for tickFormat. Now we check for null rather than falsiness.
2011-08-24 16:11:28 -07:00
Mike Bostock 95805adc9b Promote the axis component to the svg module.
I'm including the axis component in the core build because it should be useful
in many different visualization types, similar to the other svg components. The
chart module contains a hodgepodge of more obscure visualization types, and
there's no reason to pull those in for more common visualizations. Perhaps most
importantly, the axis component isn't a chart type!
2011-08-23 12:02:12 -07:00
Mike Bostock f12352c6f4 Add test for svg.area.radial.
Also, better formatting for failure message in assert.pathEqual.
2011-08-17 16:07:28 -07:00