question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Options not loading

See original GitHub issue

Versions: react-chartjs-2 ^3.0.3 chart.js ^3.2.1

Testing the latest version with a Line Chart - adding options to specify X-axis with type “time” and unit “month” doesn’t work.

I’ve tested epoch, utc, and moment time formats but they all display whatever data gets passed through as labels (time series doesn’t seem to get considered).

Looks like other options (ie removing ticks) doesn’t have any affect as well - which I saw was raised in another issue.

const options = {
  scales: {
    xAxes : [{
      type: "time",
      time : {
        unit : "hour"
      }
    }]
  },
};

const data = {
    labels: [1611806740907, 1612304651659,.....],
    datasets: [
      {
        data: [100000, 12000000,.....],
        fill: false,
        backgroundColor: 'rgb(255, 99, 132)',
        borderColor: 'rgba(255, 99, 132, 0.2)',
      },
    ],
  };

function LineChart(props) {
  return (
    <>
      <Line data={data} options={options} />
    </>
  )
};
export default LineChart;

Screen Shot 2021-05-14 at 9 10 04 PM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12

github_iconTop GitHub Comments

14reactions
razkedcommented, May 15, 2021

I have experienced the same problem recently.

downgrading the packages to chart.js@2.9.4 react-chartjs-2@2.11.1

resolved my problem.

10reactions
rajatdangat07commented, May 21, 2021

Versions: “chart.js”: “^3.2.1” “react-chartjs-2”: “^3.0.3”

I’m having the same issue when trying to add options that remove gridLines.

const options = {
  maintainAspectRatio: true,
  scales: {
    xAxes: [{
      gridLines: {
        display: false
      }
    }],
    yAxes: [{
      gridLines: {
        display: false
      }
    }]
  }
}
const BarChart = () => {
  return (
    <div>
      <Bar
        data={data}
        width={400}
        height={200}
        options={options}
      />
    </div>
  )
}

There are breaking changes in the chart js version 3. If you are migrating from version 2 check out the migration guide. In your case, the options should be:

const options = {
   maintainAspectRatio: true,
   scales: {
     x: {
       grid: {
         display: false
       },
     },
     y: {
       grid: {
         display: false
       },
     },
   },
 }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixed: Logitech Options not loading on Windows - The WP Guru
Options hadn't automatically loaded on startup. When I tried starting Options manually, only a grey screen came up, but the app didn't load....
Read more >
[SOLVED] Logitech Options Not Working on Windows
The Logitech Options not working issue could indicate that you're using a faulty or outdated mouse or USB driver. In the worst case,...
Read more >
How To Fix Logitech Options Not Loading - Jarod Yong
1. Uninstall Logitech Options. ... 3. Run the installer & blindly agree to everything like you always do, EXCEPT select "NO THANKS" when...
Read more >
How to Fix Logitech Options Not Working on Windows
Methods to fix the “Logitech Options Not Working on Windows” issue: Method 1: Reinstall Logitech Options: Method 2: Reinstall the device drivers ......
Read more >
"Options" option not working - Microsoft Community
I'm using Excel 365. I want to access the "options" feature. When I click "file" then "options", the menu simply disappears and I'm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found