datasets: [
// {
// type: 'scatter',
// showLine: true,
// label: 'dca',
// data: this.data.map(x => x[2]),
// dragData: true,
// dragX: true,
// fill: false,
// borderColor: 'red', pointBorderColor: 'red',
// backgroundColor: 'red', pointBackgroundColor: 'red',
// spanGaps: true,
// borderWidth: 3,
// pointHitRadius: 25,
// },
{
label: 'Production',
data: this.data.map(x => x[1]),
dragX: true,
dragData: true,
fill: false,
borderColor: 'green', pointBorderColor: 'green',
backgroundColor: 'green', pointBackgroundColor: 'green',
spanGaps: true,
}
],
},
options: {
dragData: true,
dragX: true,
dragDataRound: 1,
dragOptions: {
showTooltip: true
},
scales: {
yAxes: [
{
id: 'y-axis',
type: 'linear',
ticks: {
reverse: false,
min: 0,
max: this.maxPoint[1] + (this.maxPoint[1] * 3)
},
dragData: true,
},],
xAxes: [
{
id: 'x-axis',
type: 'linear',
ticks: {
reverse: false,
},
dragData: true,
},]
},
plugins: {
pluginDragPoints
},
onDragStart: (e) => {
//console.log(e)
},
onDrag: (e, datasetIndex, index, value) => {
e.target.style.cursor = 'grabbing'
//console.log(datasetIndex, index, value)
},
onDragEnd: (e, datasetIndex, index, value) => {
e.target.style.cursor = 'default'
console.log(datasetIndex, index, value)
// if (index == 0)
// this.p1 = {
// x1: 'Red',
// y1: value
// };
// if (index == 1)
// this.p2 = {
// x1: 'Blue',
// y1: value
// };
},
hover: {
onHover: (e) => {
const point = this.dcaChart.getElementAtEvent(e)
if (point.length) e.target.style.cursor = 'grab'
else e.target.style.cursor = 'default'
}
}
}
}
let canvas: any = document.getElementById('chartJSContainer');
let ctx: any = canvas.getContext('2d');
this.dcaChart = new Chart(ctx, options);`