MindFusion.Charting Programmer's Guide

LineChart.CalculateFunction Field

See Also
 





Invokes a custom function that calculates the values for the chart.

Namespace: MindFusion.Charting
Assembly: MindFusion.Charting

 Syntax

C#  Copy Code

public CalculateFunctionDelegate CalculateFunction (float xValue, FunctionArgs e)

Visual Basic  Copy Code

Public CalculateFunction As CalculateFunctionDelegate (ByVal xValue As Single, ByVal e As FunctionArgs)

JavaScript  Copy Code

var CalculateFunction

 Example

The following example:

  • Creates a line chart
  • Sets the chart data with a delegate, which calculates the sine function in the interval [-3, 3];

C#  Copy Code

/// <summary>
/// The sine function.
/// </summary>
public float CalculateFunction(float xVal, MindFusion.Charting.FunctionArgs e)
{
 return (float)Math.Sin((double)xVal);
}

// ...

// Create the chart
MindFusion.Charting.LineChart chart = new MindFusion.Charting.LineChart(MindFusion.Charting.LineTypes.Line);

// Add the delegate
chart.CalculateFunction = new MindFusion.Charting.CalculateFunctionDelegate(CalculateFunction);

// Set the interval of calculation
chart.FunctionArguments = new MindFusion.Charting.FunctionArgs(-3, 3);

 See Also