4 Replies Latest reply: Sep 19, 2016 11:24 AM by Richard Bartley RSS

    ObjectId of on-the-fly visualizations

    Richard Bartley

      Hi all,

       

      I have sucessfully implemented the toggle charts example posted on a Qlik blog by Yianni Ververis (see link below)

      Mashup Editor - Toggle charts with jquery

       

      This works well for visualizations that are in the underlying Sens eapp, but I am creating a number of visualizations on the fly using the create method of the Visualization API, so does anyone know how I can get the objectID of an on-the-fly visualization?

       

      Thanks in advance.

        • Re: ObjectId of on-the-fly visualizations
          Richard Bartley

          I managed to get this to work by creating the visualization on the radio button change event as follows:

           

          "

          $( document ).ready(function() {

              $("input[name='chart']").change(function(obj){

             

              $('#QV05').fadeOut('fast', function(){

           

                  if(obj.target.value=="Chart1")

                  {

                  app.visualization.create('linechart',["Price Month","MS","=Avg([Price Eur 100KG])"],

                      {

                      "title":"Average price by Member State (€/100kg)"

                      }

                      ).then(function(vis){

                          vis.show("QV05");

                          });

                     

                  }   

                  else

                  {

                     

                  app.visualization.create('linechart',["EU Price Month","EU Price Product Name","=Avg([EU Price Eur 100KG])"],

                              {"title":"Average price by Product (€/100kg)"}

                          ).then(function(vis){

                              vis.show("QV05");

                              });

                     

                  }

           

              $('#QV05').fadeIn('fast');

                      });

                  });

              });

          "

           

          However, I would still be interested to hear whether it is possible to get the objectid of an on-the-fly visualization.

          • Re: ObjectId of on-the-fly visualizations
            Richard Bartley

            Thanks Alexander,that worked for me. I was able to set the radio button value with the id of the on-the-fly visualization

             

            app.visualization.create('listbox',["MS"],

                    {"title":"MS"}

                    ).then(function(vis){

                    listboxID=vis.id;

                    radioButton = document.getElementById('chart2');

                      //where chart2 is the id of the second element in the radio button group

                    radioButton.value=listboxID;

                    });