【问题标题】:NVD3 How to remove Y-axis in Line chart and also utilize the space of Y-axis after it is removedNVD3如何在折线图中删除Y轴并在删除后还利用Y轴的空间
【发布时间】:2018-05-16 07:04:53
【问题描述】:

我正在使用 NVD3 来显示折线图。 我有这个折线图如下:

chart: {
                type: 'lineChart',
                height: 150,
                margin : {
                    top: 20,
                    right: 20,
                    bottom: 40,
                    left: 55
                },
                x: function(d){ return d.x; },
                useInteractiveGuideline: true,
                "xAxis": {
                    ticks:7,
                    showMaxMin : false,
                    tickFormat: 
                        function (d) { 
                        var x = globalFactory.getCalendarConstants().dateMap.weekDayShortLabels
                        return x[d] },
                },
                showYAxis:false,
                showLegend : false,
            }

它删除了Y-Axis,但Y-axis 的空间没有被利用。我想用完那个空间。

他们有什么解决办法吗?

【问题讨论】:

    标签: javascript angularjs angularjs-directive linechart angular-nvd3


    【解决方案1】:

    您可以尝试调整页边距(见下文),但您可能需要稍微调整一下才能按照您想要的方式调整页边距。

    margin : {
              top: 20,
              right: 20,
              bottom: 40,
              left: 0
             },
    

    【讨论】:

    • 我应该在哪个元素上尝试边距?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-05
    • 1970-01-01
    • 2022-11-02
    • 2013-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多