Hi,
These are lines of code as taken from the examples for plotting functions in TeeChart:
Custom function to calculate y = f(x) values using a CalculateEvent:
private void custom1_CalculateEvent(object sender, Steema.TeeChart.Functions.CalculateEventArgs e)
{
// y = Sin(x/10)
e.Y = Math.Sin(e.X*0.1);
}
I need to plot the function y = mx + c (a linear equation) in my graph.
How can I do it?
Note: I am using TChart ver 1.1
Thanks in Advance
Vikas Kashyap
Can we create our own Custom Function ?
-
- Newbie
- Posts: 10
- Joined: Fri Jul 02, 2004 4:00 am
- Contact:
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Vikas,
Have you tried doing something like this?
Have you tried doing something like this?
Code: Select all
private void custom1_CalculateEvent(object sender, Steema.TeeChart.Functions.CalculateEventArgs e)
{
// y = Mx+C
e.Y = e.X*m + c;
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Defining custom CalculateEvent handler
I would like to ask how should I define the handler for my custom function?
Should it be something like this:
?
If so, how to form the proper list of arguments for this event handler?
A code snippet would be very handy, it's totally on fire!
Thanks in advance!
Should it be something like this:
Code: Select all
myCustomFunction.CalculateEvent += custom1_CalculateEvent(XXXXXXXXXXXXXX
If so, how to form the proper list of arguments for this event handler?
A code snippet would be very handy, it's totally on fire!
Thanks in advance!
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi sunjun,
You can call the event handler like this:
And event's implementation:
Also Visual Studio .NET really helps with this implementation, when you type myCustomFunction.CalculateEvent +=, after typing the equals symbol the code completion starts working nicelly and suggests the event handler call and it offers you the change to automatically generate the event implementation by pressing Tab key.
You can call the event handler like this:
Code: Select all
myCustomFunction.CalculateEvent += new Steema.TeeChart.Functions.CalculateEventHandler(myCustomFunction_CalculateEvent);
Code: Select all
void myCustomFunction_CalculateEvent(object sender, Steema.TeeChart.Functions.CalculateEventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |