Estoy usando Recharts (una biblioteca ReactJS para gráficos).
En el eje x, quiero mostrar la fecha siempre que la hora cruce la medianoche. Algo como esto:
22:00 22:20 23:00 23:30 2010-11-17 00:15 01:30 02:00Aquí está el código de ejemplo: https://codepen.io/nahushf/pen/PgrgLX?editors=1010
const {BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend} = Recharts; const data = [ {name: '22:00', uv: 4000, pv: 2400, amt: 2400}, {name: '22:30', uv: 3000, pv: 1398, amt: 2210}, {name: '23:00', uv: 2000, pv: 9800, amt: 2290}, {name: '23:30', uv: 2780, pv: 3908, amt: 2000}, {name: '00:15', uv: 1890, pv: 4800, amt: 2181}, {name: '00:30', uv: 2390, pv: 3800, amt: 2500}, {name: '01:30', uv: 3490, pv: 4300, amt: 2100}, ]; const SimpleBarChart = React.createClass({ render () { return ( <BarChart width={600} height={300} data={data} margin={{top: 5, right: 30, left: 20, bottom: 5}}> <XAxis dataKey="name" xAxisId={0} /> <XAxis dataKey="name" xAxisId={1} hide/> <YAxis/> <CartesianGrid strokeDasharray="3 3"/> <Tooltip/> <Legend /> <Bar barSize={20}dataKey="uv" xAxisId={1} fill="#ccc" /> <Bar dataKey="pv" barSize={20} xAxisId={0} fill="#8884d8" /> </BarChart> ); } }) ReactDOM.render( <SimpleBarChart />, document.getElementById('container') );