score:11
Yes it is possible, please use tooltips option as below
var ctx = document.getElementById('chart1').getContext("2d");
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fill: false,
lineTension: 0.1,
backgroundColor: "rgba(75,192,192,0.4)",
borderColor: "rgba(75,192,192,1)",
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: "rgba(75,192,192,1)",
pointBackgroundColor: "#fff",
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: "rgba(75,192,192,1)",
pointHoverBorderColor: "rgba(220,220,220,1)",
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [65, 59, 80, 81, 56, 55, 40],
spanGaps: false,
}
]
};
var options = {
responsive: true,
title: {
display: true,
position: "top",
text: 'anything',
fontSize: 18,
fontColor: "#111"
},
tooltips: {
enabled: true,
mode: 'single',
callbacks: {
label: function(tooltipItems, data) {
var multistringText = [tooltipItems.yLabel];
multistringText.push('Another Item');
multistringText.push(tooltipItems.index+1);
multistringText.push('One more Item');
return multistringText;
}
}
},
legend: {
display: true,
position: "bottom",
labels: {
fontColor: "#333",
fontSize: 16
}
},
scales:{
yAxes:[{
ticks:{
min:0
}
}]
}
};
var myLineChart = new Chart(ctx, {
type: 'line',
data: data,
options: options
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<canvas id="chart1"></canvas>
score:1
If you want to show data below the existing item in the tooltips you can use the 3 different tooltip footer
callbacks. Just define what you want to show as arrays outside of the scope of chart.js and reference it using an index.
tooltips: {
enabled: true,
mode: 'single',
callbacks: {
beforeFooter: function(tooltipItems, data) {
return 'Point #: ' + footerLine1[tooltipItems[0].index];
},
footer: function(tooltipItems, data) {
return 'Other Data: ' + footerLine2[tooltipItems[0].index];
}
}
},
Keep in mind that you only have 3 lines to work with (e.g. 3 footer callbacks)
See the example here.
score:1
tooltips: { mode: 'index' }
add this to options
Source: stackoverflow.com
Related Query
- how to show multiple values in point hover using chart.js
- Show point values in Radar Chart using chart.js
- chartjs show dot point on hover over line chart
- Chartjs - show elements in all datasets on hover using bar chart
- How to show data values in top of bar chart and line chart in chart.js 3
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
- How to show slice value inside of slice in pie chart using chart.js
- How to draw multiple color bar in a bar chart using chart.js
- How to plot chart from external JSON and format X-AXIS to show time using Chart.JS?
- How to show multiple datasets in line chart js
- I am using chart.js I sent my time values throw my api as timestamp know i need to show them in the chart as date format
- show multiple responsive chart in the same page using chart.js
- How to show the chartjs bar chart data values labels as text?
- how to show speedometer on Doughnut chart in chart.js using reactjs
- Chart.js How can I embed additional values to each data point in radar chart
- How to display the values inside the pie chart of PrimeNG (chart) using JavaScript or Angular
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- How remove duplicates xAxis labels and show all values on chart
- How can I show "No Data" message in Pie Chart when there is no data using VueJS?
- How to Draw a line on chart without a plot point using chart.js
- How to show bar chart labels clearly using ChartJS?
- How to show values on top of bars in a PDF using chart.js and chartjs-node-canvas?
- how to show chart using chart js
- How to run Chart.js samples using source code
- how to show data value on bar chart body rather than using tooltip?
- how to remove old data from Chart js on mouse hover using mvc c#?
- Show multiple line graphs on the same chart using chart JS
- how to not repeat code while creating multiple charts in chart js
- How to add text inside the doughnut chart using Chart.js?
More Query from same tag
- Adding a second custom tooltip for charts in ChartsJs
- How to draw horizontal Lines using chart.js 3.x ? Cannot get it working
- Building Chart.js master - generated .js gives errors
- How to align labels at same side chartjs React
- 【React chart.js】How to add multiple data to Radar chart using map function
- Cannot change font color and box width in chart
- Always display ChartJS custom tooltips
- how to plot multiple time series in chartjs where each time series has different times
- How to make bootstrap 4 column height the same as row height
- On click event to show name of pie chart slice in chartsJS
- Problem creating scatter graph using chart.js
- Show and plot zero values on ChartJS line graph when no data
- Remove chartjs pie chart highlight on hover
- chartjs line graph points with different color
- How can I draw dotted line using chartjs?
- Use multiple datasets with Javascript Chart
- chart.js doughnut legend in the chart
- Update ChartJS with MySQL Data
- How do I horizontally center a line chart when their is a single X-Axis value?
- Charts js - How to make gridlines dash and How to make the gridlines stop at each point
- Print pie chart in chartjs
- How we can draw a circle in bar chart
- How to Create Single line bubble Chartjs chart?
- Chart.js pie tooltip getting cut
- Changing the background of a ChartJS on node js
- Chart.js br chart only displaying first value
- Draw horizontal line on chart in chart.js on v2
- Clojurescript/Reagent/Chart.js - Reagent life cycle - chart.update()
- ChartJS BoxWidth not working
- Possible to merge 2 bars in bar chart (chart.js)