codesuki / react-d3-components

D3 Components for React
http://codesuki.github.io/react-d3-components/example.html
MIT License
1.63k stars 206 forks source link

X-axis is not showing in the graph with smaller Y-axis value #163

Open anmolmayank opened 5 years ago

anmolmayank commented 5 years ago

For the below sample code we are unable to see the X-Axis

Sample Running Data

Sample Failed Data

Sample Code

data = [{
    customLabel: 'somethingA',
    customValues:[[-30, -0.3798], [-29, -0.4799],[-28, -0.209],[-19, -0.367],[-10, -0.67],[-3, -2.4],[-2, -0.78],[-1, -0.51], [0, -0.76543], [1, -0.7], [4, -0.566],  [5, -0.312]]
    }];

var labelAccessor = function(stack) { return stack.customLabel; };
var valuesAccessor = function(stack) { return stack.customValues; };
var xAccessor = function(element) { return element[0]; };
var yAccessor = function(element) { return element[1]; };

React.render(<LineChart
                data={data}
                width={400}
                height={400}
                margin={{top: 10, bottom: 50, left: 50, right: 10}}
                label={labelAccessor}
                x={xAccessor}
                y={yAccessor}
                values={valuesAccessor}
                tooltipHtml={tooltipLine}/>,
document.getElementById('linechart2')
);

Sample Output Graph

giterrorgraph