ZingChart: Can I hide items in the context menu like "View Source"?

You can remove or add most items in the context menu using the behaviors array in your gui object.  Enable or disable each item of interest by indicating the id of the built-in behavior and setting enabled to none  

behaviors:[ //default contextMenu behaviors
        {
          id: "Reload", //built-in id
          enabled:"all" //sets visibility to show 
        },
        {
          id: "SaveAsImage",
          enabled:"all"
        },
        {
          id: "DownloadPDF", //built-in id
          enabled: "all" //sets visibility to show
        },
        {
          id: "DownloadSVG",
          enabled: "all"
        },
        {
          id: "Print", 
          enabled: "all"
        },
        {
          id: "ViewSource", //built-in id 
          enabled: "none" //sets visibility to hide
        },
        {
          id: "About ZingChart" //removed with licensing
        }
      ] 
  }

Note: You can only remove the About ZingChart item with a paid license.


To add choices to the context menu add an object to the customItems  array that contains the text  for the menu and a function  to run when the item is selected.

contextMenu: {
      customItems:[
          {
            text:"Click Me", //button text
            "function": "someCode()" //custom function to fire from button click 
          }
        ]
    }

Example: https://demos.zingchart.com/view/B2Q6S9UU

Documentation

Context Menu Tutorial
GUI Object JSON Syntax
behaviors JSON Syntax
contextMenu JSON Syntax
customItems JSON Syntax

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us