As per my response in your cross-post: please show us your attempt first. There are some great sample codes to be found in this and other fora, and feel free to adapt these to your purposes, but you will learn nothing by doing what amounts to here as a "homework dump". Please feel free to show some initiative, and then come on back with specific questions regarding your code.
Best of luck.
The other post that you posted in has a complete program that shows graphing. Why not play with that code a bit and see what you come up with? You'll learn a whole lot more in the process.
If you want to get fancy, there are graphics and plotting libraries out there for you to try, but these need to be downloaded, and some require payment to get the instruction manuals.
thank you for your great help ;)
Um, you're welcome (I think).
BTW, two graphics libraries that I've seen in use a few years ago, are JGraph and JFreeChart. I know that the latter is still around but am not sure about the former. Most of the basic uses of these are straight forward and don't require the documentation.