TrendLinePlot
public class TrendLinePlot : ChartMark, IChartMark, IChartContentFirst-class trend line mark that wraps ChartGuru.TrendLineUtils regression
calculations into a renderable chart mark implementing ChartGuru.IChartContent.
Swift Charts equivalent: LinearRegressionPlot(x:y:) (ChartGuru extends beyond
linear to polynomial, exponential, logarithmic, and power regressions).
Constructors
Section titled “Constructors”
TrendLinePlot(Vector2[], RegressionType)
Section titled “TrendLinePlot(Vector2[], RegressionType)”public TrendLinePlot(Vector2[] sourcePoints, RegressionType type = RegressionType.Linear)Creates a regression plot over the supplied XY samples. A null point array is rejected.
Parameters
| Name | Type |
|---|---|
sourcePoints |
UnityEngine.Vector2[] |
type |
ChartGuru.RegressionType |
TrendLinePlot(float[], float[], RegressionType)
Section titled “TrendLinePlot(float[], float[], RegressionType)”public TrendLinePlot(float[] xValues, float[] yValues, RegressionType type = RegressionType.Linear)Creates a regression plot by pairing X and Y arrays up to the shorter length. Null arrays are rejected.
Parameters
| Name | Type |
|---|---|
xValues |
System.Single[] |
yValues |
System.Single[] |
type |
ChartGuru.RegressionType |
Methods
Section titled “Methods”
FromData(IEnumerable, Func<T, float>, Func<T, float>, RegressionType)
Section titled “FromData(IEnumerable, Func<T, float>, Func<T, float>, RegressionType)”public static TrendLinePlot FromData<T>(IEnumerable<T> data, Func<T, float> xSelector, Func<T, float> ySelector, RegressionType type = RegressionType.Linear)Creates a trend-line plot from the supplied source records and projection callbacks.
Parameters
| Name | Type |
|---|---|
data |
System.Collections.Generic.IEnumerable{{T}} |
xSelector |
System.Func{{T},System.Single} |
ySelector |
System.Func{{T},System.Single} |
type |
ChartGuru.RegressionType |
Returns
ChartGuru.TrendLinePlot
GetMarks()
Section titled “GetMarks()”public IEnumerable<IChartMark> GetMarks()Expands this composite content into individual chart marks for rendering.
Returns
System.Collections.Generic.IEnumerable{ChartGuru.IChartMark}: Enumerable of primitive chart marks.
RegressionType(RegressionType)
Section titled “RegressionType(RegressionType)”public TrendLinePlot RegressionType(RegressionType type)Selects the regression model fitted to the trend-line source points.
Parameters
| Name | Type |
|---|---|
type |
ChartGuru.RegressionType |
Returns
ChartGuru.TrendLinePlot
PolynomialDegree(int)
Section titled “PolynomialDegree(int)”public TrendLinePlot PolynomialDegree(int degree)Sets the polynomial regression degree used when polynomial fitting is selected.
Parameters
| Name | Type |
|---|---|
degree |
System.Int32 |
Returns
ChartGuru.TrendLinePlot
Samples(int)
Section titled “Samples(int)”public TrendLinePlot Samples(int count)Sets how many evenly spaced samples are generated across a function plot domain.
Parameters
| Name | Type |
|---|---|
count |
System.Int32 |
Returns
ChartGuru.TrendLinePlot
Domain(float, float)
Section titled “Domain(float, float)”public TrendLinePlot Domain(float min, float max)Sets the numeric input domain sampled by the plot; values outside the interval are not generated.
Parameters
| Name | Type |
|---|---|
min |
System.Single |
max |
System.Single |
Returns
ChartGuru.TrendLinePlot
LineStyle(float)
Section titled “LineStyle(float)”public TrendLinePlot LineStyle(float width)Configures line width and dash behavior; selector overloads resolve the stroke separately for each datum.
Parameters
| Name | Type |
|---|---|
width |
System.Single |
Returns
ChartGuru.TrendLinePlot
LineStyle(StrokeStyle)
Section titled “LineStyle(StrokeStyle)”public TrendLinePlot LineStyle(StrokeStyle style)Configures line width and dash behavior; selector overloads resolve the stroke separately for each datum.
Parameters
| Name | Type |
|---|---|
style |
ChartGuru.StrokeStyle |
Returns
ChartGuru.TrendLinePlot
ForegroundStyle(Color)
Section titled “ForegroundStyle(Color)”public TrendLinePlot ForegroundStyle(Color color)Configures the fill or stroke color used by generated marks; selector overloads resolve the style separately for each datum.
Parameters
| Name | Type |
|---|---|
color |
UnityEngine.Color |
Returns
ChartGuru.TrendLinePlot
ShowEquation(bool)
Section titled “ShowEquation(bool)”public TrendLinePlot ShowEquation(bool show = true)Controls whether the fitted trend-line equation is exposed as an annotation.
Parameters
| Name | Type |
|---|---|
show |
System.Boolean |
Returns
ChartGuru.TrendLinePlot
ShowRSquared(bool)
Section titled “ShowRSquared(bool)”public TrendLinePlot ShowRSquared(bool show = true)Controls whether the fitted coefficient of determination is exposed with the trend-line annotation.
Parameters
| Name | Type |
|---|---|
show |
System.Boolean |
Returns
ChartGuru.TrendLinePlot
GetMorphTargets(ChartType, Rect)
Section titled “GetMorphTargets(ChartType, Rect)”public override (Vector2 source, Vector2 target) GetMorphTargets(ChartType targetType, Rect plotArea)Projects this mark into plot-space geometry that the morph renderer can interpolate toward the requested chart type.
Parameters
| Name | Type |
|---|---|
targetType |
ChartGuru.ChartType |
plotArea |
UnityEngine.Rect |
Returns
System.ValueTuple{UnityEngine.Vector2,UnityEngine.Vector2}
Clone()
Section titled “Clone()”public override IChartMark Clone()Creates an independent copy of this Trend Line Plot; later configuration changes do not affect the original instance.
Returns
ChartGuru.IChartMark
Properties
Section titled “Properties”
MarkType
Section titled “MarkType”public override ChartType MarkType { get; }Returns
ChartGuru.ChartType
IChartContent_DataPoint
Section titled “IChartContent_DataPoint”public DataPoint IChartContent_DataPoint { get; }Returns
ChartGuru.DataPoint
RegressionKind
Section titled “RegressionKind”public RegressionType RegressionKind { get; }Returns
ChartGuru.RegressionType
RSquared
Section titled “RSquared”public float RSquared { get; }Returns
System.Single
EquationText
Section titled “EquationText”public string EquationText { get; }Returns
System.String
ShowsEquation
Section titled “ShowsEquation”public bool ShowsEquation { get; set; }Returns
System.Boolean
ShowsRSquared
Section titled “ShowsRSquared”public bool ShowsRSquared { get; set; }Returns
System.Boolean