Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Is there a way to plot change of day on an hourly timescale on the x axis? ReactJS - Recharts

I'm using Recharts (A ReactJS library for charts).

On the x-axis, I want to show the date whenever the time crosses midnight. Something like this:

22:00   22:20   23:00   23:30  2010-11-17   00:15   01:30   02:00

Here is the example code: 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')
);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!