Wednesday, May 27, 2009

JFreeChart and Time-based Bar Charts

Ok... I do not get many comments on my posts (because they are short and boring) but am really looking for people to comment on this one because I am looking for feedback.

I have used CeWolf/JFreeChart for about two years now (off and on). If someone asked me to rank my knowledge of them (1 to 10) I would answer 5 - not an expert, not a novice. Recently, it has become common for my users to want time-based charts. It seems that JFreeChart does not provide much utility for building bar charts based on time series. Am I seeing this correctly? or am I failing to understand a fundamental concept of JFreeChart? (or... other?)

Any feedback?

Tuesday, May 5, 2009

Modify Windows Services Configuration

This is mainly for my reference, but I wanted to modify the description associated with some Services in my installation of Windows. I found the following website the most helpful... I am sure there are more:
http://www.opssys.com/instantkb/article.aspx?id=10576&cNode=7G3A2L

I used the following two lines to do what I wanted:
sc query state= all | findstr "DISPLAY_NAME STATE" >svc.txt
sc description {service_name} "description_goes_here"

Force Displaytag Export to Text

When I was using displaytag to export to excel, one of my columns contained text which was being recognized as numeric (scientific notation). When googling for a possible solution, seems like a LOT of people have had this problem in various ways (displaytag or otherwise). Thanks to this webpage, my solution was to write the following column decorator:


Custom Decorator

<jsp:scriptlet>
request.setAttribute("yourdecorator", new DisplaytagColumnDecorator() {
public Object decorate(Object o, PageContext pageContext, MediaTypeEnum media) {
String decorated = (String)o;
if (media.equals(MediaTypeEnum.EXCEL) || media.equals(MediaTypeEnum.CSV)) {
decorated= "=\"" + packet + "\"";
}

return decorated
}
}
);
</jsp:scriptlet>

<display:column title="your-title" media="xml excel csv" property="your-property" decorator="yourdecorator" />



I have not run into any issues with this approach yet. If you do, I would appreciate a comment back. Thanks again to the guy who posted the hint that I reference previously.

p.s. Someone also suggested that I prepend the text with a unicode non-breaking space (see code following). Visually, it has the desired effect but it also modifies the text in the field so I do not like the solution as well. I just offer that solution to those who might want to use it.


Custom Decorator

...
decorated= "\u00a0" + packet;