Recent

Author Topic: TChart maps?  (Read 4434 times)

flori

  • Full Member
  • ***
  • Posts: 196
TChart maps?
« on: December 12, 2021, 08:46:25 pm »
Dear All!

Does anyone know what type of TChart can I show the differentiated range (soil pH range) on the map? (I attached what I want)
I have a lot of data: xy coordinate
X (pH range)      y(soil type)
7.4                     1
8                        2
7.4                     1
8.1                     2

All data recorded in a database (GBD)

Thank you!

wp

  • Hero Member
  • *****
  • Posts: 9578
Re: TChart maps?
« Reply #1 on: December 12, 2021, 11:29:23 pm »
Basically you need the TChartColorMapSeries which fills the drawing area by rectangles of size StepX/StepY; for each rectangle, centered at the point x/y, a function is calculated at x/y, and the function value is mapped to a color which is used to fill the rectangle. Of course, when StepX/StepY are 1, very smooth color shades can be achieved.

The series is described in a tutorial, https://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming, the tutorial project is ready to use in the folder components/tachart/tutorial/mandelbrot of your Lazarus installation. Another demo can be found in folder components/tachart/demo/func, page "Color map".

Your problem is that your data points do not densely cover the x/y plane, and you somehow must interpolate. A long time ago, I wrote an interpolation unit to be attached to the ColorMapSeries - I am enclosing a demo project showing its application. But still, this interpolation unit assumes that the data points are on a regular grid in the x/y plane. If you have randomly located data points you must work through the math and write an interpolation on your own.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

avra

  • Hero Member
  • *****
  • Posts: 2331
    • Additional info
Re: TChart maps?
« Reply #2 on: December 13, 2021, 12:01:53 am »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

flori

  • Full Member
  • ***
  • Posts: 196
Re: TChart maps?
« Reply #3 on: December 13, 2021, 01:44:07 pm »
Thank you everyone!

 

TinyPortal © 2005-2018