Other options and customizations

These custom options are intended for very specific customers and situations. Only if you have been advised to do so by the Plotly team, select Enable Plotly Customizations or Enable Docker Customizations and enter any provided code. Otherwise, leave this option unchecked.

Customize the React Chart Editor (RCE)

Dash Enterprise now supports allowing non-admin users to disable/enable RCE controls based on plotly.js full attribute paths or control names. To use this feature:

  1. Create a custom_config.json file containing a visibility_rules key, which in turn contains one of the following keys: blacklist or whitelist

    • Blacklist: specify regex rules to run against a plotly.js attribute string or control name and exclude matches from the editor

      • If a plotly.js full path attribute string matches any of the rules in the blacklist array, the corresponding control will not show up in the editor

      • You can add exceptions to your rule, as well as exceptions to exceptions

      • Example custom_config.json file with a blacklist rule:

        {
          "visibility_rules": {
             "blacklist": [
                {
                "type": "attrName",
                "regex_match": "color",
                "exceptions": [
                   {
                      "type": "attrName",
                      "regex_match": "marker.color",
                      "exceptions": [
                      {
                         "type": "controlType",
                         "regex_match": "ColorPicker"
                      }
                      ]
                   }
                ]
                }
             ]
          }
        }
    • The above:

      • Hides all controls with the color string in their plotly.js full attribute path

      • Does not hide controls with marker.color in their full attribute path (an exception to the blacklist rule)

      • Hides ColorPicker controls (an exception to the blacklist rule’s exception)

    • Whitelist: similar logic applies as above; this rule lists the only attributes that should show, as opposed to the attributes that should be hidden

    • Example custom_config.json file with a whitelisting rule:

      {
         "visibility_rules": {
            "whitelist": [
               {
               "type": "attrName",
               "regex_match": "color",
               "exceptions": [
                  {
                     "type": "attrName",
                     "regex_match": "marker.color",
                     "exceptions": [
               {
                        "type": "controlType",
                        "regex_match": "ColorPicker"
               }
                     ]
                  }
               ]
               }
            ]
         }
      }
    • The above will:

      • Show all controls with that have the color string in their plotly.js full attribute path

        • Hide the ones that have marker.color in their full attribute path

        • Show ColorPicker controls even if they have the marker.color string in their attribute path

    • Exceptions/rules format: both exceptions and rules are objects that must have a type key and a regex_match key

    • The possible type keys are:

      • attrName (if you want to add a rule or exception based on a plotly.js attribute path)

      • controlType (if you want to add a rule based on an RCE control Type).

    • The regex_match key should be a regular expression string to compare against your plotly.js attribute paths or component displayNames

      • All valid regex strings are supported

    • If either the type or regex_match key are omitted in your rule or exception, your custom_config.json file will be considered invalid and no rules will be applied

  2. Ensure your file is properly formatted as JSON and copy it into a /plotly/rce directory on your server (create it if it does not already exist)

When this is complete, your custom rules will be applied when using the chart editor as a non-admin user.

Last updated