0

I must remove the elements for the axis because I don't want to have empty space. I have to fit the graph in a panel.

enter image description here

I'm trying something like:

enter image description here

d3.select("g.c3-axis .c3-axis-y").remove();
d3.select("g.c3-axis-x").remove();

I printed this following selection in my console and it's all right but the remove doesn't work:

d3.select("svg").select(".c3-axis-x").selectAll("*").remove();

No results! What's the mistake ? I think that when I launch the function the chart is not completely generated, but I can't find a good solution to achieve the style desiderated.

4

1 回答 1

0

我以不同的方式实现了结果,我修复了图表中轴的填充。

在此处输入图像描述

axis: 
        {
            x: 
            {

                type: 'timeseries',
                tick: 
                {
                    format : "%d-%m-%y"
                },
                show: false,
    padding : 
                {
                    bottom : 0,
                    left: 0, 
                    right: 0
                }

            },
            y: 
            {

                min: 0,
                padding : 
                {
                    bottom : 0,
                    left: 0,
                    right: 0
                },
                tick: 
                {
                    values: [[0], [maxs]],  
                    format:  function (d) { return d3.format(',f')(d) +' kWh/h' }
                },
                show: false
            }
        },
于 2015-07-01T09:56:50.870 回答