### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: [SOLVED] Graphing the equation for angle of trajectory using TCHART  (Read 2842 times)

#### sunbreezy393

• New Member
• Posts: 11
##### [SOLVED] Graphing the equation for angle of trajectory using TCHART
« on: December 30, 2015, 07:06:20 pm »
I am new to using Pascal/T Charts and was wandering how you would graph the equation for the angle of trajectory?

« Last Edit: January 02, 2016, 12:54:38 am by sunbreezy393 »

#### wp

• Hero Member
• Posts: 7923
##### Re: Graphing the equation for angle of trajectory using TCHART
« Reply #1 on: December 30, 2015, 07:13:06 pm »
http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Function_Series is a tutorial with step-by-step instructions on how to plot functions with TAChart.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### sunbreezy393

• New Member
• Posts: 11
##### Re: Graphing the equation for angle of trajectory using TCHART
« Reply #2 on: December 30, 2015, 07:18:04 pm »
Thanks for your help, but I have looked at this and it seems to work if z and v are constants but not when they are variables.

#### wp

• Hero Member
• Posts: 7923
##### Re: Graphing the equation for angle of trajectory using TCHART
« Reply #3 on: December 30, 2015, 07:28:23 pm »
So, you have a function of 2 variables, z = f(x,y)? You can use a TColorMapSeries where one variable runs along the x and the other variable along the y axis, and z is encoded as color shades. Have a look at http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_ColorMapSeries,_Zooming.

But maybe I do not understand your question correctly. Can you post a link or a sketch from which I could guess what the chart is supposed to look like?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### sunbreezy393

• New Member
• Posts: 11
##### Re: Graphing the equation for angle of trajectory using TCHART
« Reply #4 on: December 30, 2015, 09:11:12 pm »
Here is an image of what the graph looks like

#### wp

• Hero Member
• Posts: 7923
##### Re: Graphing the equation for angle of trajectory using TCHART
« Reply #5 on: December 30, 2015, 11:08:19 pm »
Not straightforward, probably too much for a beginner...

Paint the parabola by using the TFunctionSeries mentioned above, or a standard TLineSeries
Then add an event handler to the OnAfterDraw event of the chart. Here you select the points of further analysis where you calculate the tangent vector, decompose it into its x and y components and paint the corresponding lines and arrows. Find information on the OAfterDraw painting in http://wiki.lazarus.freepascal.org/TAChart_Tutorial:_Background_design.

Since this project looks like some homework assignment I do not want to give more details, sorry.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

#### jmpessoa

• Hero Member
• Posts: 1727
##### Re: Graphing the equation for angle of trajectory using TCHART
« Reply #6 on: December 31, 2015, 01:20:47 am »

Hello sunbreezy393!

https://github.com/jmpessoa/tfpmathexpressionbridge

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

#### sunbreezy393

• New Member
• Posts: 11
##### Re: [SOLVED] Graphing the equation for angle of trajectory using TCHART
« Reply #7 on: January 02, 2016, 12:51:58 am »
Thank you very much for all your help, I have fixed the problem now.