8000 enforce scale constraints after matching axis autorange · plotly/plotly.js@74cf76c · GitHub
[go: up one dir, main page]

Skip to content

Commit 74cf76c

Browse files
committed
enforce scale constraints after matching axis autorange
- that way (under `constrain:'domain'`) both matching axis range and ax._m constraints can be satisfy at the same time. - Now, does this fit with what users expect? I'm not too sure.
1 parent 835c69b commit 74cf76c

File tree

4 files changed

+5
-4
lines changed
  • mocks
  • 4 files changed

    +5
    -4
    lines changed

    src/plot_api/subroutines.js

    Lines changed: 3 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -708,8 +708,6 @@ exports.doAutoRangeAndConstraints = function(gd) {
    708708
    doAutoRange(gd, ax);
    709709
    }
    710710

    711-
    enforceAxisConstraints(gd);
    712-
    713711
    groupLoop:
    714712
    for(var j = 0; j < matchGroups.length; j++) {
    715713
    var group = matchGroups[j];
    @@ -738,8 +736,11 @@ exports.doAutoRangeAndConstraints = function(gd) {
    738736
    ax.range = rng.slice();
    739737
    ax._input.range = rng.slice();
    740738
    ax.setScale();
    739+
    ax._matched = true;
    741740
    }
    742741
    }
    742+
    743+
    enforceAxisConstraints(gd);
    743744
    };
    744745

    745746
    // An initial paint must be completed before these components can be

    src/plots/cartesian/constraints.js

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -276,7 +276,7 @@ exports.enforce = function enforceAxisConstraints(gd) {
    276276
    factor *= rangeShrunk;
    277277
    }
    278278

    279-
    if(ax.autorange) {
    279+
    if(ax.autorange && !ax._matched) {
    280280
    /*
    281281
    * range & factor may need to change because range was
    282282
    * calculated for the larger scaling, so some pixel
    Loading

    test/image/mocks/axes_scaleanchor-with-matches.json

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,7 @@
    55
    ],
    66
    "layout":{
    77
    "width": 500,
    8-
    "height": 500,
    8+
    "height": 700,
    99
    "xaxis": {
    1010
    "constrain": "domain"
    1111
    },

    0 commit comments

    Comments
     (0)
    0