FVANCOP / ChartNew.js

MIT License
420 stars 142 forks source link

multiple Tooltip for radar #406

Closed CPASimUSante closed 8 years ago

CPASimUSante commented 8 years ago

i saw that issue that made me think everything is possible, but i can't manage to adapt the principle for radar chart. I would like the same rendering as radar for Chart.js : having a unique tolltip for each label value and displaying the results for all datasets for that value (possibly followed by the dataset title). Something like :

Eating

Thank you

markosko commented 8 years ago

Hello, try this copied from bar_and_lines_with_detectAnnotateOnFullLine_with_box_legend.html in Samples and little edited as u wrote in your issue

//function for creating custom tooltip for datasets
function annotateAllX(area,ctx,data,statData,posi,posj,othervars) {
    retstring='<B><U>'+statData[posi][posj].v2+'</U></B><BR>';
    for(var i=data.datasets.length-1;i>=0;i--){
            var boxLegend="<canvas id=\"canvas_Line"+posi+"_"+posj+"\" height=\"10\" width=\"30\" style=\"border:1px solid black; background : "+data.datasets[i].fillColor+"\"></canvas>";
            retstring=retstring+boxLegend+" "+statData[i][posj].datavalue+" "+statData[i][posj].v1+"<BR>";
    }
    return "<%='"+retstring+"'%>".replace(/<BR>/g," ");

}

var opt1 = {
      canvasBorders : true,
      canvasBordersWidth : 3,
      canvasBordersColor : "black",
      legend : true,
      inGraphDataShow : true,
      annotateDisplay : true,
      annotateLabel: annotateAllX,

}
CPASimUSante commented 8 years ago

Works great, thanks ! i should have check in depth for doc