简体   繁体   中英

LWJGL 3 as a method of drawing charts

A friend asked me to develop a chart setup for a machine he is building. He has some very specific requirements about how the charts need to be displayed, and no existing api will satisfy those requirements. So I need to make a custom chart renderer, one option was to just take any java 2D canvas or to use OpenGL, which would be LWJGL. I used LWJGL 2 in the past, and i know it can be a canvas element, while LWJGL 3 can't. So the only solution I can have here is either have it broken up in frames like Gimp is, or have the gui as part of the LWJGL 3 frame. Those solutions are not appreciated for what needs to be done. Is there a way I could wrap the LWJGL 3 frame as a internal frame, or anything to make it stick to a java swing or java fx gui?

I use Java because I know it best, I don't have so much experiences in other languages.

Look here is an interval chart:

在此处输入图片说明

I cant fit all the code on here unforunately, I will post it on github. But anything you can imagine can be done, I am not going to go through every way jfreechart can be customized but with some digging you can find the answers.

You can find the code on https://github.com/derrick3192/sliderchartdemo.git

If you want to add zoom buttons and what not I suggest you look at the:

plot.getDomainAxis().setRange

Or

plot.getRangeAxis().setRange

But I don't mean this offensivily but you can't come on stackoverflow with low rep (even though I don't have much rep) and claim all the charting libraries are not good enough, and you have to make your own, you will get downvoted for that so tread lightly.

Another solution is to use JOGL instead of LWJGL3 since it can be used as a canvas. Works in a similar way, and the same thing can be achieved with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM