Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: Google Map in a dashboard

  1. #1
    Join Date
    Nov 2009
    Posts
    16

    Unhappy Google Map in a dashboard

    Hi,

    I have an action sequence that returns a google map - it works fine if I execute it from the User Console - or if I embed it in a dashboard created using the dashboard designer as part of my evaluation copy of Enterprise Edition. However I would like to create a dashboard from scratch so that I can build in additional javascript and jquery stuff later on. So I have followed the step by step notes in Ch17 of the Pentaho Solutions book by Bouman and Dongen.

    Firstly I added a new folder in the user console. In the folder I have created an xcdf file called repairers.xcdf:


    <?xml version="1.0" encoding="UTF-8"?>
    <cdf>
    <title>Repairers Dashboard</title>
    <author>Matt Gardner</author>
    <description>
    The Repairers Dashboard shows the geographical
    distribution of repairers in the network along
    with the historical repair volume for repairers
    </description>
    <icon></icon>
    <template>repairers-template.html</template>
    </cdf>


    I have also created an html template called "repairers-tempate.html" in the same folder:


    <h1>Repairers Dashboard</h1>
    <div id="repairer_map"></div>
    <script langauge="javascript" type="text/javascript">
    // Get solution and path of this current locations
    var solution = Dashboards.getQueryParameter("solution");
    var path = Dashboards.getQueryParameter("path");

    // Dashboard Parameters
    Dashboards.globalcontext = false;
    // Parameter definitions go here:

    // Component Definitions
    //var components = [];

    components[components.length] =
    {
    name: "repairer_map",
    type: "xaction",
    solution: solution,
    path: path,
    action: "xRepairerMap.xaction",
    listeners:,
    parameters: [],
    htmlObject: "repairer_map",
    executeAtStart: true,
    tooltip: "My first dashboard"
    };

    Dashboards.init(components);

    </script>

    This should execute the action sequence and return the html to display in the dashboard.

    Finally the code for the action sequence is here:

    <?xml version="1.0" encoding="UTF-8"?>
    <action-sequence>
    <title>xRepairerMap</title>
    <version>1</version>
    <logging-level>ERROR</logging-level>
    <documentation>
    <author/>
    <description>Empty blank action sequence document</description>
    <help/>
    <result-type/>
    <icon/>
    </documentation>

    <inputs/>

    <outputs>
    <out type="string">
    <destinations>
    <response>Content</response>
    </destinations>
    </out>
    </outputs>

    <resources/>

    <actions>
    <action-definition>
    <component-name>TemplateComponent</component-name>
    <action-type>Content</action-type>
    <action-inputs/>
    <action-outputs>
    <output-message type="string" mapping="out"/>
    </action-outputs>
    <component-definition>
    <template><![CDATA[<html>
    <head>
    <title>Google Maps and jQuery</title>
    <!-- http://code.google.com/apis/ajaxlibs/documentation/ -->

    <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA15w_mth--tK9bU_ofPXjHhRt_xk8THLBnsEGa1iENo1M77z_IxRxaf8-x-P3CaikPY2YR-NiaQnEcA"></script>
    <script type="text/javascript">
    google.load("jquery", '1.3');
    google.load("maps", "2.x");
    </script>

    <script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
    var map = new GMap2($("#map").get(0));
    var centre = new GLatLng(54.57,-2.197);
    map.setCenter(centre, 6);
    map.setUIToDefault();
    });
    </script>
    <style type="text/css" media="screen">
    #map { float:left; width:500px; height:750px; }
    </style>
    </head>
    <body>
    <div id="map"></div>
    </body>
    </html>]]></template>
    </component-definition>
    </action-definition>

    </actions>
    </action-sequence>


    The problem is I just get the community dashboard framework header - with my title but no map...See attached screenshot.

    No errors or anything. Any thoughts? Where would errors get written to. How can I debug this?

    Any ideas would really be welcome.

    Thanks,

    Matt
    Attached Images Attached Images  

  2. #2

    Default

    I have no solution to your problem... but I will just point out that unless you pay ($10K a year) for Google Maps you are breaking google's terms and conditions unless the Pentaho installation you are working on faces the internet and has no login at all ... which is why a lot of us use Open Street Maps.
    This is a signature.... everyone gets it.

    Join the Unofficial Pentaho IRC channel on freenode.
    Server: chat.freenode.net Channel: ##pentaho

    Please try and make an effort and search the wiki and forums before posting!
    Checkout the Saiku, the future of Open Source Interactive OLAP(http://analytical-labs.com)


  3. #3
    Join Date
    Nov 2009
    Posts
    16

    Default

    Really! I thought as long as I am just developing test code that I would be ok. Google Maps are not used anywhere in production, just part of some evaluation work at the moment.

  4. #4

    Default

    Is that like telling Microsoft i was only evaluating my copy of Windows 7 and therefore didn't need to buy it?

    *Disclaimer* I do not own or download, and do not plan to own or download any copies of Windows 7
    This is a signature.... everyone gets it.

    Join the Unofficial Pentaho IRC channel on freenode.
    Server: chat.freenode.net Channel: ##pentaho

    Please try and make an effort and search the wiki and forums before posting!
    Checkout the Saiku, the future of Open Source Interactive OLAP(http://analytical-labs.com)


  5. #5
    Join Date
    Nov 2009
    Posts
    16

    Default

    OK - I will check out Open Street Maps - but I guess I am going to run into the same problem when I try and create the dashboard. What I want to get to is the point where I have a map displaying markers. When I click on a marker other components will refresh based on the id of the marker. Anyone got a sample that will speed up my progress?
    Cheers,
    Matt

  6. #6

    Default

    You got FF and Firebug installed, I'd open it w/o mantle (the rest of the ui) and just see where its throwing up.
    This is a signature.... everyone gets it.

    Join the Unofficial Pentaho IRC channel on freenode.
    Server: chat.freenode.net Channel: ##pentaho

    Please try and make an effort and search the wiki and forums before posting!
    Checkout the Saiku, the future of Open Source Interactive OLAP(http://analytical-labs.com)


  7. #7
    Join Date
    Nov 2009
    Posts
    16

    Default

    Just tried that - does not seem to be breaking anywhere as far as I can see...

  8. #8
    Join Date
    Nov 2009
    Posts
    16

    Default

    Does this mean anything to anyone - it is a response form Michael Tarallo at Pentaho. My brain is hurting - a very steep learning curve here! I just love the CDF strap line "Dashboards made Easy!".... umm what was it like before Pentaho?!!

    CDF renders the content using AJAX, so if you want to call the Google Maps .xaction object you may have to use an iframe property instead -- see this CDF code snippet here:

    This is a call to an .xaction that renders a custom map component, using SVG, you can see it in the sample in one of my blog entries.
    ..
    myMap =
    {
    name: "myMap",
    type: "xaction",
    solution: "work_verticals",
    path: "Retail/Dashboard/svg",
    action: "usa_map_svg.xaction",
    // listeners:,
    htmlObject: "MapObject",
    // serviceMethod:"ViewAction",
    iframe:true,
    executeAtStart:true,
    preExecution:function(){
    },

    postExecution:function(){}
    }

    So first, you may need to create a .xaction using a message template that references a html page, with the google maps api code in it.

    ..and then, use a CDF xaction component, to call the .xaction using the iframe:true property.

    This should work for you.

  9. #9
    Join Date
    Jun 2007
    Posts
    50

    Default

    Hi Matt, simply stated working with the Google Maps API by itself, no Pentaho included, is a coding exercise. That is why it is called an API. CDF itself is also an API. You need to have a background in HTML and JavaScript as well as an understanding of the CDF basics that work with Pentaho in order to use it successfully.

    CDF is built on the powerful JQuery library. What CDF provides, is a cut and paste approach to building robust UI's, while working with the benefits of the Pentaho BI platform, Action Sequneces to be particular.

    The response I provided you, and the samples on the Pre-Sales Consulting Portal, are 1 way of many that you can achieve what you are looking for.

    It is just like anything else, I would not take apart or modify my car without the proper know how. As you said in the support case, you are trying to run before you can walk.

    I believe the account rep Ben Tebbs, should be in touch with additional support options for you.

    The samples on the PSCP are a great start for you.

    Also you can get a CDF tutorial and training package from web details.

    http://webdetails.pt/

    Take Care

    Mike Tarallo
    Pre-Sales Director
    Pentaho

  10. #10
    Join Date
    Nov 2009
    Posts
    16

    Thumbs up

    Mike,
    Agree entirely with your comments and very much appreciate your help. I do have a programming background but have limited exposure to JavaScript and JQuery - have worked on projects with Microsoft ASP.Net which is similar but not the same. My reason for trying to run rather than walk is that we need to demo some stuff in the New Year and we thought that it would be easier than it is proving - for the demo I cannot muster any JavaScript support in the business at the moment so have picked up what I can! Not far away now - we can do everything in xactions and display them - but it is the dashboard and interactive stuff beyond simple parameterisation that is proving the tricky bit. I will have a chat to Ben in the New Year and keep playing with this.
    Have a good Christmas.
    Matt

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 - 2017 Pentaho Corporation. All Rights Reserved.