Skip to main content

OptionsLegendLabels

Namespace: Wisej.Web.Ext.ChartJS

Assembly: Wisej.Web.Ext.ChartJS (4.1.0.0)

Represents the options for the labels in the chart legend.

public class OptionsLegendLabels : OptionsBase

An instance of this class is exposed by Labels and maps to the legend.labels configuration of Chart.js.

Example:

var labels = this.chartJS1.Options.Legend.Labels;
labels.UsePointStyle = true;
labels.Padding = 20;

Constructors​

Instance member OptionsLegendLabels()​

Default constructor.

Creates a set of legend label options that is not yet attached to an owner.

Example:

var labels = new OptionsLegendLabels();
labels.BoxWidth = 12;
this.chartJS1.Options.Legend.Labels = labels;

Instance member OptionsLegendLabels(owner)​

Constructs a new instance of the OptionsLegendLabels set.

NameTypeDescription
ownerOptionsBaseThe OptionsBase instance (usually the OptionsLegend) that owns this set of options.

Throws:

Example:

var legend = this.chartJS1.Options.Legend;
var labels = new OptionsLegendLabels(legend);
labels.UsePointStyle = true;
legend.Labels = labels;

Properties​

Instance member BoxWidth​

Int32: Returns or sets the width of the colored box. (Default: 40)

Value: The width in pixels. The default is 40.

Example:

// small square markers.
this.chartJS1.Options.Legend.Labels.BoxWidth = 12;

Instance member Color​

Color: Returns or sets the color of the legend labels. (Default: Color [Empty])

Value: The default is Empty.

The value is sent to the client as the legend.labels.color option.

Example:

this.chartJS1.Options.Legend.Labels.Color = Color.DarkSlateGray;

Instance member Font​

Font: Returns or sets the font of the legend labels. (Default: null)

Value: When not set (null), returns the Font of the owner ChartJS control.

The font is converted on the client to the Chart.js fontSize, fontFamily and fontStyle options.

Example:

this.chartJS1.Options.Legend.Labels.Font = new Font("Arial", 11F, FontStyle.Bold);

Instance member Padding​

Int32: Returns or sets the padding between labels (rows of colored boxes). (Default: 10)

Value: The padding in pixels. The default is 10.

Example:

this.chartJS1.Options.Legend.Labels.Padding = 20;

Instance member UsePointStyle​

Boolean: Returns or sets whether the legend uses the point style of each dataset instead of a rectangle to identify it. (Default: False)

Value: The default is false.

When true, the size of the legend marker is based on the font size instead of BoxWidth.

Example:

this.chartJS1.ChartType = ChartType.Line;
this.chartJS1.Options.Legend.Labels.UsePointStyle = true;