Project

General

Profile

Defect #1318

VelocityReportPlugin v3.5.54 Pie Chart not show in Smart/Web Client

Added by Javier Arroyo about 6 years ago. Updated about 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
03/27/2018
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

Description

After the upgrade to Servoy 8.2.3 the Velocity Plugin PieChart/BarChart not show in my Html Area

var myPie = plugins.VelocityReport.getChart(CHART.PIE, getPieChartDef(dataset));

var html = '<html><body>'+myPie+'</body></html>';

function getPieChartDef(dataset) {
var year = forms.FrmFacturasGC.fecha_cfa.getFullYear()
var vquery = "select cli.DescCliente, SUM "+
"from [tbFacturaCabecera] oi LEFT JOIN "+
"[tbMaestroClientes] cli ON oi.clie_cfa = cli.IdCliente "+
"where year(fecha_cfa) = "+year+
" group by cli.DescCliente order by 2 desc";
var result = databaseManager.getDataSetByQuery(globals.GCconex,vquery,null,-1)
var chartDef = {};
chartDef.title = "Top 5 Clientes ("+year+")";
chartDef.threeD = true;
chartDef.shadow = true;
chartDef.proportional = true;
chartDef.labelFontSize = 12;
chartDef.width = elements.html.getWidth() - 10/*360*/;
chartDef.height= elements.html.getHeight() - 10;
chartDef.legendPosition = "right";
chartDef.legendMargins = {horizontal: 10, vertical: 2};
chartDef.margins = {top: 10, left: 10, right: 10, bottom: 10};
chartDef.slices = new Array();
var maxRows = dataset.getMaxRowIndex()
/** @type String */
var totalLine = dataset.getColumnAsArray(2)
totalLine = totalLine.join('+')
totalLine = eval(totalLine);

for(var i=1; i <= maxRows; i++) 
    {
result.rowIndex = i;
var percent = dataset.getValue(i,2);
var text = dataset.getValue(i,1);
var color = Colores[i-1];
var porc = (percent * 100)/totalLine;
var slice = { percent: percent, label: utils.numberFormat(porc,'###,##0.00')+'%', legend: text , color: color };
chartDef.slices.push(slice);
}
chartDef.orientation = 45;
//etc.
return chartDef;
}

Files

Captura__1_.JPG (20.1 KB) Captura__1_.JPG Javier Arroyo, 03/27/2018 09:55 AM
Captura2.JPG (17.1 KB) Captura2.JPG Javier Arroyo, 03/27/2018 09:55 AM
chart.png (9.89 KB) chart.png Patrick Talbot, 04/26/2018 03:34 PM
manager.war (26.8 KB) manager.war Patrick Talbot, 11/16/2018 05:40 PM

History

#1

Updated by Patrick Talbot about 6 years ago

  • Status changed from New to Feedback
  • Assignee set to Javier Arroyo

Do you have the eastwood.war correctly deployed?
Is there any exception in the log?

#2

Updated by Javier Arroyo about 6 years ago

I think I deploy correctly eastwood.war. The first thing I have done is to stop application server, replace beans, plugins,... of new version, delete the eastwwod.war and eastwood folder of previous version. Then I put eastwood.war of version 3.5.54, and reboot application server.

There is not any exception in the log.

#3

Updated by Patrick Talbot about 6 years ago

I don't understand your script. You are passing a dataset (dataset), then you are querying another (result), then you are updating the result.rowIndex but getting values from the dataset you passed. Doesn't make too much sense to me.

Could you send me a JSON output of the chartDef object?

#4

Updated by Javier Arroyo about 6 years ago

The output of chartDef object:

<img src="http://localhost:8080/eastwood/chart?cht=p3&chdlp=r&chp=45.0&chs=362x191&chts=000000,12&chd=e%3AiRODHLETEN&chma=10,10,10,10%7C10,2&chtt=Top+5+Clientes+%282018%29&chco=0080FF,00CC66,FF0000,FFFF00,CCCCCC&chl=53%2C55%25%7C21%2C95%25%7C11%2C22%25%7C6%2C72%25%7C6%2C57%25&chdl=BURNIGAI+S.A.L%7CINDUSTRIAS+GOL%2C+S.A.U.%7CTESOLVIT+%2C+S.L.%7CTROFEOS+ZUSI%2C+S.L.%7CTALLERES+MENDIZABAL&lfs=12&3d=1&xp=1&ewr=1" border="0" class="chart" width="362" height="191"></img>

There is not any exception in the log, but the Pie chart not show.

#5

Updated by Javier Arroyo about 6 years ago

Any reason why Pie Chart not show in Smart/Web Client??

#6

Updated by Patrick Talbot about 6 years ago

I just tried in Servoy 8.2.3 and Velocity 3.5.55 with the exact URL you've provided above:

http://localhost:8080/eastwood/chart?cht=p3&chdlp=r&chp=45.0&chs=362x191&chts=000000,12&chd=e%3AiRODHLETEN&chma=10,10,10,10%7C10,2&chtt=Top+5+Clientes+%282018%29&chco=0080FF,00CC66,FF0000,FFFF00,CCCCCC&chl=53%2C55%25%7C21%2C95%25%7C11%2C22%25%7C6%2C72%25%7C6%2C57%25&chdl=BURNIGAI+S.A.L%7CINDUSTRIAS+GOL%2C+S.A.U.%7CTESOLVIT+%2C+S.L.%7CTROFEOS+ZUSI%2C+S.L.%7CTALLERES+MENDIZABAL&lfs=12&3d=1&xp=1&ewr=1

And it worked fine for me, producing the chart image attached.

Could it be because of the new sanitizer that Servoy uses to strip some data from HTML_AREA?

I've seen this in one solution with WebClient where I had to use the WebClientUtils to push tags like <input> in an area. What you need to do is make sure your dataprovider starts with "<html><head></head><body>" and ends with "</body></html>" otherwise Servoy strips the tags, and in Smart client, doesn't recognize the output as HTML...

So your HTML should be
'<html><head></head><body>'+myPie+'</body></html>';

#7

Updated by Javier Arroyo over 5 years ago

Still unable to show Pie Chart, Bar Chart,.... in Smart/Web Client.
Even in the example application VelocityReport.servoy,which is included in the plugin, the different charts are not shown correctly.

For example the output of PiechartDef object is:

<img src="http://localhost:8080/eastwood/chart?cht=p3&chdlp=r&chp=45.0&chs=600x300&chts=222222,18&chd=e%3AS4QAJ7GiMr&chma=10,10,10,10%7C10,2&chtt=My+fantastic+Pie%21&chf=bg,lg,90,CCCCCC,0.0,FFFFFF,1.0&chco=FF0000,00FF00,0000FF,FF00FF,00FFFF&chl=Thirty%7CTwenty-Five%7CFifteen%7CFive%7CTwenty&chdl=Thirty%7CTwenty-Five%7CFifteen%7CFive%7CTwenty&lfs=10&xp=1&ewr=1" border="0" class="chart" width="600" height="300"></img>

But it is not displayed correctly

#8

Updated by Patrick Talbot over 5 years ago

As I said before, your example (and the sample solution) is working fine for me in Servoy 8+ (including 8.3.2 which I just tested), with Java 7 and 8, so there must be something in your installation that prevents it to work fine.
For example, did you setup correctly the velocityReport.reportFolder and velocityReport.serverURL in the plugin page of servoy-admin?
Can you navigate to http://localhost:8080/eastwood/index.html in a browser? Do you get an HTTP error or do you see the Barcode test page?

#9

Updated by Javier Arroyo over 5 years ago

I setup correctly the velocityReport.reportFolder and velocityReport.serverURL

-velocityreport.serverURL: http://localhost:8080/
-velocityreport.reportfolder: C:/Servoy/Reports

I canĀ“t navigate to http://localhost:8080/eastwood/index.html in a browser. I get error HTTP State 404 - /eastwood/index.html
The required resource is not available.

I see that in \\application_server\\server\\webapps I have eastwood.war and deployed the eastwood folder

What can I be doing wrong?

#10

Updated by Patrick Talbot over 5 years ago

Not quite sure what you did wrong, but if you can't see a page in your browser when navigating to this URL then charts will not work either.

I would try and install the manager application, to see if the eastwood war, although it is deployed) is activated.

When Developer is not started, put the attached manager.war in your /server/webapps
Also create a user in server/conf/tomcat-users.xml like:
<tomcat-users>
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<user username="servoy" password="servoy" roles="manager,manager-gui,manager-status"/>
</tomcat-users>
Then start Servoy and you should be able to navigate to http://localhost:8080/manager/html and see if the /eastwood war is active.

#11

Updated by Javier Arroyo over 5 years ago

I followed your instructions, put the attached manager.war in your /server/webapps and create a user in server/conf/tomcat-users.xml as you explained.
Then start Servoy and navigate to http://localhost:8080/manager/html. Ask for username and password. I put username="servoy" password="servoy" as it was created in server/conf/tomcat-users.xml, but I get error 401 Unauthorized You are not authorized to view this page.
It seems that .war (eastwood.war, manager.war) are deployed but not activated and therefore are not accessible. Any idea why this happens and how to solve it?

#12

Updated by Patrick Talbot over 5 years ago

I have no idea why war files wouldn't be activated. The manager is supposed to give you access to the various "applications" (wars and servlet paths) deployed and install/activate. If you cannot even access the manager, I fear there is something very wrong with your installation...

I would recommend doing a clean install of Servoy.

#13

Updated by Patrick Talbot about 5 years ago

  • Status changed from Feedback to Rejected

Also available in: Atom PDF