6 Replies Latest reply on Apr 17, 2019 8:55 PM by SeanRobinson

    Loading a chart with certain series 'unchecked'.

    Lee Burgess

      I am using a (dynamically rescaling) donut chart on 18.2 and I would like to load the chart with one of the series 'unchecked' like this:

      I can't see how to do this. Is this possible?

        • 1. Re: Loading a chart with certain series 'unchecked'.
          Oleh Tyshchenko

          JET chart supports such feature but as far as I know there is no declarative option for this. So add this to your chart's Advanced JavaScript Initialization Code attribute

          function( options ){
              options.hiddenCategories = ["Closed"];
              return options;
          }
          
          1 person found this helpful
          • 2. Re: Loading a chart with certain series 'unchecked'.
            Lee Burgess

            Excellent, this worked perfectly. Thank you!

            • 3. Re: Loading a chart with certain series 'unchecked'.
              Hilary Farrell-Oracle

              That's correct, Oleh,

               

              We don't provide declarative support for that behaviour - but I added an example to my sample app last summer, to demostrate the use of the hiddenCategories attribute:

              https://apex.oracle.com/pls/apex/f?p=36648:157

               

              Regards,

              Hilary

              1 person found this helpful
              • 4. Re: Loading a chart with certain series 'unchecked'.
                SeanRobinson

                Hilary,

                 

                Thank you for your answer and your sample app page.  I am four weeks into using APEX, so examples like yours are extremely helpful.  I have a situation similar to Oleh's, but I need to determine the hidden categories based on an item's setting on a different page.  For instance, with Oleh's example, a user would select the categories he/she is interested in on a different page, i.e., Active, Construction, and Scheduled, then when the page with the chart loads, the Javascript would set the hidden categories based on the user's selections.  Is this possible using the Javascript Initialization or perhaps a pre-rendering process?

                 

                Thanks in advance!

                • 5. Re: Loading a chart with certain series 'unchecked'.
                  Hilary Farrell-Oracle

                  Hi Sean,

                   

                  To get a clearer understanding of what you're trying to achieve,  some additional information on how you're retrieving the options from the user, and how you're saving them, would be helpful - or better still, provide a link to a testcase on apex.oracle.com.

                   

                  Lets say you save the user choices as a comma-delimited list e.g. 'Closed,Suspended'.  Then on your chart page, you could create a Hidden page item, e.g. PX_CHOICES,  and set its source to the value of the user choices - which you might be retrieving from a table in your schema.  Your chart initialization code could then reference that page item, in order to set the hidden categories - ensuring that you pass an array to the JET attribute 'hiddenCategories'.

                   

                  function( options ){
                      
                      // Retrieve the user choices from page item PX_CHOICES - which is returning a comma-delimited list of choices e.g. 'Closed,Suspended'
                      var hiddenCategories = $v('PX_CHOICES');
                      
                      // Set 'hiddenCategories' attribute - ensuring the value is passed as an array, by using the split method e.g. ["Closed","Suspended"]
                      // See https://www.w3schools.com/jsref/jsref_split.asp if unfamiliar with the use of split
                      options.hiddenCategories = hiddenCategories.split(",");
                      
                      // Set chart initialization options
                      return options;
                  }
                  
                  

                   

                  Regards,

                  Hilary

                  • 6. Re: Loading a chart with certain series 'unchecked'.
                    SeanRobinson

                    Hi Hilary,

                     

                    Thank you!!!! The piece I was missing was the split method.  I ended up with a slightly different requirement, but your solution still worked perfectly.  I actually ended up needing the user selection from a radio group (with a small number of static values) on one page to identify the series to show on a line chart on a different page, instead of which series to hide.  I used a hidden item on the chart page to capture the radio group selection using PL/SQL in an After Header process.  Within the process I also set the series to hide (using IF-THEN-ELSIF conditions), which I stored in a different hidden item on the chart page.  I then used the second hidden item in the chart's Javascript Initialization Code using the function you provided.  I just had to change 'PX_CHOICES'  to my hidden item's name, and it worked flawlessly.

                     

                    Perhaps there is an easier or more elegant solution, but this works as needed.  Thank you again for your assistance!

                     

                    Regards,

                    Sean