Skip to content

pie - problem with reversed domain ranges #4300

Description

@archmoj

In this codepen the first pie graph (i.e. on the left) does not look right!
The graphs reversed and the text is presented outside as a result of bad input data where domain.x[1] is not greater than domain.x[0].

We shouldn't allow that here:

exports.defaults = function(containerOut, layout, coerce, dfltDomains) {
var dfltX = (dfltDomains && dfltDomains.x) || [0, 1];
var dfltY = (dfltDomains && dfltDomains.y) || [0, 1];
var grid = layout.grid;
if(grid) {
var column = coerce('domain.column');
if(column !== undefined) {
if(column < grid.columns) dfltX = grid._domains.x[column];
else delete containerOut.domain.column;
}
var row = coerce('domain.row');
if(row !== undefined) {
if(row < grid.rows) dfltY = grid._domains.y[row];
else delete containerOut.domain.row;
}
}
coerce('domain.x', dfltX);
coerce('domain.y', dfltY);
};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions