Skip to content

LabelFormatter

ClassChartGuruChartGuru
public class LabelFormatter

Formats label text using placeholder tokens. Supports placeholders like {value}, {series}, {category}, {percent}, etc.

public CultureInfo Culture { get; set; }

Gets or sets the culture used for formatting numbers and dates.

Returns

System.Globalization.CultureInfo — No return description is available.

public string NumericFormat { get; set; }

Gets or sets the default format for numeric values.

Returns

System.String — No return description is available.

public string PercentFormat { get; set; }

Gets or sets the default format for percentage values.

Returns

System.String — No return description is available.

public string DateFormat { get; set; }

Gets or sets the default format for date values.

Returns

System.String — No return description is available.

public LabelFormatter()

Creates a new label formatter with default settings.

public LabelFormatter(CultureInfo culture)

Creates a new label formatter with the specified culture.

Parameters

Name Type Description
culture System.Globalization.CultureInfo

public string Format(string template, LabelContext context)

Formats a label template using the provided context.

Parameters

Name Type Description
template System.String Template string with placeholders.
context ChartGuru.LabelContext Context providing values for placeholders.

Returns

System.String — Formatted string with placeholders replaced.

public static string ValueLabel(float value, string format = "F1")

Creates a simple label showing only the value.

Parameters

Name Type Description
value System.Single
format System.String

Returns

System.String — No return description is available.

public static string SeriesValueLabel(string seriesName, float value, string format = "F1")

Creates a label showing series name and value.

Parameters

Name Type Description
seriesName System.String
value System.Single
format System.String

Returns

System.String — No return description is available.

public static string CategoryValueLabel(string category, float value, string format = "F1")

Creates a label showing category and value.

Parameters

Name Type Description
category System.String
value System.Single
format System.String

Returns

System.String — No return description is available.

public static string PieLabel(string name, float percent, string format = "F1")

Creates a pie/donut label showing name and percentage.

Parameters

Name Type Description
name System.String
percent System.Single
format System.String

Returns

System.String — No return description is available.