How to control chart ui options using client script on chart level?

Venu_Bachwale
edited February 11, 2022 in Analytics #1

Hi,
Below are ui options to control chart interactivity from viewer object;
var uioptions = viewer.getUIOptions( );
uioptions.enableToolBar(true);
uioptions.enableChartSubType(false);
uioptions.enableEditReport(false);
uioptions.enableFormat(false);

I need them on chart level; example if my report holds two chart, I want to enable these in one right side chart only;
I am expecting these can be set, in client script example beforeDrawAxis, beforeGeneration etc
Please help me giving some sample

Comments

  • hi @jfranken
    can you please help me in this regards

  • Hi Venu,

    In the properties for the chart, go to "Bookmark" and add a unique identifier like "myChart1" including the quotes. In the script, get the viewer using the bookmark as the argument:

    var viewer =actuate.getViewer("myChart1");

    I have not tried to dynamically modify those settings, so I don't know if a command like uioptions.enableEditReport(false) works for an individual chart element.

    Warning No formatter is installed for the format ipb
  • Hi @jfranken
    Yes, my point was specific to uioptions, controlling in chart events life beforeRendering ( options....chart...) at client side?

  • uioptions is applied to the viewer overall, and not specific elements within the viewer. You can technically grab the viewer and modify uioptions in any script that is run clientside on the user's browser, but any changes made will be global to the viewer.

    If you aren't wanting the changes to be global, each chart would have to be contained in its own viewer by making a custom webpage.

    Warning No formatter is installed for the format ipb
  • @Chad Montgomery said:
    uioptions is applied to the viewer overall, and not specific elements within the viewer. You can technically grab the viewer and modify uioptions in any script that is run clientside on the user's browser, but any changes made will be global to the viewer.

    If you aren't wanting the changes to be global, each chart would have to be contained in its own viewer by making a custom webpage.

    Good point. I was assuming that the charts would be in a custom webpage with separate viewers given the way the question was worded, but it is not stated so it is good to clarify the different scenarios. One additional point is that while the chart script runs on the client, the keywords "this" and "actuate" cannot be used in conjunction with the getViewer() method inside the chart scripting events. The script is run outside of the scope where those references are valid. I could not find an example that gets the viewer in the chart script. Maybe Chad has an example. Is it necessary to put the viewer UI calls in the chart script?

    Warning No formatter is installed for the format ipb
  • Hi @Chad Montgomery If I need control at each chart level within single report(not ready to use custom webpage), is it possible technically in iHub/birt to give provision to control on chart level?
    .....so that I can raise FR!