View Full Version : Howto create a pie chart?

04-19-2006, 11:20 PM

at the moment, i evaluate the pentaho BI and it is very easy to create a (table) report with the design wizard or iReport.
But now i wanna create a pie chart. Because there is no way with the design wizard, first i tried it with iReport 1.2.0 and it works fine. After i insert the report in pentaho, i got a error message "can't compile". Then i changed the jasperreports-1.0.0.jar library in pentaho-demo\\jboss\\server\\default\\deploy\\pentaho.war\\WEB-INF\\lib to jasperreports-1.2.0.jar and now pentaho can compile the jasper file. But i can't see the pie chart and on the command line i got the following error message (the message was in german and i try to translate them):

16:24:30,640 ERROR [JasperReportsComponent] 36ad4626-cfb0-11da-a6d4-a9e8b7396ec6
:COMPONENT:context-4404924-1145456669937:jasperReport.xaction [de_103] JasperReport.ERROR_0014 - [de_69] Report execution failed java.io.FileNotFoundException: C:\\Pentaho\\pentaho-demo\\pentaho-solutions\\getImag
e?image=\\ersterChart\\img_0_2_0 (the Syntax for the filename, directory or the volumelabel is wrong)

What is the problem? Did anybody have a hint for me?

Then i try to generate the pie chart directly in pentaho workbench, how it is descibe in the Pentaho_Creating_Solutions_1.1.4.pdf guide. This works. I got the message on the screen:

[de_121] Action Successful


and the png file was created in the directory C:\\Pentaho\\pentaho-demo\\pentaho-solutions\\system\\tmp

How can i display it on the screen?

All hints will be welcome

Best regards

Holger Koch http://forums.pentaho.org/archived_att/files/zweiterTestChart.xaction

04-20-2006, 07:24 AM

Have you tried looking at our PieChart sample? It is under http://localhost:8080/pentaho/PieChart if you're running on your machine. Let me know if this helps.

The PieChart maps to /jsp/PieChart.jsp .


04-21-2006, 03:45 AM
Hi mdamour,

thank you for your answer. I have tried to understand the example, but unfortunate i'm not a jsp programmer.
Is there an other way to create a chart with the workbench or with iReport at the moment?

Best regards

Holger Koch

04-25-2006, 12:41 AM
Hi all !

I have the same problem, I wish to modify the example given with the pentaho demo to understand pentaho's full capabilities. However, I have been unable to find how to change the datasource of the Chart to point to my Sql database.

I am probably not looking in the right direction.

All help would be appreciated.

04-26-2006, 06:51 AM

may be i can help you.

in the file PieChart.jsp in line 40 is an Entry

"IPentahoConnection connection = PentahoConnectionFactory.getConnection("SQLDatasource", null);"

with the Name "SQLDatasource" is the JNDI Datasource in the file pentaho.xml involved.

I think you should create a new JNDI Datasource and change the name in the PieChart.jsp example.

I have also a question. Is it right, that pentaho has 3 options to create a chart?
* programm it in jsp
* create it with the workbench
* create it with an jasper/jfree designer, for example iReport

Can anybody tell me, that he have seen an working chart that is not a jsp programm? (Why are only jsp examples includes?)

best regards

04-27-2006, 06:59 AM
This is not ideal since it still says 'Action Successful' on the top, but see what this does:

function show(theChartFile) {
return "<IMG SRC=\\"getImage?image=" + theChartFile + "\\">";

Just replace your show method. I'm sure there is a perfect way of doing this, I'll have to ask Marc.

I also made a code change for the ChartComponent so that if no output is specified then it will write the chart directly to the 'default output stream'. This means that in the future you'll be able to create chart action sequences that display a chart directly to the browser without a Javascript rule. You can still chain the results to another component by specifiying an output.


04-27-2006, 11:25 PM

Thanks for your help, however, this line : PentahoConnectionFactory.getConnection("SQLDatasource", null);"
doesn't seem to refer to the JNDI. Most examples point to the JNDI called "SampleData", which I found, but since I already created an parallel access to my database. The access I created works fine with others examples, reports and the like, so I just wanted to use it for the Charts too. It may help if I had access to the PentahoConnectionFactory class, but, being a .class file... and I can't find its source.

As for your question, I only know that you cannot use the workbench wizard to create charts. Apart from that, I don't know.

I'll be waiting for any other ideas,


05-11-2006, 12:38 PM
Please see the pentaho.xml file, in this file you can write other datasource for the chart

05-11-2006, 12:39 PM
Please see the pentaho.xml file, in this file you can write other datasource for the chart

05-11-2006, 01:07 PM
Please see the pentaho.xml file, in this file you can write other datasource for the chart

05-16-2006, 12:03 AM
Thank you, this was what I was looking for.