Q:

How to give link for lable/Legend in chart.js? and if the value is 0 how to remove the legend?

I am working on Doughnut chart.js. Here I am showing all the legends if the value is 0 then also its showing. I need to give a link for each legend how i can implement this.
There is no information about this in chart.js documents
here is my code
<body>
        <div id="canvas-holder">
            <canvas id="chart-area" width="500" height="500"/>

        </div>
        <div id="js-legend" class="chart-legend"></div> 
    </body>  

Java Script 
<script>

        var doughnutData = [
                {
                    value: 1,
                    label: "One"
                },
                {
                    value: 2,
                    label: "Two"
                },
                {
                    value: 3,
                    label: "Three"
                },
                {
                    value: 4,
                    label: "Four"
                },
                {
                    value: 5,
                    label: "Five"
                },
                {
                    value: 0,
                    label: "Six"
                }

            ];

            window.onload = function(){
                var ctx = document.getElementById("chart-area").getContext("2d");
                window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {responsive : true});
                document.getElementById('js-legend').innerHTML = myDoughnut.generateLegend();   
            };

here its showing six also if at all the value is 0

Need to include chart.js
Thank you

A:

The legendTemplate option allows you to control your legend content, like so
...
window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {
    responsive: true,
    legendTemplate: '<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){ if (segments[i].value) { %><li><span style="background-color:<%=segments[i].fillColor%>"></span><%if(segments[i].label){%><a href="<%=links[i]%>"><%=segments[i].label%></a><%}%></li><%}}%></ul>'
});
myDoughnut.links = ["mylink1", "mylink2", "mylink3", "mylink4", "mylink5", "mylink6"];
...

