Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: CCC Bullet Chart: dynamic max range

  1. #1
    Join Date
    Feb 2011
    Posts
    840

    Default CCC Bullet Chart: dynamic max range

    So, following Duarte's advice, here's a new thread to ask: how do I make the max range of a bullet bar dynamic? So thing like this doesn't happen on me:
    Name:  2014-09-11_15h37_03.png
Views: 103
Size:  4.0 KB
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    this lousy extension point code did it in my test case:
    Code:
    bulletPanel_ranges: function(d) {
         var max = Math.max(pv.max(d.markers), pv.max(d.measures));
    
         var ranges = d.ranges;
         if(!ranges || !ranges.length) return [max];
    
         
         max = Math.max(max, pv.max(ranges));
        
         ranges = ranges.slice().sort();
         ranges[ranges.length - 1] = max;
    
    
         return ranges;
    }
    Does not fix the "formattedRanges" array, that maybe you don't use, and it also makes the assumption that the markers and measures are there...or NaN may arise...
    Last edited by duarte.leao; 09-11-2014 at 05:22 PM. Reason: added sort to ranges array

  3. #3
    Join Date
    Feb 2011
    Posts
    840

    Default

    ok, even after the edit, rememeber that sort was messing things up, the problem was the presence of nulls. So i'll just put here the code that worked in the end, so if anyone ever need this...

    Code:
    bulletPanel_ranges: function(d) {
            var max = Math.max(pv.max(d.markers), pv.max(d.measures));
        
            var ranges = d.ranges.filter(function(v){ return v != null; }) ;
            if(!ranges || !ranges.length) return [max];
        
            max = Math.max(max, pv.max(ranges));
            
            ranges = ranges.slice();
            ranges[ranges.length - 1] = max;
        
        
            return ranges;
        }
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

  4. #4
    Join Date
    Mar 2012
    Posts
    645

    Default

    Thanks João,

    I didn't edit the example because I couldn't reproduce the problem you described when the sort() is used.
    The null filtering, however, is a good guard.

  5. #5

    Default

    Hello Duarte,

    Please, and if I want to make the minimal value dynamic (not just zero). Is it possible?

    Thank you very much!

  6. #6
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi Leandro,

    as explained in this thread, it should be a matter of setting the extension point "bulletPanel_originIsZero" to boolean false.
    Note that you need to set this in preExecution, as in the extension points property dialog it will be interpreted as string "false", which, is considered true...
    Code:
    function f() {
       this.chartDefinition.bulletPanel_originIsZero = false;
    }


    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.