JOpenChart dates on x axis - java

I am trying to use JOpenChart, unfortunately, the documentation stinks, not even a javadoc as far as I can see.
My problem is that I am trying to use a date on the x axis, and I don't see how this is done. The tutorial implies that I need to use ObjectChartDataModel, but the constructor takes DataSet[] instead of DefaultDataSet[], which is probably fine. I assume one can polymorph to the other (hard to know for sure because, no javadoc is provided), but it takes an Object[] as a second parameter and I have no idea what that is.
Does anyone know this tool that can either answer my question or at least point me at where the documentation exists. The only documentation he seems to offer is this: http://jopenchart.sourceforge.net/tutorial.html which is nice, but doesn't really cover all the bases.

May I suggest http://www.jfree.org/jfreechart/ or if you can afford it http://www.jidesoft.com/products/charts.htm. I've used both and they each have their strengths. The chart you are trying to use I never had much luck with.

Related

Why not to use switch case statments?

I just want to get some information before I go ask my teacher during his offices hours tomorrow.
We have have project to do thats something like an iclicker question answer collector. He told us to avoid using switch case statements. I was just wondering why and why don't people in the field like using them, what alternative is there to do? and I doubt he wants us to use if statements either.
I think we have to use polymorphism/interfaces but I just cant rap my head around that, switch cases seems so much straight forward.
Thank you.
Usually when an instructor asks "don't use feature X", it's because they want you to learn how to do something without using a feature that might be a shortcut. In your case, it sounds like your instructor wants you to wrap your head around polymorphism. If you don't, you won't learn that bit and will have much more trouble later in the class.
It depends upon the project. For example, in using a RESTful APi, you do have switch statements because there is a limit, known set. But, with your program there might be a lot of different options and that option can change, increase (or decrease), so while you started out with three cases, then something else is wanted, that's four, then five, and so on. You end up with 50 cases, and that's probably not good or easy to maintain.
With your OOP class, the instructor is probably going to show you that. Come back and show the whole problem and the final result, and maybe others can shed light.
There's an example that I've seen in my old Java book, and did a search and see it is still decent. Consider employees and salaries. You have three types of employees, then you have 50 types.
On a small scale, there appears to be not much difference. It requires enlarging the problem and considering consequences.
Ways to eliminate switch in code
That is a good example. Sure, there's only two cases in that example. But, again, what if it were 50? How easy will it be to maintain that? A lot of things in programming are about saving time and making things logical in the long run, as you will be coming back to your code or someone else's, and you have to maintain and support it.

JavaPlot: How can I use the fit method of GNUPlot?

I have a set of 6 points. Now I want to create a trend line (fifth-degree polynomial). I don't have much experience with GNUPlot, yet, but I found the "fit" method which should do exactly what I want. The problem is that I don't know how to call the method within JavaPlot. Even if it wasn't implemented in JavaPlot it should be possible to use that method somehow, right? The JavaPlot website even states:
Moreover, is flexible enough to give special parameters to gnuplot, even if the library does not support it (yet).
Does anyone know how I can plot a fitted (trend) line in JavaPlot?
JavaGnuplotHybrid might be a solution. It allows hybrid programming with Java and gnuplot, which means all gnuplot features are supported. You need to learn some bit about gnuplot first though.
For more details:
Project page: https://github.com/mleoking/JavaGnuplotHybrid
Wikipedia: https://en.wikipedia.org/wiki/JavaGnuplotHybrid

Java Library for Steady State Solution for DTMCs

I have been using jMarkov for analyzing CTMCs. This appears to be the most well defined Java library for this purpose. One of the part in my analysis also requires Steady State Solution of a DTMC. Though jMarkov manual mentions that it can handle DTMCs as well but the authors seem to have ignored the case. The documentation of the library, hence, seems to be incomplete.
Can someone guide me through jMarkov OR point me to a part in the manual that can be useful? If there exists another library I could use, that would be great as well. Additionally, I would be okay if someone could point me to a Java implementation that just helps me find Eigenvector of a Matrix.
Thanks!
Maybe not for you but for someone else who wants to try jMarkov, there are thw possible solutions for this issue:
First, i think jMarkov claims to handle DTMC as any DTMC can be transformed into a CTMC in a normalization process. So you have to transform your DTMC into a CTMC in order to take advantage of jMarkov.
Second, I'm sure jMarkov also allows to handle DTMC without normalization. If you specify your problem a little bit we could build an example from your problem.
Regards,

image pattern matching in java

Earlier i was searching for fingerprint recognisation in java, but didn't find anything how to implement. So, now i have decided to just matching the pattern of two images of fingerprint after getting fingerprint manually. And then, compare their pattern. And i think, this can be done by comparing two image and matching their pixel similarity (as per my finding).
So, now i am looking for any API/library/SDK/framework or anything available in Java, for comparing pattern of two images and getting the percentage match between them.
I'll appreciate any idea !!
Have a look at WEKA. There might be something in there for your needs, but as Stefan Kendall already mentioned it's not easy at all.
Also, http://opencv.willowgarage.com/wiki/ might be useful, but unfortunately there is no java version yet.
I haven't used it, or even properly studied it - but from what I have seen, this project may help you. (Currently it is for Java and .NET):
http://sourceforge.net/projects/biometricsdk/

Java library for creating straight skeleton?

I have as an input a 2D polygon with holes, and I need to find it's straight skeleton, like in the picture:
(source: cgal.org)
Maybe there is a good Java library for it?
And if not, can you point me to the good explanation of the algorithm, so I could implement it myself? (I haven't found good resources on Google)
I wrote this a little while back. Not sure if it's robust enough.
https://github.com/twak/campskeleton
(edited for 2018...)
See http://www.sable.mcgill.ca/~dbelan2/roofs/roofs.html which contains an applet.
You may be able to use the JTS Topology Suite. It is a very capable library that I've used on a number of projects - never for straight skeleton, but it may be possible.
Edit:
Ah. I see that "Straight Skeleton" is a technical term. The wikipedia article references several algorithms. Have you looked at those?
As I understand it, you have a (convex?) polygon. From it, you subtract 1 or more (potentially non-convex) polygons. You want to turn the result into a set of polygons without holes. Are there extra rules that you're trying to apply?
I have a hard time coming up with a set of rules from the example that you provided. The outer polygons are non-convex; so it doesn't seem like you're trying to find a convex set to represent the result (which is a relatively common task).
If you could use the breakdown shown below, the algorithm is pretty simple. Can you clarify?
Can I ask u what is your purpose for finding Straight skeleton? Is it personal or commercial? I would be interested in knowing how you r using it to solve real time problems? I do have a java library that does that. My algorithm is listed here http://web.stcloudstate.edu/rsarnath/skeleton/definition.htm

Categories

Resources