0

In my NVD3 linePlusBarChart, the x axis labels are disappearing if left/right edges are small double values between -1 and 1. Note, if the left edge is smaller than -1 and the right edge is greater than 1 (no matter double or integer), then the labels show up properly. Not sure if this is a bug. The actual data set I will get will consist of very small double values, oftentimes between -0.1 and 0.1. Any workaround/suggestion/help to overcome this problem would be appreciated.

plnkr http://plnkr.co/edit/nmIpD14S9eNp14mssa8u?p=preview

JSfiddle at http://jsfiddle.net/1gqc6pb7/12/

     $scope.options = {
        chart: {
            type: 'linePlusBarChart',
            height: 500,
            margin: {
                top: 30,
                right: 75,
                bottom: 50,
                left: 75
            },

            //.......

            x: function (d, i) {
                return d.x 
            },


            xAxis: {
                axisLabel: 'X Axis',
                tickFormat: function (d) {
                    return d
                }
            }

        }
    };


        $scope.data = [
        {
            "key": "Quantity",
            "bar": true,
            //"values": [[-1.01, null], [0, 4], [0.015, 3], [0.045, 4], [0.065, 1], [0.075, 10], [1.01, null]] // X axis labels show up
            "values": [[-0.1, null], [0, 4], [0.015, 3], [0.045, 4], [0.065, 1], [0.075, 10], [0.1, null]] //  X axis labels DO NOT show up

        },
        {
            "key": "Bell Curve",
            //"values": [[-1.01, null], [0, 4], [0.015, 3], [0.045, 4], [0.065, 1], [0.075, 10], [1.01, null]] // X axis labels show up
            "values": [[-0.1, null], [0, 4], [0.015, 3], [0.045, 4], [0.065, 1], [0.075, 10], [0.1, null]] //  X axis labels DO NOT show up

        }

    ].map(function (series) {
        series.values = series.values.map(function (d) { return { x: d[0], y: d[1] } });
        return series;
    });

enter image description here

enter image description here

user2217057
  • 237
  • 3
  • 17

0 Answers0