Class ZoomPlugin


  • public final class ZoomPlugin
    extends AbstractExtensionPlugin<ZoomOptions>
    Entry point of ZOOM plugin to enable the plugin.
    The ZOOM plugin is highly customizable CHART.JS plugin that is zooming data of charts.
    The ZOOM plugin plugin has got a dependency with javascript utility hammer, utility used for gesture recognition.
    Author:
    Andrea "Stock" Stocchero
    • Field Detail

      • ID

        public static final String ID
        Plugin ID "zoom".
      • ZOOM_TRANSITION_MODE

        public static final TransitionKey ZOOM_TRANSITION_MODE
        Custom transition mode to update the chart by API, "zoom".
    • Method Detail

      • enable

        public static void enable()
        Inject the plugin but disables in the all charts waiting for the specific statement for each chart.
      • enable

        public static void enable​(boolean enableToAllCharts)
        Inject the plugin and by the argument decides to enable the plugin to all charts or not.
        Parameters:
        enableToAllCharts - by true the plugin will be enabled to all charts, otherwise false.
      • enable

        public static void enable​(boolean enableToAllCharts,
                                  boolean enableHammerInjection)
        Inject the plugin and by the argument decides to enable the plugin to all charts or not.
        Parameters:
        enableToAllCharts - by true the plugin will be enabled to all charts, otherwise false.
        enableHammerInjection - if false, HammerJs library will not be injected
      • getZoomLevel

        public static double getZoomLevel​(IsChart chart)
        Returns the zoom level when ZoomPlugin is activated.
        Parameters:
        chart - chart instance to invoke
        Returns:
        the zoom level
      • isZoomedOrPanned

        public static boolean isZoomedOrPanned​(IsChart chart)
        Returns whether the chart has been zoomed or panned, for instance whether the initial scale of any axis is different to the one used currently.
        Parameters:
        chart - chart instance to invoke
        Returns:
        true if the chart has been zoomed or panned
      • reset

        public static void reset​(IsChart chart)
        Reset the zoom of chart when ZoomPlugin is activated.
        Parameters:
        chart - chart instance to invoke
      • reset

        public static void reset​(IsChart chart,
                                 TransitionKey transition)
        Reset the zoom of chart when ZoomPlugin is activated.
        Parameters:
        chart - chart instance to invoke
        transition - update transition mode, could be null
      • pan

        public static void pan​(IsChart chart,
                               Amount amount)
        Pans the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of pan to apply
      • pan

        public static void pan​(IsChart chart,
                               Amount amount,
                               TransitionKey transition)
        Pans the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of pan to apply
        transition - update transition mode
      • pan

        public static void pan​(IsChart chart,
                               double amount)
        Pans the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of pan to apply
      • pan

        public static void pan​(IsChart chart,
                               double amount,
                               TransitionKey transition)
        Pans the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of pan to apply
        transition - update transition mode
      • zoom

        public static void zoom​(IsChart chart,
                                Amount amount)
        Zooms the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of zoom to apply
      • zoom

        public static void zoom​(IsChart chart,
                                Amount amount,
                                TransitionKey transition)
        Zooms the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of zoom to apply
        transition - update transition mode
      • zoom

        public static void zoom​(IsChart chart,
                                double amount)
        Zooms the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of zoom to apply
      • zoom

        public static void zoom​(IsChart chart,
                                double amount,
                                TransitionKey transition)
        Zooms the chart on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        amount - amount of zoom to apply
        transition - update transition mode
      • zoomScale

        public static void zoomScale​(IsChart chart,
                                     ScaleId scaleId,
                                     ScaleRange range)
        Zooms the chart scale on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        scaleId - scale id to zoom
        range - range (min/max) of scale to zoom
      • zoomScale

        public static void zoomScale​(IsChart chart,
                                     ScaleId scaleId,
                                     ScaleRange range,
                                     TransitionKey transition)
        Zooms the chart scale on demand, programmatically.
        Parameters:
        chart - chart instance to invoke
        scaleId - scale id to zoom
        range - range (min/max) of scale to zoom
        transition - update transition mode