Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Does jfreechart support sql ?

  1. #1

    Default Does jfreechart support sql ?

    Does jfreechart support sql in CDF

    I am trying to plot a chart in dashboard using sql. I have uncommented the 'action definition ' from the Jfreechart.xaction.


    Here is my template.html
    -----------------------------------------------------------------------
    <div id="dashboard">

    <div class="span-15 last hide step2 step3 step4 step5 step6">come on
    <div id="sampleObject" class="span-4"></div> </div>

    </div>

    <script language="javascript" type="text/javascript">

    var MetaLayerHome2 = {
    topTenCustomerDefinition: {
    width: 500,
    height: 300,
    chartType: "BarChart",
    datasetType: "CategoryDataset",
    is3d: false,
    byRow: false,
    isStacked: false,
    includeLegend: false,
    domainLabelRotation: 0,
    backgroundColor: "#F3F3F3",
    title: "Top 10 Customers",
    parameterName:"Sales_Fact.Time_Id",
    caption:{},
    orientation: 'vertical',
    queryType: 'sql',
    jndi: "Saas_DB",
    query: function(){

    var query = " SELECT sum(Sales_Fact.Quantity_Sold) , Sales_Fact.Store_ID , Sales_Fact.Time_Id "+
    " FROM Sales_Fact GROUP BY Sales_Fact.Store_ID,Sales_Fact.Time_Id";
    return query;
    }


    }
    };

    var topTenCustomers =
    {
    name: "topTenCustomers",
    type: "jFreeChartComponent",
    chartDefinition: MetaLayerHome2.topTenCustomerDefinition,
    htmlObject: "sampleObject",
    executeAtStart: true
    };
    Dashboards.init([topTenCustomers]);

    load();
    </script>

    ------------------------------------------------------------------------
    my jndi is working fine with report studio. but i am getting error "Error: connectFactory.Error_001- Database connection could not be established to Saas_DB" .

    am i missing any thing or doing anything wrong ?

    help me out .....

  2. #2
    Join Date
    Jul 2007
    Posts
    2,497

    Default

    Database connection could not be established to Saas_DB - this seems like an error connecting to the database.

    Also, I'm not sure that's a valid query, I was expecting something on the lines of select name, value from xxxx
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3

    Default

    The query is valid one , i have used the same query to plot a chart in report designer.
    and i am able to connect to my DB from report designer and user console.

    do i need to configure something in Jfreechart.xaction or somewhere to connect to my db(Teradata) through the dashboard ?

  4. #4
    Join Date
    Nov 2009
    Posts
    28

    Default

    Did you replace the xaction or edited the original file?
    I replaced the old file with the *.sql and it works for me.
    Have you tried to use sql in the Jfreechart example?

    query = "Select department, sum(actual) as actual, sum(budget) as budget from quadrant_actuals group by department"

    /Andreas

  5. #5

    Default

    Thanx Andreas, pmalves for your quick reply..

    actually the error is due to 'GlobalNamingResources', 'realm' parameters in server.xml which i configured wrongly.

    now my jfreechart is working fine ...

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.