Hi Kushalx,
I get all from FM except CANBUS just because I don't have any truck with this CAN interface.
Without CAN you can get temperature, driver ID, analog input, etc.
I try to simplified instruction and post soonest.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1. Assum that we already have some thing to draw a chart: Speed, BatteryVolts, Temperature, analog inputs, digital inputs or something in Event Detail Report. In this example I use Speed and Altitude.
2. Download jfreechart-1.0.13.jar and jcommon-1.0.16.jar, copy these 2 files into C:\OpenGTS_2.3.8\lib and into TomCat lib folder C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib. Restart TomCat.
3. In file EventDetailReport.java add getSupportsGraphDisplay() method, you can put at the end of this file, just before } character. This is to enable the link to Graph
Hi Peter,
I guess that you set working path of Tomcat different with default.
Please check in Tomcat configuration, on my computer, Working path is C:\Program Files\Apache Software Foundation\Tomcat 7.0
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2011-11-04
Hi,
it is wrong to run Tomcat with security disabled and write files in the ROOT context of an application.
With security enabled, you should create a sub-directory (in example is track/chart/) and do:
Thanks. Now the graph widnow gets displayed with the various checkboxes but the graph itself doesnt get displayed. When l check in the path l have configured (i.e. /usr/local/apache-tomcat-6.0.32/webapps/gtse_charts), l find that the png file_ chart_kaw918n.png_ has been generated and opens well.
What do you think could be the issue?
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
l still havent managed to get this to work properly. Here is what am doing: -
1. Am setting the path for the png to {my tomcat home}/webapps/gtsecharts
2. l have then added the following in my catalina.policy file…
//grant permission to opengts chart temp storage location
grant {
permission java.io.FilePermission "${catalina.home}/webapps/gtsecharts/-","read,write,delete";
};
However, the PNG is generated and saved and if transferred to windows can open using any windows picture viewer. However, it doesnt diplay on the Graph page… it only displays an error icon to show the file could not be located or something like that.
Mihai/trungvt,
Have you successfully tested this in any linux platform with tomcat security enabled?
Regards.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry l forgot to paste the source of the html page generated for the graph. Just a question… is the format of the image src (see bold below) correct or it should start with something like http://xxx or file:////xxx ?
Hello all,
Umm.. what chart?
Did you get your chart addon working (hopefully with easier instructions this time as i failed the last).
Please do update us on your progress! ;)
I have bad experience with posting a picture, it never appears correctly.

Anyone know the way to post picture in this forum?
http://www.mediafire.com/i/?chcjxcd45jllz3b
<a href="http://www.mediafire.com/i/?chcjxcd45jllz3b" target="_blank"><img src="http://www.mediafire.com/imgbnc.php/f8e19afbdd1e05a128ac6bd55be07bbb0dde14c406c21aa2a7da1d0d3219c4422g.jpg" border="0" alt="Unlimited Free Image and File Hosting at MediaFire"></a>
<a href="http://www.mediafire.com/i/?chcjxcd45jllz3b" target="_blank"><img src="http://www.mediafire.com/imgbnc.php/f8e19afbdd1e05a128ac6bd55be07bbb0dde14c406c21aa2a7da1d0d3219c4422g.jpg" border="0" alt="Unlimited Free Image and File Hosting at MediaFire"></a>
Great job Trungt .. keep up the good work.. really impressive.
Have you tried this with fusion charts .. It will really look amzing with fusion animation..just a thought..
KR..YB
That is awesome! Good job!
Any instructions for us to implement ourselves?
Trungvt,
You're using the FM4200 as it shows on the graph, i was wondering if you're getting all your data using the canbus connection or…. ?
Hi Kushalx,
I get all from FM except CANBUS just because I don't have any truck with this CAN interface.
Without CAN you can get temperature, driver ID, analog input, etc.
I try to simplified instruction and post soonest.
1. Assum that we already have some thing to draw a chart: Speed, BatteryVolts, Temperature, analog inputs, digital inputs or something in Event Detail Report. In this example I use Speed and Altitude.
2. Download jfreechart-1.0.13.jar and jcommon-1.0.16.jar, copy these 2 files into C:\OpenGTS_2.3.8\lib and into TomCat lib folder C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib. Restart TomCat.
3. In file EventDetailReport.java add getSupportsGraphDisplay() method, you can put at the end of this file, just before } character. This is to enable the link to Graph
4. In file ReportDisplay.java modify one line of method writePage.
Line
should be modify to
5. In C:\OpenGTS_2.3.8\src\org\opengts\war\track\page create new file EventChart.java, codes below:
6. Now build and deploy track.war.
7. Run, in Event Detail Report, above table you will see Graph link, click Graph, new chart window opened
8. click check box to choose the chart you want
Good luck
Hi,
Many thanks for such a great addition.
I ran the basic chart in your other post and all worked well.
However, in this example, after following the instructions very carefully, i have the following error when clicking the chart link from the report:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.io.FileNotFoundException: webapps\track\chart_t333.png (The system cannot find the path specified)
java.io.FileOutputStream.open(Native Method)
java.io.FileOutputStream.<init>(FileOutputStream.java:179)
java.io.FileOutputStream.<init>(FileOutputStream.java:131)
org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:318)
org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:293)
org.opengts.war.track.page.EventChart.TimeChart(EventChart.java:131)
org.opengts.war.track.page.EventChart._writeReportGraph(EventChart.java:46)
org.opengts.war.track.page.ReportDisplay.writePage(ReportDisplay.java:799)
org.opengts.war.track.Track._doWork(Track.java:1458)
org.opengts.war.track.Track._doWork_wrapper(Track.java:403)
org.opengts.war.track.Track.doGet(Track.java:302)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.opengts.war.track.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:75)
Any ideas? I gather it's not writing the png file.
both jfreechart files are in the WEBINF\lib folder
PS. i reset all the original files from the openGTS source before modifying them according to the instructions above.
Sincerely
Peter
Hi Peter,
I guess that you set working path of Tomcat different with default.
Please check in Tomcat configuration, on my computer, Working path is C:\Program Files\Apache Software Foundation\Tomcat 7.0
Hi,
it is wrong to run Tomcat with security disabled and write files in the ROOT context of an application.
With security enabled, you should create a sub-directory (in example is track/chart/) and do:
String prefix = "your path to $CATALINA_HOME";
String graphURL = "/track/chart/chart_"+ report.getFirstDeviceID()+".png";
try {
File file = new File(prefix+graphURL);
ChartUtilities.saveChartAsPNG(file, chart, 960, 520);
}
catch (IOException e) {
Print.logException("Error creating file: "+graphURL + " "+e.getLocalizedMessage(), e);
}
return graphURL;
}
But for this to work, add in catalina.policy file:
grant {
permission java.io.FilePermission "${catalina.home}/webapps/track/chart/-","read,write,delete";
};
Another problem would be an Array comparison with String:
boxChecked = ( Arrays.binarySearch( param, boxName) >= 0 )? "checked" : ""; pw.write(" <INPUT TYPE=\"checkbox\" NAME=\"param\" VALUE=\""+ boxName+"\" " + boxChecked+">" + boxName+"\n"); }
I think it should be:
boxChecked = ( Arrays.binarySearch( param, boxName) >= 0 )? "checked" : ""; pw.write(" <INPUT TYPE=\"checkbox\" NAME=\"param\" VALUE=\""+ boxName+"\" " + boxChecked+">" + boxName_+"\n"); }
Mihai
_
hmm, you experienced the same formatting problems when posting,
Dear Mihai,
In your previous post, you copied the same statement: -
Another problem would be an Array comparison with String:
boxChecked = ( Arrays.binarySearch( param, boxName) >= 0 )? "checked" : ""; pw.write(" <INPUT TYPE=\"checkbox\" NAME=\"param\" VALUE=\""+ boxName+"\" " + boxChecked+">" + boxName+"\n"); }
I think it should be:
boxChecked = ( Arrays.binarySearch( param, boxName) >= 0 )? "checked" : ""; pw.write(" <INPUT TYPE=\"checkbox\" NAME=\"param\" VALUE=\""+ boxName+"\" " + boxChecked+">" + boxName+"\n"); }
Did you mean to write something different in the second statement?
Am still stuck here with the errors below and will apppreciate alot if you can assist with the correct syntax for the above statement.
See below the errors am getting: -
java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String
java.lang.String.compareTo(String.java:109)
java.util.Arrays.binarySearch0(Arrays.java:2004)
java.util.Arrays.binarySearch(Arrays.java:1946)
org.opengts.war.track.page.EventChart._writeReportGraph(EventChart.java:59)
org.opengts.war.track.page.ReportDisplay.writePage(ReportDisplay.java:788)
org.opengts.war.track.Track._doWork(Track.java:1408)
org.opengts.war.track.Track._doWork_wrapper(Track.java:358)
org.opengts.war.track.Track.doGet(Track.java:288)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.opengts.war.track.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:75)
Regards,
w.mutinda
should be boxName
Hi trungvt,
Thanks. Now the graph widnow gets displayed with the various checkboxes but the graph itself doesnt get displayed. When l check in the path l have configured (i.e. /usr/local/apache-tomcat-6.0.32/webapps/gtse_charts), l find that the png file_ chart_kaw918n.png_ has been generated and opens well.
What do you think could be the issue?
Regards
Find below the output if you try to open the file from browser..
<html><head><title>Apache Tomcat/6.0.32 - Error report</title><style><!-H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-></style> </head><body><h1>HTTP Status 404 - /usr/local/apache-tomcat-6.0.32/webapps/gtsecharts/chart_kaw918n.png</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/usr/local/apache-tomcat-6.0.32/webapps/gtsecharts/chart_kaw918n.png</u></p><p><b>description</b> <u>The requested resource (/usr/local/apache-tomcat-6.0.32/webapps/gtsecharts/chart_kaw918n.png) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html>
Seems to be an access-related issue or what could it be?
Regards.
Hi wemmic
I think wrong path setting in your code, will work with simple path like this:
pw.write("<img src='"+graphURL+"'/>\n");
Hi trungvt,
What are the values of page_cmd_arg expected in the graph window URL? If l know this l can know where to do the correction.
See my current URL:
http://184.173.149.226:8081/track/Track?account=wmc&user=admin&device=KAW918N&page_cmd_arg&r_limit&date_tz=GMT%2b03%3a00&r_report=EventDetail&r_text&r_option&page=report.show&r_emailAddr=mwemmicip%40gmail.com&r_limType&date_fr=2012%2f01%2f08%2f00%3a00&page_cmd=rptsel&r_menu=menu.rpt.devDetail&date_to=2012%2f01%2f08%2f23%3a59&fmt=graph
I think to do with this because I got similar url
http://localhost:8080/track/Track?account=demo&user=admin&device=fm41&page_cmd_arg&r_limit&date_tz=GMT%2b07%3a00&r_report=EventDetail&r_text&r_option&page=report.show&r_emailAddr&r_limType&date_fr=2011%2f05%2f06%2f00%3a00&page_cmd=rptsel&r_menu=menu.rpt.devDetail&date_to=2011%2f05%2f06%2f23%3a59&fmt=graph
Hi guys,
l still havent managed to get this to work properly. Here is what am doing: -
1. Am setting the path for the png to {my tomcat home}/webapps/gtsecharts
2. l have then added the following in my catalina.policy file…
//grant permission to opengts chart temp storage location
grant {
permission java.io.FilePermission "${catalina.home}/webapps/gtsecharts/-","read,write,delete";
};
However, the PNG is generated and saved and if transferred to windows can open using any windows picture viewer. However, it doesnt diplay on the Graph page… it only displays an error icon to show the file could not be located or something like that.
Mihai/trungvt,
Have you successfully tested this in any linux platform with tomcat security enabled?
Regards.
Hi guys,
Sorry l forgot to paste the source of the html page generated for the graph. Just a question… is the format of the image src (see bold below) correct or it should start with something like http://xxx or file:////xxx ?
==========================================
<body>
<FORM ACTION="" METHOD=POST>
<INPUT TYPE="checkbox" NAME="param" VALUE="Speed" checked>Speed
<INPUT TYPE="checkbox" NAME="param" VALUE="Altitude" >Altitude
<INPUT TYPE="checkbox" NAME="param" VALUE="BatVolts" >BatVolts
<INPUT TYPE="checkbox" NAME="param" VALUE="Thermo1" >Thermo1
<INPUT TYPE="checkbox" NAME="param" VALUE="Fuel%" >Fuel%
<INPUT TYPE="submit" VALUE="Generate Chart">
</FORM>
<img src='/usr/local/apache-tomcat-6.0.32/webapps/gtsecharts/chart_kaw918n.png'/>
</body>
</html>
==========================================
Regards.
How about this line
pw.write("<img src='"+graphURL+"'/>\n");
You keep it the same or revised to your new path?
I assumed that you have 2 paths in webapps
{my tomcat home}/webapps/gtse for OpenGTS
and
{my tomcat home}/webapps/gtsecharts for png pictures
?
Hi trungvt,
Thanks very much… actually l had missed out on that line. l have made the following change and it now works well.
Replaced:
…
String graphURL = "chart_"+ report.getFirstDeviceID() +".png";
File file = new File("webapps/track/"+ graphURL); ChartUtilities.saveChartAsPNG(file, chart, 960, 520); //in EventDetailReport 1000,600
return graphURL;
}
with…
String prefix = "/usr/local/apache-tomcat-6.0.32/webapps/gtsecharts/";
String graphURL = "chart_"+ report.getFirstDeviceID()+".png";
try {
File file = new File(prefix + graphURL);
ChartUtilities.saveChartAsPNG(file, chart, 960, 520);
}
catch (IOException e) {
Print.logException("Error creating file: "+ prefix+graphURL + " "+e.getLocalizedMessage(), e);
}
return graphURL;
}
And also replaced the line:
pw.write("<img src='"+graphURL+"'/>\n");
with:
pw.write("<img src='../gtsecharts/"+graphURL+"'/>\n");
and now it works well.
Thanks very much for your support.
Regards.