Class ChartPositionConverter


  • public final class ChartPositionConverter
    extends Object
    Converts canvas coordinates of chart images into model ones and back.
    • Method Detail

      • canvasToChartModelRectangle

        public static DoubleRect canvasToChartModelRectangle​(org.eclipse.swt.graphics.Rectangle canvasRect,
                                                             int canvasWidth,
                                                             int canvasHeight)
        Converts canvas rectangle into model coordinates of a chart image.
        Parameters:
        canvasRect - the canvas rectangle to convert
        canvasWidth - the width of the whole canvas
        canvasHeight - the height of the whole canvas
        Returns:
        the chart model's rectangle, never null
      • chartModelToCanvasRectangle

        public static org.eclipse.swt.graphics.Rectangle chartModelToCanvasRectangle​(DoubleRect modelRect,
                                                                                     int canvasWidth,
                                                                                     int canvasHeight)
        Converts chart model's rectangle into canvas coordinates of a chart image.
        Parameters:
        modelRect - the chart model's rectangle to convert
        canvasWidth - the width of the whole canvas
        canvasHeight - the height of the whole canvas
        Returns:
        the canvas rectangle, never null