Hitachi Vantara Pentaho Community Forums
Results 1 to 16 of 16

Thread: Open popup click action of a chart

  1. #1
    Join Date
    Aug 2012
    Posts
    25

    Default Open popup click action of a chart

    Hello i´m using CDE to create my own dashboard. I have seen an example how to use popup component into dashboard but it is asociated to a button like this in the "Expression" property:

    function f(e){
    render_popup2.popup($(e.target));
    }

    I want to asociate it when i click in any bar of my chart. Can i define a new target? or can i define the position of this popup manually?

    This is the Pedro Alves´s post: http://pedroalves-bi.blogspot.com.es...explained.html

    Thanks at all

    AJ
    Last edited by allen_ajd3; 08-22-2012 at 05:05 AM. Reason: Add more information

  2. #2
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    I think you can use the click Action on the chart to do that. Something along the lines of:

    function(s, c, v){ //s for series, c for category, v for value - this will give you details about which bar you clicked

    render_popup2.popup($(render_chart)); //or whatever your chart is called

    }

    I also think (although I'm not sure) that the click action function gets a fourth parameter with the event. So this (or something similar) should work:

    function(s, c, v, e){

    render_popup2.popup($(e.target));

    }

    this will make the popup appear over the clicked bar and the previous one will make the popup appear over the whole chart (always in the same position regardless of the clicked bar).


    cheers
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  3. #3
    Join Date
    Aug 2012
    Posts
    25

    Default

    Thanks it work´s. That´s it like you say, using 4 params in the click function.

    The last one represents the label object and you can define the target with this declacaration

    Thanks a lot Pedro y tried other many solutions but it´s simple.

    AJ

  4. #4

    Default

    In case anyone comes across this thread for CCC2, it looks like the approach has changed slightly on the clickAction for a bar chart


    function(e){

    render_popup2.popup($(this.event.target));

    }

  5. #5
    Join Date
    Feb 2013
    Posts
    3

    Default

    Quote Originally Posted by jswinnerton View Post
    In case anyone comes across this thread for CCC2, it looks like the approach has changed slightly on the clickAction for a bar chart


    function(e){

    render_popup2.popup($(this.event.target));

    }
    Your update is what I was looking for since yesterday afternoon..

    As popups can be really useful, I expected some documentation to be provided by webdetails about this change!! Fortunately I came across this thread

  6. #6
    Join Date
    Feb 2013
    Posts
    3

    Default

    (obviously it works also with other CCC2 charts, not only bar charts)

  7. #7

    Default

    Is possible to set default position to popup window?
    I'm not referring to 'Gravity Parameter' Property.


    Thanks in advance.

  8. #8
    Join Date
    Oct 2013
    Posts
    9

    Default

    do you know how can I use parameters (series, category, value) from the first chart to a second chart by a popup component??

  9. #9
    Join Date
    Feb 2013
    Posts
    530

    Default

    How to use parameters on popup component ?

    Main Chart : Pie chart ( 3 slices : example : OR,CA,WA states)
    Popup Chart : Bar chart

    Bar charts has to take the slice state name as parameter ??


    I have tried below : With out parameters every thing working fine(i.e., can able to pop up from pie chart slices)

    The popup is showing no data found message ..

    On pie chart : clickable is true and in the click action written below code.

    function f(e){

    Dashboards.fireChange('param1_state', e.vars.category.value); // This will pick the slice name (state name/category name)
    // alert("you have clicked on"+" "+param1_state); // This will show the parameter in alert function
    render_PopUpComp2.popup($(this.event.target)); // This will render the chart when click on slice..

    }

    set the parameter & listener for
    Bar chart & Popup component & parameter for query..

    Am I missing any thing over here ? Did any one come across this problem ?


    Thank you.
    Sadakar
    BI developer

  10. #10

    Default

    This kind of setup definitely works for me (I am using pentaho v4) and sounds like you are doing everything right - sorry I can't suggest anything more except double checking everything and debugging with firebug

  11. #11
    Join Date
    Feb 2013
    Posts
    530

    Default

    Quote Originally Posted by jswinnerton View Post
    This kind of setup definitely works for me (I am using pentaho v4) and sounds like you are doing everything right - sorry I can't suggest anything more except double checking everything and debugging with firebug

    Cross verified.. worked .. Thank you for the input.

  12. #12
    Join Date
    Feb 2013
    Posts
    530

    Default

    Pop up is not coming in Chrome browser (general popup is enabled in Chrome) but coming in firefox ?

    Using below code..

    function f(e){
    var color = this.pvMark.fillStyle();
    Dashboards.fireChange('Param1_state', e.vars.category.value);
    Dashboards.fireChange('param3_color',color.color);
    //alert("you have clicked on"+" "+Param1_state);
    render_PopUpComp2.popup($(this.event.target));
    }

    1) In Chrome

    Popup for button component with out parameters is working fine..( do not need to be parametrized in my case)
    Popup for pie chart using above code is not working in Chrome browser..

    2) Mozilla

    Popup for button component is working with out parameter is working fine( do not need to be parametrized in my case)
    Popup for pie chart using above code is also NOT working ...
    If I enable the alert function in the above code pop for pie chart is working ...

    1) What could be probable reason for this kind of behavior? How to over come this ?
    2) Can we pass multiple parameters in Single fire change function ?


    Thank you in Advance

    Sadakar

  13. #13
    Join Date
    Jun 2015
    Posts
    24

    Default

    I've also got the same problem... popup is not rendered properly
    when alert is disabled popup doesn't work and when alert is enabled, it just renders randomly!!!
    how the issue can be solved?!?!
    thanks in advance for your help

    Quote Originally Posted by sadakar View Post
    Pop up is not coming in Chrome browser (general popup is enabled in Chrome) but coming in firefox ?

    Using below code..

    function f(e){
    var color = this.pvMark.fillStyle();
    Dashboards.fireChange('Param1_state', e.vars.category.value);
    Dashboards.fireChange('param3_color',color.color);
    //alert("you have clicked on"+" "+Param1_state);
    render_PopUpComp2.popup($(this.event.target));
    }

    1) In Chrome

    Popup for button component with out parameters is working fine..( do not need to be parametrized in my case)
    Popup for pie chart using above code is not working in Chrome browser..

    2) Mozilla

    Popup for button component is working with out parameter is working fine( do not need to be parametrized in my case)
    Popup for pie chart using above code is also NOT working ...
    If I enable the alert function in the above code pop for pie chart is working ...

    1) What could be probable reason for this kind of behavior? How to over come this ?
    2) Can we pass multiple parameters in Single fire change function ?


    Thank you in Advance

    Sadakar

  14. #14
    Join Date
    Mar 2012
    Posts
    645

    Default

    Hi,

    please, Sahar or Sadakar, can you create an issue in Jira for this? jira.pentaho.com/browse/CDF

  15. #15

    Default

    Try replace $(this.event.target) with $(e.target)
    Works fine with me in chrome, firefox and IE

  16. #16
    Join Date
    Sep 2017
    Posts
    3

    Default

    Hello.
    I would like to reopen this topic again.

    I had two tables on my dashboard. When you click on row of first one second one update all its values. Then I decided to put second table inside of the popup component.

    This is my code on "Click action" of the first table:

    function d(s){
    dashboard.fireChange('param_stageName',s.series);
    render_tablePopup.popup($(s.target));
    }


    And when I click on row of table I can see popup with second table inside but just for a moment, after that it desapear. What is the problem?

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.