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();
            }
        });
    }
});

Related Query

More Query from same tag