Cursor with “corner” crosshair lines

This demo shows how we can use adapters to make lines of the XY cursor go only to the target data item.

Code

cursor.lineX.adapters.add("y", function(y) {
  return cursor.lineY.y();
});

cursor.lineY.adapters.add("x", function(x) {
  return cursor.lineX.x() - chart.plotContainer.width();
});
cursor.lineX.adapters.add("y", function(y) {
  return cursor.lineY.y();
});

cursor.lineY.adapters.add("x", function(x) {
  return cursor.lineX.x() - chart.plotContainer.width();
});

Demo

See the Pen Cursor with "corner" crosshair by amCharts team (@amcharts) on CodePen.

Posted in Uncategorized