このことができます場合は、私がconfigutation
Chart.plugins.register({
config: {
/** @type {rbg|rgba|hex} Stroke color */
strokeColor: "rgb(255, 0, 0)",
/** @type {int} Column width */
lineWidth: 1,
},
afterDatasetsDraw: function(chartInstance, easing) {
var value = chartInstance.config.lineAtValue;
if (typeof value === 'undefined') return;
var ctx = chartInstance.chart.ctx,
xaxis = chartInstance.scales['x-axis-0'],
yaxis = chartInstance.scales['y-axis-0'];
ctx.save();
ctx.beginPath();
ctx.moveTo(xaxis.left, yaxis.getPixelForValue(value));
ctx.lineWidth = this.config.lineWidth;
ctx.strokeStyle = this.config.strokeColor;
ctx.lineTo(xaxis.right, yaxis.getPixelForValue(value));
ctx.stroke();
ctx.restore();
},
// IPlugin interface
afterDatasetsUpdate: function(chartInstance) {},
afterDraw: function(chartInstance, easing) {},
afterEvent: function(chartInstance, event) {},
afterInit: function(chartInstance) {},
afterScaleUpdate: function(chartInstance) {},
afterUpdate: function(chartInstance) {},
beforeRender: function(chartInstance) {},
beforeDatasetsDraw: function(chartInstance, easing) {},
beforeDatasetsUpdate: function(chartInstance) {},
beforeDraw: function(chartInstance, easing) {},
beforeEvent: function(chartInstance, event) {},
beforeInit: function(chartInstance) {},
beforeUpdate: function(chartInstance) {},
destroy: function(chartInstance) {},
resize: function(chartInstance, newChartSize) {},
});
のいくつかの並べ替えを有効2.3.0プラグイン可能にする@Ptournem答えを書き換えます