Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Which extention point for setting periods for moving average trendline

  1. #1
    Join Date
    May 2013
    Posts
    5

    Default Which extention point for setting periods for moving average trendline

    I'm trying to set an extension point in CDE to change the periods for a moving average trend line

    {string} type
    The type of trend to perform on the data of the associated plot.
    The specified trend type must have been previously defined in the CCC library, through the pvc.trends.define method.
    Some trend types come with the CCC library. Currently these are:
    'linear'
    performs a simple linear regression (see http://en.wikipedia.org/wiki/Simple_linear_regression)
    'moving-average'
    performs a simple moving average (see http://en.wikipedia.org/wiki/Moving_average); the additional option periods may be specified to control the number of data points of the average window.
    'weighted-moving-average'
    performs a weighted moving average (see http://en.wikipedia.org/wiki/Moving_average); the additional option periods may be specified to control the number of data points of the average window

    I've tried adding an extension point called 'trend_periods', 'trend_moving-average_periods' and 'trend_moving-average.periods'

    Does anyone have any idea what the format should be?

  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi

    that's not very clearly documented is it?... Will fix that.

    In the mean time, here's how to do it. Place this in the chart's "postFetch" handler:

    Code:
    function f(){
        this.chartDefinition.trend = {
             type:     'moving-average', 
             periods: 4    // default is 3, minimum is 2
        };
    }
    Note that CCC's trending system is extensible. New trend types can be defined through "pvc.trends.define", as you said. Each trend type may and most probably will have an arbitrary set of configuration options. These extra options are supplied like the "periods" option above.

  3. #3
    Join Date
    May 2013
    Posts
    5

    Default

    Perfect! Thank you very much.

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.