Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: When chart loads, have data point selected.

  1. #1

    Default When chart loads, have data point selected.

    I have a cccv2 bar chart with "selectable" turned on. I need the first bar of the chart to be selected when the chart is loaded.
    In other words, I need to simulate a click or selection on a bar chart using code.

    Is there a way to implement this in cde/cdf?




    Thanks!

  2. #2
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    the best way to do this is in the "renderCallback" action (exists as CDE property):

    Code:
    renderCallback: function(){
        // Obtain datums to be selected.
        // * all datums whose 'series' dimension has value 'London' and "category" dimension is "2013-02-24"
        var datums = this.chart.data.datums([{series: 'London', category: "2012-02-24"}]);
    
    
        // Select them all:
        pvc.data.Data.setSelected(datums);
    },
    This is called before the actual render, so there's no additional re-render cost.
    Last edited by duarte.leao; 05-02-2013 at 10:30 AM.

  3. #3

    Default

    That worked! Thank you!

  4. #4
    Join Date
    Feb 2013
    Posts
    530

    Default

    How can I pre select more than 1 bars ?

    I want to pre select 2 or more bars to pre selected when the dashboard loads.. ?

    Thank you.
    Sadakar

  5. #5
    Join Date
    Mar 2012
    Posts
    645

    Default

    Example 1 - All datums from series "London":

    var datums = this.chart.data.datums([{series: 'London'}]);


    Example 2 - Datums of two specific days, any series:

    var datums = this.chart.data.datums([{category: ["2012-02-24", "2012-03-01"]}]);

    Cheers!

  6. #6
    Join Date
    Feb 2013
    Posts
    530

    Default

    Thank you Leao,

    It works :-)

Tags for this Thread

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.