PDA

View Full Version : "urlTemplate" tag in PieChart.xml



kandrews
04-03-2006, 01:34 PM
I didn't get any replys in my other post so before I throw in the towel I tried to go back and look at how a click on "Samples Collection" for Charts worked. So I copied the "BarChart" internet shortcut, the "barChart.xml" & the "BarChart.properties" files to my solution dir which is under "pentaho-solutions" so it's in the default solution dir path and with an index.xml file it does show up in the Browser when I am at the "http://localhost:8080/pentaho/Navigate?" page. I saw that the "barChart.xml" is the real meat of the operation and I modified it by commenting out the "urlTemplate" tags as I believe that is what is getting the data for the chart to show. So in another thread on charts I saw that the tag can contain a tag so I made an action sequence that hooks up to my db and returns some data, tested this and by itself the action sequence does return a result set. So I added in , , & so these are now embeded into the tag. I then went to settings & services and re-published. I should note that I adjusted the internet shortcut so it was "http://localhost:8080/pentaho/Chart?ChartType=4&ChartDefinitionPath=InsureWorx/Exec_Dashboard/MYbarChart.xml" but all I get is the same NULL POINTER EXCEPTION! I adjusted these every possible way ... names, types, etc. Still nothing ... please help ! What am I missing ? Doing wrong ?

modsaid
04-09-2006, 03:43 AM
hi kandrews,

i'm trying to generate charts too.. i tried editing the xml file: barChart.xml
like you did..

but it turned out that it is not the one responsible for the chart data
i changed the and made it point to another xaction file other than query1.xaction that was used in the demo..
but the old data persisted.

i commented the whole xml file leaving only

< chart >
< chart-type> barChart </chart-type>
</chart>


and it still produced the demo chart but with simpler trivial formatting.
if u change the chart-type to pieChart, lineChart, AreaChart it will work loading the corresponding chart.. wiith the pentaho demo data..
if u put any other type or removed this tag it will result in "null chart argument" exception

apparently.. this file is not where the chart data is specified..

can anyone help us with that??

Post edited by: modsaid, at: 04/09/2006 07:48

modsaid
04-11-2006, 03:38 AM
the xxxchart.xml had nothing to do with the data of the chart..

connection setting and the chart data were specified in the chart servlet that is implemented in the jsp page
{pentaho-demo}/jboss/server/default/deploy/pentaho.war/jsp/chart.jsp

when i edited the jsp page to use the JDBC connection on mine and another query i was able to get the chart of my own data... at last..


well... although i reached something and i created a chart... but this is not what i want.. i created a chart away from pentaho using ChartComponent in jsp code

i do not think this is what pentaho abilities... it's done nothing..

i'm trying to create a chart using pentaho itself... using ChartComponent in xaction files.

i'm trying to use the workbench now.. i made a SQLLookupRule that works fine and the resulting records are displayed when the xaction file is execution with SQLLookupRule Action only
(SQLLookupRule is reached by adding "query> SQL Query" in the action definition area)

when i add a chart action after that... i associate the chart data to be the output of the SQL query above...

i still get action components do not validate error..

Post edited by: modsaid, at: 04/11/2006 07:42

mbatchelor
04-11-2006, 06:07 AM
Please see the sample called JFree_ChartComponent.xaction. This shows the SQL Lookup Rule being used to create a PieChart using the chart component.

Hope this helps,

Marc

wseyler
04-11-2006, 06:34 AM
Hi guys,

Sorry I didn't jump into this thread earlier.

First of all, the urlTemplate tag in the xxxchart.xml is used for creating an image map and linking it to our pivot.jsp so that you can click through the chart to a pivot table.

Second. The chart jsp is the culprit behind why you can't define a chart datasource in the xxxchart.xml. The Chart.jsp or PieChart.jsp actually creates that datasource. If you look at the source for those JSPs you'll easily find where that occurs. The JSP's were never really meant to be used directly as part of the framework. Just as a way of exercising the charting engine as a sample.

If you wish it would be easy to implement your own jsp to hit your datasource based on the chart or piechart.jsp (or you could just edit one of those JSPs directly to hit your datasource). You just need to return the results in terms of an IPentahoResultSet. Of course you would need to register you jsp in the web.xml in the pentaho.war (if you created a new JSP).

In the future we may expand the chart.jsp so that it can take a datasource as an argument.

You can also get the functionality your looking for by writing an .xaction to create a chart using the org.pentaho.component.ChartComponent class and use one of the datasource components as its input. By default the chart will be created and placed in the repository/System/tmp directory. If you look at the JFree_ChartComponent.xaction you will see how to create a chart and place it in a report. You could use the same method to create a chart and place it in a html page.

Either way will work but writing an .xaction requires the least amount of J2EE skills.

Thanks for using the Pentaho BI suite.

Bill