2 Replies Latest reply: Mar 30, 2012 4:06 AM by MikeFlanagan RSS

    Dynamically setting axis properties in a scatter chart

      Hi all

      This is my first post here. I've only been 'qlickviewing' a matter of weeks really, but I've already found these forums an invaluable resource. Here's a question though that I've not previously seen answered...

      I've set up a scatter chart which I'm using VBScript to modify on the fly, depending on user input. This is all working fine but there are a couple of chart properties that I've been unable to modify, even after a good trawl through the API guide.

      1. I want to set the size of the axes myself, rather than use Qlikview's automated sizing.

      2. A rather more minor concern this one. When adding a new expression, is it possible to programmatically select 'Label Along Axis' for my y-axis.

      If anyone can make any suggestions of how to achieve these via script (or even just confirm its not possible) I'd be most grateful.

      Many thanks,

      Mike

       

       

        • Dynamically setting axis properties in a scatter chart

          Mike:

           

          Were you able to figure out how to set the chart properties dynamically? I am trying to set the chart axes position as right but not sure how to achieve the same.

           

          Any help will be appreciated.

           

          Thanking you

           

          Preethi

            • Dynamically setting axis properties in a scatter chart

              Hi Preethi

               

              Things have moved on.  I don't even recall if I ever resolved the 'Label Along Axis' issue.  But I did find a resolution to dynamically setting the expression axis.  I probably got the idea from a thread here (can't remember now), but FWIW here's my code for controlling the minimum value of the expression axis. In the chart properties go to the Axes tab and check the 'Static Min' option then apply the following 'value'. 

               

              //EXPRESSION FOR DYNAMIC AXIS

              if(

                   floor(

                        min(

                             aggr(

                                  //Expression starts here

                                  **********************************

                                  //Expression ends here

                                                 

                                  //Reduction amount for cases when all values = maximum value

                                  -1

                                  ,

                                  //Dimension starts here

                                  *********************************

                                  //Dimension ends here

                             )

                        )

                        ,

                        //Size of step to round to

                       10

                   )

                   //Minimum value for which you want to apply the dynamic min

                   >40

                   ,

                   floor(

                        min(

                             aggr(

                                  //Repeat expression starts here

                                 **********************************

                                  //Repeat expression ends here

                                                 

                                  //Reduction amount for cases when all values = maximum value

                                  -1

                                  ,

                                  //Repeat dimension starts here

                                  **********************************

                                  //Repeat dimension ends here

                              )

                        )

                        ,

                        //Repeat size of step to round to

                       10

                   )

                   ,

                   0

              )

               

              Looking back at this now it doesn't seem very elegant, I think I'd write it differently now but it does work.  Paste your expression and dimension over the relevant asterisks.  You'll also note there are a couple of other factors built in  - this one rounds the axis to multiples of 10 and is only applied where the minumum expression value is 40 (I use this specifically for expressions that are percentages - I figure if there's a value of less than 40 then I might as well show the axis as 0-100%).

               

              Mike