use jasper report plugin for charting in web client

Before I dive into Jasper documentation, has anybody ever used jasper reports for generating charts in the web client?
Any pointers/alternatives are welcome.

Google charts works fine but the GET method is limited to +/- 2000 chars in the url. (so you can only send a limited amount of data into a chart)
The Google chart POST method also works fine with the servoy http plugin. However there’s no method inside the Servoy Poster object to get the PNG image.
(I’ve posted a request at Servoy for that)

//Get poster object to do http (file) posts. If posting files, it will post multipart!
	var poster = plugins.http.getPoster('http://chart.apis.google.com/chart');
	var p1 = poster.addParameter('cht','lc');
	var p2 = poster.addParameter('chtt','This is | my chart');
	var p3 = poster.addParameter('chs','300x200');
	var p4 = poster.addParameter('chxt','x');
	var p5 = poster.addParameter('chd','t:40,20,50,20,100');
	var httpCode 	= poster.doPost(); //httpCode 200 is ok
	var pageData 	= poster.getPageData()   //need getMediaData() here
	globals.chartImage = pageData;

Do yourself a favor and have a look at the VelocityReport, it is a powerful report engine that also has a built-in charts (and barcode) generator using google-charts or eastwood (using simple JavaScript methods and objects in Servoy).
Using eastwood you get all the google charts (and more) but without the URL limitation and with a higher definition as well (suitable for printing or output to PDF).

Check it on ServoyForge at Overview - VelocityReport Plugin - ServoyForge

Hi Patrick,
Thanks for your pointer, will check today.

btw: i see you’re using Redmine for your projects :-)
That’s a great tool!

Thanks Patrick,
This looks like a great tool :-)

One quick question

It seems that I’m gettin a reference error on CONSTANTS defined in your plugin.

CALL:
var vChartUrl = globals.lgcChartShow(CHART.LINE)
ERROR:

org.mozilla.javascript.EcmaError: ReferenceError: "CHART" is not defined. (C:\servoyWorkSpace\...\forms\chartsAndRawData.js#65) 

However when I put in this method step to onSolutionOpen, the error is gone.

plugins.VelocityReport.installFonts(fontCallback);

Any relation between these two?

maarten:
CALL:
var vChartUrl = globals.lgcChartShow(CHART.LINE)
ERROR:

org.mozilla.javascript.EcmaError: ReferenceError: "CHART" is not defined. (C:\servoyWorkSpace\...\forms\chartsAndRawData.js#65) 

However when I put in this method step to onSolutionOpen, the error is gone.

plugins.VelocityReport.installFonts(fontCallback);

Any relation between these two?

The thing is that until you make at least one call to a method of the plugin, the constants are not known to the scripting environment.
This is a limitation of Servoy due to the fact that IConstantObject implementation (as any Object returned by the plugin) are lazily loaded.

So using installFonts() initializes the constants, but you could also use getVersion() for example and it will do the same…

Hi Patrick,

Could you test your velocity Reports solution in web client using true servoyServer - client ?
I’m still getting the reference error.

Everything seems to be ok when using smart client or developerServer - client connection.

Thanks,
Maarten.

I just tried the sample solution from a “true” Servoy server using the latest v1.3.8 and it works fine for me here.
Are you sure you have deployed the correct version?
Maybe you could try clearing your cache (client side and/or server side) and try again?

High Patrick,
FYI
I just upgraded from 1.3.6 to 1.3.12

Constants problem is gone :D

Thanks!

ptalbot:
Do yourself a favor and have a look at the VelocityReport, it is a powerful report engine that also has a built-in charts (and barcode) generator using google-charts or eastwood (using simple JavaScript methods and objects in Servoy).
Using eastwood you get all the google charts (and more) but without the URL limitation and with a higher definition as well (suitable for printing or output to PDF).

Check it on ServoyForge at Overview - VelocityReport Plugin - ServoyForge

SO much better than Jasper. Much easier to setup and configure, designing reports is normal html/css, can send data to reports in a variety of ways that make sense, tag markup takes about 5 minutes to learn, outputs to all kinds of formats, integrated viewer, etc.

I’m not quite at the point where I want to marry Patrick but I do love this plugin!

Ok, maybe I need to dial down the morning coffee…

david:
Ok, maybe I need to dial down the morning coffee…

Yes, Please!!! :)

And for those who don’t love me like you do David :lol: I have created a little VelocityReport “Excel export How-to” tutorial on the ServoyForge Wiki:
https://www.servoyforge.net/projects/ve … xcelExport

Works in Smart AND Web clients.

That’s great stuff, Patrick!
Thanks.

Here’s a pretty amazing google chart for displaying dates along the x axis and values along the y axis.
It’s got zoom and scroll functions and client side stuff, so I guess no limitations regarding amount of data input.
http://code.google.com/apis/ajax/playgr … _time_line

You can use the same approach as Davids/Jans google maps solution.
http://www.servoymagazine.com/home/2007 … tegra.html

  1. Create a method globals.showChart() that returns the google code
  2. place a text globals.htmlarea on a form with DISPLAY_TYPE = HTML_AREA (make the area big enough to show chart like 900x400) and call
function setChart(event) {
	globals.htmlarea	= globals.showChart()
}
function showChart()
{
	var x	= "<html>\
  <head>\
    <script type='text/javascript' src='https://www.google.com/jsapi'></script>\
    <script type='text/javascript'>\
      google.load('visualization', '1', {'packages':['annotatedtimeline']});\
      google.setOnLoadCallback(drawChart);\
      f"+"unction drawChart() {\
        var data = new google.visualization.DataTable();\
        data.addColumn('date', 'Date');\
        data.addColumn('number', 'Sold Pencils');\
        data.addColumn('string', 'title1');\
        data.addColumn('string', 'text1');\
        data.addColumn('number', 'Sold Pens');\
        data.addColumn('string', 'title2');\
        data.addColumn('string', 'text2');\
        data.addRows([\
          [new Date(2008, 1 ,1), 30000, undefined, undefined, 40645, undefined, undefined],\
          [new Date(2008, 1 ,2), 14045, undefined, undefined, 20374, undefined, undefined],\
          [new Date(2008, 1 ,3), 55022, undefined, undefined, 50766, undefined, undefined],\
          [new Date(2008, 1 ,4), 75284, undefined, undefined, 14334, 'Out of Stock','Ran out of stock on pens at 4pm'],\
          [new Date(2008, 1 ,5), 41476, 'Bought Pens','Bought 200k pens', 66467, undefined, undefined],\
          [new Date(2008, 1 ,6), 33322, undefined, undefined, 39463, undefined, undefined]\
        ]);\
		\
        var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));\
        chart.draw(data, {displayAnnotations: true});\
      }\
    </script>\
  </head>\
  <body>\
    // Note how you must specify the size of the container element explicitly!\
    <div id='chart_div' style='width: 700px; height: 240px;'></div>\
	\
  </body>\
</html>";
	return x;
}

[attachment=0]snap__2010_12_15__13_59_44.png[/attachment]

Is there an easy way to dynamically refresh charts and dials with the Velocity Report engine so one can build dynamic dashboards with it?

Thanks,

Gary
TMA

Gary R. Schaecher:
Is there an easy way to dynamically refresh charts and dials with the Velocity Report engine so one can build dynamic dashboards with it?

What do you mean by dynamically refresh charts?

Charts are built by an object containing parameters… it’s up to you to fill these parameters and “dynamically” change them whenever you want.
Just set a form variable as a dataprovider to a field of type HTML_AREA, then call plugins.VelocityReport.getChart() to fill the content of it.
Have a look at the sample solution, it does that, all you need to do is to change the parameters depending on your own values.
It’s just scripting really, and of course this works on web client as well.