Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Help with Paired Bar-Line Example on webdetails site (in CDE)

  1. #1
    Join Date
    Apr 2011
    Posts
    159

    Default Help with Paired Bar-Line Example on webdetails site (in CDE)

    In trying to use this example:
    http://www.webdetails.pt/ctools/ccc....-line-measures

    and am not sure how (if possible) to correlate some of the fields in the example code (which is, really really awesome, btw, that these examples exist. if you are new and want to learn, visit this site and try to build these examples, for the love...)

    so the issue I have is I'm not editing the cdfde files (just using CDE and things like 'pre-execution') and not sure how to implement these portions of the example:
    readers: ['measure, series, category, value'],

    dimensions: {
    // Explicitly define the "measure" dimension
    // (change the defaults that would
    // otherwise take effect)
    measure: {
    // If you want to hide the special
    // "measure" dimension from the tooltip:
    isHidden: true,

    // Fine tune the labels
    formatter: function(v) {
    switch(v) {
    case 'Count':
    return "Count";
    case 'AvgLatency':
    return "Avg. Latency";
    }
    return v + '';
    }
    }
    },

    etc...
    Do I wrap it in a function in pre-execution? Example of how to do this?

    Edit the cdfde file?

    As always, many thanks for this awesome tool.

  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    Thanks, for the compliments. The CCC team rejoices :-)

    Not every CCC property is mapped as a CDE property of the CDE chart components. In this cases you can configure this in one of the CDE components handlers: preExecution and postFetch. In choosing between the two, "postFetch" is usually the best choice because: it allows you to take the data that will feed the chart into account and it's the only CDE handler that is also ran in the CGG server environment (for printing).

    EDIT (2014-10-04): CGG already also supports preExecution and postExecution handlers.

    Place this in the postFetch CDE property JavaScript code editor window:
    Code:
    function f(cdaData) {
        // Look at and change cdaData if necessary
        
        // Add/Change the chart definition that is sent to CCC (already built with the specified CDE properties)
        var cccOptions = this.chartDefinition;
        cccOptions.readers = ['a, b, c'];
        
        cccOptions.dimensions = {
             a: {valueType: Number}
        };
    
        // etc
    
       // Lastly, return the possibly new/changed cdaData
       return cdaData;
    }
    There's a catch there. The cccOptions.extensionPoints in this phase do not yet have the final CCC format of {extensionpoint: value, ...}. They are in a [["extensionPoint", value], ...] format still. So to use or change this, you'd better use two existing Dashboards functions that translate between the two formats: Dashboards.propertiesArrayToObject and back by Dashboards.objectToPropertiesArray.

    Have fun and keep giving us feedback.
    Last edited by duarte.leao; 04-10-2014 at 01:53 PM.

  3. #3

    Default

    Hi, how should be formated the Dataset to use this type of graphic?

  4. #4
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi, here's the dataset used in the example:
    https://github.com/webdetails/ccc/bl...01-01.js#L1890

    Code:
    var testMeasureDiscrim = {
        "metadata":[
            {colName: "City",       colType: "STRING" },
            {colName: "Period",     colType: "STRING" },
            {colName: "Count",      colType: "NUMERIC"},
            {colName: "AvgLatency", colType: "NUMERIC"}
        ],
        resultset: [
            ['London', 'Jan', 35000,  141.3],
            ['London', 'Apr', 40000,  120.12],
            ['London', 'Jul', 45000,  115.6],
            ['London', 'Oct', null,   110.37],
            ['Paris',  'Jan', 70000,  null],
            ['Paris',  'Apr', 80000,  180.9],
            ['Paris',  'Jul', 115000, 170.7],
            ['Paris',  'Oct', 45000,  145.5],
            ['Lisbon', 'Jan', 70000,  200.7],
            ['Lisbon', 'Apr', 90000,  190.3],
            ['Lisbon', 'Jul', 120000, 180.2],
            ['Lisbon', 'Oct', 30000,  130.067]
        ]
    };

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.