Skip to content

xAxisLabel / yAxisLabel modify margins #1324

Open
@emiljas

Description

@emiljas

I think that this code cause a lot of trouble:

_chart.yAxisLabel = function (labelText, padding) {
        if (!arguments.length) {
            return _yAxisLabel;
        }
        _yAxisLabel = labelText;
        _chart.margins().left -= _yAxisLabelPadding;
        _yAxisLabelPadding = (padding === undefined) ? DEFAULT_AXIS_LABEL_PADDING : padding;
        _chart.margins().left += _yAxisLabelPadding;
        return _chart;
    };

In my code I set margin (e.g. left margin to 10px) and then set yAxisLabel (default padding 12px).
Then I do this again for some action, but in my model margin is still 10px but it isn't true.

I hope you understand my problem. Do you agree that this code smell?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions