Skip to content

After render show or hide axis x not working #1520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jmtavares opened this issue Dec 29, 2015 · 2 comments
Open

After render show or hide axis x not working #1520

jmtavares opened this issue Dec 29, 2015 · 2 comments

Comments

@jmtavares
Copy link

var chart = c3.generate({
    data: {
        columns: [
            ['data1', 30, 200, 100, 400, 150, 250],
            ['data2', 50, 20, 10, 40, 15, 25]
        ],
        axes: {
            data1: 'y',
            data2: 'y2'
        }
    },
    grid: {
        x: {
            show: true
        }
    }
});

chart.internal.config.axis_x_show=false;

chart.flush();
@missingdays
Copy link

missingdays commented Jul 8, 2016

Hey!
We at Etersoft implemented it in our fork as follows

c3_chart_fn.axis.showX = function (value){
    var $$ = this.internal;

    $$.config.axis_x_show = !!value;
    $$.axes.x.style("visibility", $$.config.axis_x_show ? 'visible' : 'hidden');

    $$.redraw();
};
c3_chart_fn.axis.showY = function (value){
    var $$ = this.internal;

    $$.config.axis_y_show = !!value;
    $$.axes.y.style("visibility", $$.config.axis_y_show ? 'visible' : 'hidden');

    $$.redraw();
};

so chart.axis.showX(true) will make x asix visible, and chart.axis.showX(false) will make it disapear.
I will submit PR soon for fixing this issue.

Maybe names will need to be changed, so this methods can be used both as setters and getters.

missingdays added a commit to missingdays/c3 that referenced this issue Jul 8, 2016
@missingdays
Copy link

Created #1760 to close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants