score:0
chart.pluginservice.register({
afterdraw: function(chart) {
var ctx = chart.ctx;
chart.config.data.datasets.foreach(function (dataset) {
for (var i = 0; i < dataset.data.length; i++) {
var yaxe = chart.scales[chart.config.options.scales.yaxes[0].id];
ctx.strokestyle = "red";
ctx.beginpath();
ctx.setlinedash([10, 10]);
//value
lineat = yaxe.getpixelforvalue(200);
var model = dataset._meta[object.keys(dataset._meta)[0]].data[i]._model;
ctx.moveto(model.x - (model.width / 2), lineat);
ctx.lineto(model.x + (model.width / 2), lineat);
ctx.stroke();
}
});
}
});
Source: stackoverflow.com
Related Query
- How can I draw lines inside the bars in charts.js?
- Chart.js - Draw charts with opposite bars - How to set both the y-axis ends to positive number?
- How can I load multiple Chartjs charts with different data on the same page?
- How can I keep the vertical lines under the horizontal ruler line is chartjs?
- How can I display the percentage symbol inside the chartjs?
- How to draw the stroke behind bars in Chart.js?
- How can i add a calculated value on top of the bars in Chart.js?
- how can i add value on bar in the charts in chart.js vs 3.x
- how can i remove the grid lines in chartJs
- How can I calculate a value and place it inside the last bar in a Chart.JS bar chart?
- chart.js - How draw x and y axes lines on the left and bottom
- How can I give the automatically generated y-axis values on bar charts in Chart.JS commas?
- How can I display the percentage inside the graph and on hover?
- How can I draw a line to the highest datapoint in chart js?
- How can I change the starting point of horizontal bars in Charts.js
- How can I change the color of certain lines in chartjs / vue-chartjs?
- How to add text inside the doughnut chart using Chart.js?
- Chart.js Bar Chart: How to remove space between the bars in v2.3?
- How can I control the placement of my Chart.JS pie chart's legend, as well as its appearance?
- How can I make two of my lines in Chart JS thicker
- How can I increase the size of the pie (Chart.JS)?
- How can I draw dotted line using chartjs?
- How can I remove extra whitespace from the bottom of a line chart in chart.js?
- Chart.js - mixing bar and line graphs - can I get the lines to fill the full column?
- Chart js: how can I align the legend and the title
- How to use chart.js script to draw multiple pie Charts
- How can I display a set amount of ticks on the Y Axis?
- Chart.js canvas, how can I swap data without the previous data affecting my hover events?
- How can I display the xAxes and yAxes data in the tooltip, Chart JS?
- How can I trigger the hover mode from outside the chart with charts.js 2?
More Query from same tag
- Unable to Draw Chart using ChartJS
- Error when changing data after migrating to vue-chartjs 4
- How to take a set of Date objects and display the frequency based on time of day using ChartJS
- How to fill the gaps in an array of Dates with fixed length
- Chartjs background color multiple Dataset
- How to add a ChartPoint to a DataSet in Chart.js with TypeScript?
- Line Chart Js x-axis values all 0 on React
- C# How to print html Convas element in PDF document
- Chartjs xaxis labels auto decrease disabled
- Chart.JS how to change order of y-axis
- Stacked Group Bar from Chart.js : Can I give each stack group a unique color?
- ChartsJS Annotations Plugin - Can you create a tooltip to accompany an annotation?
- How could I put a string for the points on the x-axis?
- How to add text inside the doughnut chart using Chart.js version 3.2.1
- How do i programmatically set bar fillColor in chartJs + angular
- Merge two objects with different keys in chartjs bar
- How to rotate custom marker in chart.js?
- Mulitple canvas-images (by Chart.js) with toDataURL()
- Using chart.js in HotTowel , Angular.js
- set y-axis scale manually in a bar chart using angular-chart.js
- issue with customisation of Chart new.js for bar chart
- Chart JS: Use function in tooltip template
- Specifying the legendTemplate in Chart.js when using asp (classic)
- .destroy() generating error 'window.myChart.destroy()' is not a function
- Bar animations in 2.0.0-beta/dev are not working for me
- Chartjs xaxes tick min
- How to add an empty data point to a linechart on Chart.js?
- Center origin of a Scatter Chart
- Chartjs 2: Multi level/hierarchical category axis in chartjs
- (Lifecycle problem?) React Chart js-2 not updating data from componentDidMount