score:1
Accepted answer
You don't actually need to set/use all the properties. Only set those which are needed to fulfill your requirement. So, setting the following properties should be enough to draw that horizontal line :
annotation: {
annotations: [{
type: 'line',
id: 'hLine',
mode: 'horizontal',
scaleID: 'y-axis-0',
value: 3, // data-value at which the line is drawn
borderWidth: 2,
borderColor: 'black'
}]
}
also, note that annotations
property is not just an object, it's an array of object(s).
Source: stackoverflow.com
Related Query
- Can't Draw Horizontal Line on Graph Using ChartJS Annotation Plugin and Primevue Chart
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- How to create a line on a chart using chartjs-plugin-annotation
- How to bind data from Controler to chartjs line chart to create it as dynamic?
- how to create line chart using chart.js in angular 2+
- How to add vertical line in bar chart using chartJs and ng2-charts?
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- create a multi line chart using Chart.js
- How to add an on click event to my Line chart using Chart.js
- Display line chart with connected dots using chartJS
- How to create stacked bar chart using react-chartjs-2?
- How to create a gradient fill line chart in latest Chart JS version (3.3.2)?
- How to create single value Doughnut or Pie chart using Chart.js?
- How to draw Horizontal line on Bar Chart Chartjs
- How to dynamically set ChartJs line chart width based on dataset size?
- ChartJS - how to display line chart with single element as a line? (not as a dot)
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to create a gantt chart using Chart.js and populate dates?
- Create Chart using Reactjs Chartjs and axios
- How to create chartjs chart with data from database C#
- How to create a stacked graph using ChartJS
- How to create a rounded rectangle using ChartJS
- annotation line not visible in scatter chart in chartjs
- How to create a variable for chart js datalabel plugin formatter
- How to make aspecific API call from within a Line Chart class in ReactJS using react-chartjs-2?
- How to display chart using Chartjs with JSON data in Laravel
- how to highlight a specific area on chartjs line chart
- How to update a chart using VueJS and ChartJS
- How to set dynamic value for horizontal line in annotation plugin for Chart.js
- How to highlight single bar in bar chart using Chartjs
More Query from same tag
- Converting Chart.js canvas chart to image using .toDataUrl() results in blank image
- Tooltip overriding the text in chart js
- How to create float charts with chartjs?
- Remove white space in ChartJS when value is null
- How can i retrieve and override presets chart.js option in angular selector?
- Change style of hover and tooltip in chartjs or ng2-charts
- syntax to loop through docs send from express router and use it to plot chart js
- line graph spot in the top middle of the bar graph
- how to highlight bar in ChartJS with onkeyup Input
- Chart js plugin annotation not working in vue
- Chart.js ignoring canvas height & width
- chart js with angular2 loading dynamic data only after zoomin
- Getting nice chart.js animation when adding data with unshift()?
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
- Move tooltip further from data point for Chart.js?
- Javascript in wordpress causes SyntaxError
- Chartjs-gauge create circumference until certain value from data
- Skip dates with no values in chart js
- Custom text in tooltip and legend: ChartJs
- Bar chart not starting at 0
- Charts.js graph not scaling to canvas size
- Chartjs - Donut Chart label for small values not visible
- How to draw a hover effect behind a bar chart?
- Charts not showing on ASP.NET MVC page
- Chart JS display Data Value on the top of the Bar
- how to change color of bar if its goes above avg score in mixed graph chart.js
- Remove Legends ChartsJS 2.8.0
- Set minimum step size in chart js
- Tooltip alignement with Chart.js v2
- Horizontal gradient for every single bar in group chart js