generateLegend() only works for global variables
When using chart.generateLegend(), the variables referenced in options.legendTemplate must exist globally.
Using chart.generateLegend() within a function will result in "data is not defined" where data is the variable with the chart data.
If I do window.data = data; before, it works.
Hello, this issue looks like a QUESTION regarding the Chart.js API. It would be very helpful if you could please create an example chart showing your attempt, and even call the methods that don't exist yet which you are expecting to be there. A mockup here of what the result should look like would be for bonus points.
To help, I have created a simple JSBIN which you could fork: http://jsbin.com/yozobahucero/1/edit?html,js,output
Sorry that this response is templated as we are triaging many issues and ones with test cases will be seen first.
This seems to be fixed in the latest version. But if you are still seeing this problem, please add a test case and reopen.
Hi fulldecent,
It seems the issue still occur. Here is my jsfiddle https://fiddle.jshell.net/jomarv/fehxxuns/9/, Im using version 2.5.0