Recent

Author Topic: 3D chart....  (Read 2120 times)

mpknap

  • Jr. Member
  • **
  • Posts: 79
3D chart....
« on: March 17, 2018, 07:05:11 pm »
I have a file with 2d graphics. How to make a graph like this 3d. The first picture is the detection of muons with a webcam. To make it better, I would like something like a 3d chart. I am writing in Lazarus Pascal for Windows. I am a beginner and the best code would interest me :)

wp

  • Hero Member
  • *****
  • Posts: 6233
Re: 3D chart....
« Reply #1 on: March 17, 2018, 07:16:09 pm »
I don't know of a free 3d-plotting library for Lazarus. What I would do in your case is to call gnuplot (http://gnuplot.info/) in a separate process, have it plot to a graphics file and display this file in my program, similar to the "gnuplotter" in this thread: https://forum.lazarus.freepascal.org/index.php/topic,23839.msg253759.html#msg253759

To get an idea of the 3d capabilities of gnuplout you should look at http://gnuplot.sourceforge.net/demo_5.2/pm3d.html.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

mpknap

  • Jr. Member
  • **
  • Posts: 79
Re: 3D chart....
« Reply #2 on: March 17, 2018, 07:45:32 pm »
It looks nice but I would like a 3d graph in image.canvas in my program...

wp

  • Hero Member
  • *****
  • Posts: 6233
Re: 3D chart....
« Reply #3 on: March 17, 2018, 11:55:12 pm »
Maybe you did not understand: the plot is not in a separate gnuplot window but integrated into your own program - look at attached screenshot. What your program has to do is to generate the gnuplot script from your data, start gnuplot in the background with this script, catch the output image and load it into a TImage component on your form.

The only problem is maybe that the plot is static, i.e. you cannot zoom or change the perspective - well you could invoke gnuplot after each change, but this certainly will not be a smooth operation.
« Last Edit: March 17, 2018, 11:58:10 pm by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10