Skip to content

Commit

Permalink
update axes when rescaling
Browse files Browse the repository at this point in the history
fixes #791
rescale when .x or .y is assigned
document rescale
  • Loading branch information
gordonwoodhull committed Jun 9, 2015
1 parent 5189c13 commit 7aa7411
Show file tree
Hide file tree
Showing 16 changed files with 171 additions and 138 deletions.
5 changes: 4 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# 2.0 Series
## 2.0.0 beta 12
* axes should rescale on chart rescale (not just on zoom). ([#791](https://github.com/dc-js/dc.js/issues/791))

## 2.0.0 beta 11
* pretransition event ([#806](https://github.com/dc-js/dc.js/issues/806))
* replace `.renderlet(...)` with `.on("renderlet", ...)` in test and examples, by Alan Kavanagh ([#906](https://github.com/dc-js/dc.js/issues/906) / ([#917](https://github.com/dc-js/dc.js/pull/917))

## 2.0.0 beta 10
* component package manager support, by Shobhit Gupta ([#860](https://github.com/dc-js/dc.js/pull/860))
* add sourcemaps (*.map) to distributions ([#866](https://github.com/dc-js/dc.js/issues/866))
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dcjs",
"version": "2.0.0-beta.11",
"version": "2.0.0-beta.12",
"main": ["dc.js", "dc.css"],
"keywords": [
"visualization",
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dc.js",
"repository": "dc-js/dc.js",
"description": "Multi-Dimensional charting built to work natively with crossfilter rendered with d3.js",
"version": "2.0.0-beta.11",
"version": "2.0.0-beta.12",
"keywords": [
"visualization",
"svg",
Expand Down
22 changes: 16 additions & 6 deletions dc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dc.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dc.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dc.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dc",
"version": "2.0.0-beta.11",
"version": "2.0.0-beta.12",
"license": "Apache-2.0",
"copyright": "2014",
"description": "A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js ",
Expand Down
16 changes: 13 additions & 3 deletions src/coordinate-grid-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dc.coordinateGridMixin = function (_chart) {
var _renderHorizontalGridLine = false;
var _renderVerticalGridLine = false;

var _refocused = false;
var _refocused = false, _resizing = false;
var _unitCount;

var _zoomScale = [1, Infinity];
Expand All @@ -100,8 +100,15 @@ dc.coordinateGridMixin = function (_chart) {

var _useRightYAxis = false;

/**
#### .rescale()
When changing the domain of the x or y scale, it is necessary to tell the chart to recalculate
and redraw the axes. (`.rescale()` is called automatically when the x or y scale is replaced
with `.x()` or `.y()`, and has no effect on elastic scales.)
**/
_chart.rescale = function () {
_unitCount = undefined;
_resizing = true;
};

/**
Expand Down Expand Up @@ -225,6 +232,7 @@ dc.coordinateGridMixin = function (_chart) {
}
_x = _;
_xOriginalDomain = _x.domain();
_chart.rescale();
return _chart;
};

Expand Down Expand Up @@ -646,6 +654,7 @@ dc.coordinateGridMixin = function (_chart) {
return _y;
}
_y = _;
_chart.rescale();
return _chart;
};

Expand Down Expand Up @@ -1005,11 +1014,11 @@ dc.coordinateGridMixin = function (_chart) {

_chart.plotData();

if (_chart.elasticX() || _refocused || render) {
if (_chart.elasticX() || _resizing || render) {
_chart.renderXAxis(_chart.g());
}

if (_chart.elasticY() || render) {
if (_chart.elasticY() || _resizing || render) {
_chart.renderYAxis(_chart.g());
}

Expand All @@ -1018,6 +1027,7 @@ dc.coordinateGridMixin = function (_chart) {
} else {
_chart.redrawBrush(_chart.g());
}
_resizing = false;
}

function configureMouseZoom () {
Expand Down
2 changes: 1 addition & 1 deletion web/docs/api-latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* [Heat Map](#heat-map)
* [Box Plot](#box-plot)

#### Version 2.0.0-beta.11
#### Version 2.0.0-beta.12
The entire dc.js library is scoped under the **dc** name space. It does not introduce anything else
into the global name space.
#### Function Chaining
Expand Down
Loading

0 comments on commit 7aa7411

Please # to comment.