react-chartjs-2 icon indicating copy to clipboard operation
react-chartjs-2 copied to clipboard

How to disable points on a line graph?

Open william-tf opened this issue 5 years ago • 5 comments

I have tried changing radius & pointRaidius to 0 but to no avail. I also removed point from the options object completely and it didn't change anything. After searching I couldn't find any other options to try and hide them. Apologies if this is an idiotic question, I'd appreciate it if there's documentation I missed that someone could point me to.

william-tf avatar Jun 07 '21 20:06 william-tf

options = {radius: 0} My output: image

manhncse02926 avatar Jun 14 '21 06:06 manhncse02926

Worked for me the options = {radius: 0}.

LuisValgoi avatar Jun 22 '21 20:06 LuisValgoi

@manhncse02926 how did you remove the gridline from the y axis?

LuisValgoi avatar Jun 22 '21 20:06 LuisValgoi

Found it:

return (
    <Line
      data={chartData}
      options={{
        radius: 0,
        responsive: true,
        scales: {
          x: {
            grid: {
              display: false,
            },
          },
          y: {
            grid: {
              display: false,
            },
          },
        },
        plugins: {
          legend: {
            align: "end",
          },
        },
      }}
    />
  )

LuisValgoi avatar Jun 22 '21 20:06 LuisValgoi

In case anyone one comes across this using TypeScript, this will throw an error. Use

options = {
  elements: {
    point: {
      radius: 0,
    }
  }
}

ArkinSolomon avatar Sep 12 '23 22:09 ArkinSolomon