score:0
yes, it's possible
you can check my fiddle: https://jsfiddle.net/iphong993/gru4lad6/14/
var canvas = document.getelementbyid('chart');
new chart(canvas, {
type: 'line',
data: {
labels: ['1', '2', '3', '4', '5'],
datasets: [{
label: 'a',
yaxisid: 'a',
data: [100, 96, 84, 76, 69]
}]
},
options: {
scales: {
yaxes: [{
id: 'a',
type: 'linear',
position: 'left',
}, {
id: 'b',
type: 'linear',
position: 'right',
ticks: {
max: 1,
min: 0
}
}]
},
annotation: {
annotations: [
{
drawtime: "beforedatasetsdraw",
type: "box",
xscaleid: "x-axis-0",
yscaleid: "b",
xmin: "3",
xmax: "5",
ymin: 0.3,
ymax: 0.3,
bordercolor: "red",
borderwidth: 1,
onclick: function(e) {
console.log("box", e.type, this);
}
},
{
drawtime: "beforedatasetsdraw",
type: "box",
xscaleid: "x-axis-0",
yscaleid: "b",
xmin: "3",
xmax: "3",
ymin: 0,
ymax: 0.3,
bordercolor: "red",
borderwidth: 1,
onclick: function(e) {
console.log("box", e.type, this);
}
}
]
}
}
});
Source: stackoverflow.com
Related Query
- Adding reading off lines in ChartJS
- ChartJS Adding Different Lines for each column
- ChartJS Line Charts - remove color underneath lines
- ChartJS New Lines '\n' in X axis Labels or Displaying More Information Around Chart or Tooltip with ChartJS V2
- Adding Image inside Linechart points in ChartJs
- chartjs tooltip is cut off when out of canvas
- ChartJS : How to leave just points without lines
- ChartJS Radar Chart radar lines color?
- Find intersection between the chart lines in chartjs
- ChartJS Line chart cut off at the top and bottom
- Chartjs adding icon to tooltip and label
- Adding image on the top of bar in chartjs
- How to add background color between two lines in yAxis Chartjs
- How to add ChartJS code in Html2Pdf to view image
- How to make ChartJS not cut off tooltips?
- ChartJS - Adding legend title into tooltip title
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- chartjs Adding percentages to Pie Chart Legend
- Adding line over stacked line chart with ChartJS
- ChartJS / Chartjs-plugin-annotation How to draw multiple vertical lines using an array?
- ChartJS v2 - Keep tooltip open when user click on a point of a multiple lines chart
- How to add background color between two specific lines in Chartjs 3.1
- How to show both overlapping lines in in chartjs
- ChartJS 2 lines each with different fill gradients
- How to combine lines with different starting points in chartjs
- ChartJS keeps adding one day to X axis. I cannot find a reason. Any suggestion?
- Chartjs not working with d3 from csv source
- ChartJS padding from lines left and right
- How to set vertical lines for new day on x-axis in ChartJS v3.x
- How can I make small grid lines above ChartJS labels?
More Query from same tag
- diplay barchart in a <div>
- How to add tooltips to chart.js graph
- Values on Y-axis disappear (hide under labels)
- Link in ChartJS tooltip not clickable
- Chart js vertical line z-index
- Cannot access variables defined in webpack after build from client
- ChartJS - Why is the transition on the first dataset bad?
- Where do I use chartjs's destroy function?
- Chartjs not reading data from vuex mapped state
- Representing multiple subsections within a section of a doughnut chart Chart.js
- How to use major tick marks in chart.js 2.9.3?
- Bootstrap > Extend ChartJS canvas horizontally to match overflowing columns
- Prevent the wiping of an Array after routing Angular.js
- How to access global variable from outside of canvas.onmousemove function?
- Chart.js Clipping on Top of Line Graph
- ChartJS How to set max labels for X axis?
- I can't import ChartsModule
- Chart disappears just after finishing animation
- How to get data from JSON for chart.js, using vue.js
- Javascript / JSON error: TypeError: myObj is undefined
- How to rotate datalabels in Charts.js with plugins?
- Change the graph from 1 Day to 15 mins when it is being loaded for the 1st time in ChartIQ
- Chartjs - Tooltip with Rupee Symbol
- Bar Chart in Angular JS Using Chartjs
- How to add new x axis in chart JS?
- How to check chart type on Chart.js
- Chart.js 3.x custom positioners: cannot use them in TypeScript
- nodejs express jade mongodb project: how to import include chart.js
- How to label x-Axis in Chart.js by days?
- chart.js renders outside div and canvas