javascript - Chart JS display value of y Axes on mouse over chart with respect to X Axis -


in chart js chart shows value when mouse move on chart want display multiple chart value when mouse moves on point in chart.

that value y axis respect x axis position of mouse(obvious)

<!doctype html> <html>  <head>     <title>line chart</title>     <script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.1.6/chart.bundle.js"></script>     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>     <style>     canvas{         -moz-user-select: none;         -webkit-user-select: none;         -ms-user-select: none;     }     </style> </head>  <body>     <div style="width:90%;">         <canvas id="canvas"></canvas>     </div>     <br>     <br>     <script>          var randomcolorfactor = function() {             return math.round(math.random() * 255);         };     var randomcolor = function(opacity) {         return 'rgba(' + randomcolorfactor() + ',' + randomcolorfactor() + ',' + randomcolorfactor() + ',' + (opacity || '.3') + ')';     };      var config = {         type: 'line',         data: {             labels: [1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3],             datasets: [{                 label: "my first dataset",                 data: [12,13,14,15,21,16,15,25,16,12,15,23,16,12,13,14,15,21,16,15,25,16,12,15,23,16,12,13,14,15,21,16,15,25,16,12,15,23,16,12,13,14,15,21,16,15,25,16,12,15,23,16],                 fill: false,                 borderdash: [1, 1],             }]         },         options: {             responsive: true,             title:{                 display:true,                 text:'chart.js line chart'             },             tooltips: {                 mode: 'label',              },             hover: {                 mode: 'dataset'             },             scales: {                 xaxes: [{                     display: true,                     scalelabel: {                         show: true,                         labelstring: 'month'                     }                 }],                 yaxes: [{                     display: true,                     scalelabel: {                         show: true,                         labelstring: 'value'                     },                     ticks: {                         suggestedmin: -10,                         suggestedmax: 25,                     }                 }]             }         }     };      $.each(config.data.datasets, function(i, dataset) {     });      window.onload = function() {         var ctx = document.getelementbyid("canvas").getcontext("2d");         window.myline = new chart(ctx, config);     };          </script> 

the chart getting looks my chart

what want this one

thanks in advance abhishek


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

c++ - Migration from QScriptEngine to QJSEngine -

delphi - Take screenshot in webcam using VFrames in Console Application -