Skip to main content

OptionsLegend

Namespace: Wisej.Web.Ext.ChartJS

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

Represents the options for the chart legend.

public class OptionsLegend : OptionsBase

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

Example:

var legend = this.chartJS1.Options.Legend;
legend.Display = true;
legend.Position = HeaderPosition.Bottom;
legend.Labels.UsePointStyle = true;

Constructors​

Instance member OptionsLegend()​

Default constructor.

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

Example:

var legend = new OptionsLegend();
legend.Position = HeaderPosition.Bottom;
this.chartJS1.Options.Legend = legend;

Instance member OptionsLegend(owner)​

Constructs a new instance of the OptionsLegend set.

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

Throws:

Example:

var options = this.chartJS1.Options;
var legend = new OptionsLegend(options);
legend.Display = false;
options.Legend = legend;

Properties​

Instance member Display​

Boolean: Shows or hides the legend block. (Default: True)

Value: true (default) to show the legend; false to hide it.

Example:

// a single data set doesn't need a legend.
this.chartJS1.Options.Legend.Display = this.chartJS1.DataSets.Count > 1;

Instance member Labels​

OptionsLegendLabels: Returns or sets the options for the labels in the legend.

Value: An OptionsLegendLabels instance, created automatically on first access.

Throws:

Example:

var labels = this.chartJS1.Options.Legend.Labels;
labels.BoxWidth = 20;
labels.Padding = 15;
labels.Font = new Font("Segoe UI", 10F);

Instance member Position​

HeaderPosition: Returns or sets the position of the legend. (Default: Top)

Value: Either Top (default) or Bottom.

Throws:

Example:

this.chartJS1.Options.Legend.Position = HeaderPosition.Bottom;