Class Interactions

  • All Implemented Interfaces:
    ChartsLifecycleListener

    public final class Interactions
    extends Object
    implements ChartsLifecycleListener
    Manages the chart interaction modes.
    With a custom interaction mode you can decide how and which elements will be managed interacting with chart events.
    Author:
    Andrea "Stock" Stocchero
    • Method Detail

      • get

        public static Interactions get()
        Singleton object to get the interactions instance
        Returns:
        interactions instance.
      • createExtendedInteractioner

        public Interactioner createExtendedInteractioner​(String mode,
                                                         ExtendedInteraction interation)
        Creates a Interactioner for a specific mode, passed as argument, and a native function already existing in java script code.
        Parameters:
        mode - new interaction mode
        interation - a native function already existing in java script code
        Returns:
        new Interactioner for a specific mode
      • createExtendedInteractioner

        public Interactioner createExtendedInteractioner​(String mode,
                                                         ExtendedInteraction interation,
                                                         boolean register)
        Creates a Interactioner for a specific mode, passed as argument, and a native function already existing in java script code.
        Parameters:
        mode - new interaction mode
        interation - a native function already existing in java script code
        register - if true, the new interaction mode will be automatically registered
        Returns:
        new Interactioner for a specific mode
      • createNativeInteractioner

        public Interactioner createNativeInteractioner​(String mode,
                                                       AbstractInjectableResource code)
        Creates a Interactioner for a specific mode, passed as argument, and a resource where the java script code, to implement the new interaction mode, is stored.
        Parameters:
        mode - new interaction mode
        code - a resource where the java script code is stored
        Returns:
        new Interactioner for a specific mode
      • createNativeInteractioner

        public Interactioner createNativeInteractioner​(String mode,
                                                       AbstractInjectableResource code,
                                                       boolean register)
        Creates a Interactioner for a specific mode, passed as argument, and a resource where the java script code, to implement the new interaction mode, is stored.
        Parameters:
        mode - new interaction mode
        code - a resource where the java script code is stored
        register - if true, the new interaction mode will be automatically registered
        Returns:
        new Interactioner for a specific mode
      • createNativeInteractioner

        public Interactioner createNativeInteractioner​(String mode,
                                                       String code)
        Creates a Interactioner for a specific mode, passed as argument, and a string which represents the java script code, to implement the new interaction mode.
        Parameters:
        mode - new interaction mode
        code - a string which represents the java script code
        Returns:
        new Interactioner for a specific mode
      • createNativeInteractioner

        public Interactioner createNativeInteractioner​(String mode,
                                                       String code,
                                                       boolean register)
        Creates a Interactioner for a specific mode, passed as argument, and a string which represents the java script code, to implement the new interaction mode.
        Parameters:
        mode - new interaction mode
        code - a string which represents the java script code
        register - if true, the new interaction mode will be automatically registered
        Returns:
        new Interactioner for a specific mode
      • createNativeInteractioner

        public Interactioner createNativeInteractioner​(String mode,
                                                       NativeInteraction callback,
                                                       boolean register)
        Creates a Interactioner for a specific mode, passed as argument, and a NativeInteraction which represents the java script function, to implement the new interaction mode.
        Parameters:
        mode - new interaction mode
        callback - a NativeInteraction which represents the java script function
        register - if true, the new interaction mode will be automatically registered
        Returns:
        new Interactioner for a specific mode
      • hasInteractionMode

        public boolean hasInteractionMode​(String name)
        Returns true if the mode is defined, otherwise false.
        Parameters:
        name - the name of interaction mode
        Returns:
        true if the mode is defined, otherwise false
      • getInteractionMode

        public IsInteractionMode getInteractionMode​(String name)
        Returns the interaction mode.
        If not exists, returns null.
        Parameters:
        name - the name of interaction mode
        Returns:
        the interaction mode.
        If not exists, returns null.
      • getInteractioner

        public Interactioner getInteractioner​(IsInteractionMode mode)
        Returns the interactioner.
        If not exists, returns null.
        Parameters:
        mode - the name of interaction mode
        Returns:
        the interactioner instance.
        If not exists, returns null.
      • register

        public void register​(Interactioner interactioner)
        Register the interaction mode to CHART.JS.
        Parameters:
        interactioner - interactioner instance to register
      • unregister

        public void unregister​(Interactioner interactioner)
        Unregister the custom interaction mode to CHART.JS.
        Parameters:
        interactioner - custom interaction mode instance
      • unregister

        public void unregister​(IsInteractionMode mode)
        Unregister the custom interaction mode to CHART.JS.
        Parameters:
        mode - custom interaction mode instance