Selection

12 May 2017 / 4 minutes to read

EjSunburstChart provides selection support for the points on mouse click. To enable the selection , set the enable property to true in the selectionSettings.

  • js
  • "use strict";
    var selectionSettings = { enable: true };
    ReactDOM.render(
        <EJ.SunburstChart id = "sunburst1"      
        selectionSettings ={selectionSettings}    
        >                  
        </EJ.SunburstChart>,
              document.getElementById('sunburst')
    );

    Selection Display mode

    You can customize the selected segment appearance by using color or opacity. You can choose between color or opacity using the type property in the selection Settings.

    • selectionByColor – To display the selected segment appearance using color.
    • selectionByOpacity – To display the selected segment appearance using opacity.
  • js
  • "use strict";
    var selectionSettings = { enable: true, type:"color",color:"red" };
    ReactDOM.render(
        <EJ.SunburstChart id = "sunburst1"      
        selectionSettings ={selectionSettings}    
        >                  
        </EJ.SunburstChart>,
              document.getElementById('sunburst')
    );

    Selection Mode

    Sunburst chart provides multiple options to represent the selected categories. You can select the segment categories by using the mode property in selectionSettings

    • Child – To selection the child of selected parent.
    • All – To selection the entire categories in group.
    • Parent – To selection the parent of selected child.
    • Single - To selection single item in the category.

    Child

    The following code shows how to set the selection type as child

  • js
  • "use strict";
    var selectionSettings = { enable: true,mode:"child"};
    ReactDOM.render(
        <EJ.SunburstChart id = "sunburst1"      
        selectionSettings ={selectionSettings}    
        >                  
        </EJ.SunburstChart>,
              document.getElementById('sunburst')
    );

    Parent

    The parent mode can be enabled by using the below code

  • js
  • "use strict";
    var selectionSettings = { enable: true,mode:"parent"};
    ReactDOM.render(
        <EJ.SunburstChart id = "sunburst1"      
        selectionSettings ={selectionSettings}    
        >                  
        </EJ.SunburstChart>,
              document.getElementById('sunburst')
    );

    Point

    To selection the particular segment, the point mode of the selection settings is used.

  • js
  • "use strict";
    var selectionSettings = { enable: true,mode:"point"};
    ReactDOM.render(
        <EJ.SunburstChart id = "sunburst1"      
        selectionSettings ={selectionSettings}    
        >                  
        </EJ.SunburstChart>,
              document.getElementById('sunburst')
    );

    All

    The following code snippet is used for the all mode of selection settings

  • js
  • "use strict";
    var selectionSettings = { enable: true,mode:"all"};
    ReactDOM.render(
        <EJ.SunburstChart id = "sunburst1"      
        selectionSettings ={selectionSettings}    
        >                  
        </EJ.SunburstChart>,
              document.getElementById('sunburst')
    );

    Click here to view the online demo sample of Selection in the Sunburst Chart