3

I am using ChartJS to draw a line chart. I want to update the chart with the different dataset but that is another case. Right now i am having trouble in adding a button in the title because no callback function is available for this. Any thing from i can get help ?

fat potato
  • 503
  • 1
  • 9
  • 29
  • Hey did you found a solution for this? I'm also struggling to add links to titles ... – necker Mar 10 '18 at 13:57
  • 1
    @necker no i have read the documentation and issues in the github. There is no support available for that. However let me tell you how i have hack this. – fat potato Mar 12 '18 at 06:46
  • 1
    @necker i have added the answer below please check if it makes sense. – fat potato Mar 12 '18 at 07:34

1 Answers1

5

According to this issue on github.

There are two points mentioned:

1- You cannot have a hyperlink inside the canvas.

2- There is a solution to make title clickable but this makes whole one point to another point clickable not only text but the white space also.

My solution : what I did was to use a simple hack; I hide the title by giving it display :false and then add an external link to it. Line adding a link into the div. And upon clicking it I was changing the chart.

You can control the chart by using any external element but there are some limitation on manipulating the chart from the elements of the charts itself.

I hope it may help the future readers.

ata
  • 3,398
  • 5
  • 20
  • 31
fat potato
  • 503
  • 1
  • 9
  • 29