Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: Control Axis for Charts

  1. #1

    Default Control Axis for Charts

    Hi,
    how to control the axis (measures) for a chart.
    As of now the maximum and minimum axis value are automatically controlled.
    is there any way to to define the maximum and minimum axis value and also the range of the axis.

    Also, is it possible to define the maximum and minimum axis value based on the query results value



  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    The main options that affect the scale used by the ortho(gonal) axis are:



    See additional properties at http://www.webdetails.pt/ctools/ccc....=chart-options.

    If you want to calculate any of these properties based on the data, you would do it before creating the charts, in the postFetch handler, for example.
    Also, if these depend on user interaction with a rendered chart, you can change the chart options and re-render the chart.

  3. #3
    Join Date
    May 2013
    Posts
    12

    Default

    me too looking for a measure to control the axis of the chart here any help would be appreciated here
    .

  4. #4

    Default

    Hi,

    i have tried ortho options but i am not getting .please can you give me one example for postFetch handler

  5. #5
    Join Date
    Mar 2012
    Posts
    645

    Default

    For example, place this in the "postFetch" CDE property:

    Code:
    function f(cdaData) {
       // The CCC chart options object
       var options = this.chartDefinition;
       
       // Don't force _0_ to be added to the domain
       options.orthoAxisOriginIsZero = false;
    
       // Whatever are the real domain bounds, 
       // show this extent in the ortho axis.
       // You _can_ set these to any values calculated from _cdaData_.
       options.orthoAxisFixedMin = 50;
       options.orthoAxisFixedMin = 200;
    
       return cdaData;
    }

  6. #6

    Default

    Hi,

    How to iterate cdadata for checking minimum and maximum query values.i tried below one but i am not getting the value

    $("#servicetypebarchartObject").text(cdaData.resultset[0][0]);

    this one returns the object instead of value

    please can you help me..

  7. #7
    Join Date
    Mar 2012
    Posts
    645

    Default

    The way you do it really depends on whether the data is in crosstab format or not, and, in that case, if you have series in rows or not, on the number of "row" columns...

    For the simplest crosstab resultset, containing data for 1 Category, 1 Series and 1 Value dimension, the resultset would be an array of rows with the following structure and data:

    Code:
        |-  S1    S2   S3 |  (series values are in the cdaData.metadata)
     i\j|0  1     2    3  |
    ======================
     0 [[C1, V11, V12, V13],
     1  [C2, V21, V22, V23],
     2  [C3, V31, V32, V33],
     3  [C4, V41, V42, V43]]
    Finding the min and max is a matter of traversing all Vij values:
    Code:
    var min, max;
    var C = cdaData.metadata.length; // number of columns of each row
    var resultset = cdaData.resultset;
    var R = resultset.length; // number of rows
    for(var i = 0 ; i < R ; i++) {
       var row = resultset[i];
       for(var j = 1 ; j < C ; j++) { // 1st column is the category
          var v = row[j];
          if(v != null) {
              if(min == null) {
                 min = max = v;
              } else {
                 if(v < min) { min = v; }
                 if(v > max) { max = v; }
              }
          }
       }
    }
    
    // when no rows, min and max will be both null.
    // if all values are null, min and max will also be null.
    Does this suit your case?

  8. #8

    Default

    many many Thanks its working fine

  9. #9

    Default

    Quote Originally Posted by duarte.leao View Post
    For example, place this in the "postFetch" CDE property:

    Code:
    function f(cdaData) {
       // The CCC chart options object
       var options = this.chartDefinition;
       
       // Don't force _0_ to be added to the domain
       options.orthoAxisOriginIsZero = false;
    
       // Whatever are the real domain bounds, 
       // show this extent in the ortho axis.
       // You _can_ set these to any values calculated from _cdaData_.
       options.orthoAxisFixedMin = 50;
       options.orthoAxisFixedMin = 200;
    
       return cdaData;
    }

    Thank You So Much!!!!

    Pentaho 7.1 & CTools

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.