local2Chart static method

MPPointF local2Chart(
  1. Controller<ChartPainter<ChartData<IDataSet<Entry>>?>> controller,
  2. double x,
  3. double y, {
  4. bool inverted = false,
})

Implementation

static MPPointF local2Chart(Controller controller, double x, double y,
    {bool inverted = false}) {
  ViewPortHandler vph = controller.painter!.viewPortHandler!;

  double xTrans = x - vph.offsetLeft();
  double yTrans = 0.0;

  /// check if axis is inverted
  if (inverted) {
    yTrans = -(y - vph.offsetTop());
  } else {
    yTrans =
        -(controller.painter!.getMeasuredHeight() - y - vph.offsetBottom());
  }

  return MPPointF.getInstance1(xTrans, yTrans);
}