double toDataY(double canvasY) { if (height == 0) return dataMinY; return dataMinY + (1 - (canvasY - top) / height) * (dataMaxY - dataMinY); }