Skip to main content

DoughnutOptions

Namespace: Wisej.Web.Ext.ChartJS3

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

Options for the Doughnut chart.

public class DoughnutOptions : Options

The Options property returns an instance of this class when ChartType is Doughnut.

Example:

this.chartJS31.ChartType = ChartType.Doughnut;

var options = (DoughnutOptions)this.chartJS31.Options;
options.Cutout = 80;
options.Plugins.Title.Text = "Budget";

Constructors​

Instance member DoughnutOptions()​

Default constructor.

Creates a standalone DoughnutOptions set that is not yet attached to a ChartJS3 control. Assign it to the Options property of a doughnut chart.

Example:

var options = new DoughnutOptions();
options.Cutout = 70;

this.chartJS31.ChartType = ChartType.Doughnut;
this.chartJS31.Options = options;

Instance member DoughnutOptions(chart, defaults)​

Constructs a new instance of the DoughnutOptions set.

NameTypeDescription
chartChartJS3The ChartJS3 that owns this set of options.
defaultsOptionsDefault options to copy from. Can be null.

When defaults is not null, the properties shared with it (for example Plugins, Scales or IndexAxis) are copied into the new instance, which is how the chart preserves the common settings when ChartType changes. Nested option sets are copied into new instances, other properties are copied only when they have a non-default value. The ChartJS3 control creates this instance automatically when ChartType is Doughnut.

Example:

var options = new DoughnutOptions(this.chartJS31, this.chartJS31.Options);
options.Cutout = 40;
this.chartJS31.Options = options;

Properties​

Instance member Cutout​

Int32: Returns or sets the size of the inner part of the chart that is cut out. (Default: 50)

Value: The size of the cut out area. The default is 50.

Serialized as the Chart.js 3 cutout option. Chart.js 3 interprets a numeric cutout as a size in pixels (a percentage requires a string such as "50%", which this property can't express), so the value is the radius in pixels of the hole in the middle of the chart. A value of 0 draws a filled pie. Changing the value calls Update.

Example:

// draw a thin ring.
var options = (DoughnutOptions)this.chartJS31.Options;
options.Cutout = 120;