Skip to main content

DoughnutDataSet

Namespace: Wisej.Web.Ext.ChartJS

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

Specialized data set for the Doughnut chart.

public class DoughnutDataSet : DataSet

Add creates a DoughnutDataSet when ChartType is Doughnut. Each value in Data is a segment, usually with its own color.

Example:

this.chartJS1.ChartType = ChartType.Doughnut;
this.chartJS1.Labels = new[] { "Desktop", "Mobile", "Tablet" };

var ds = (DoughnutDataSet)this.chartJS1.DataSets.Add("Devices");
ds.Data = new object[] { 55, 35, 10 };
ds.BackgroundColor = new[] { Color.Tomato, Color.Gold, Color.MediumSeaGreen };

Constructors​

Instance member DoughnutDataSet()​

Constructs a new instance of DoughnutDataSet.

Sets Type to Doughnut.

Example:

this.chartJS1.ChartType = ChartType.Doughnut;
this.chartJS1.DataSets.Add(new DoughnutDataSet
{
Label = "Devices",
Data = new object[] { 55, 35, 10 }
});

Properties​

Instance member BackgroundColor​

Color[]: Returns or sets the fill colors of the data set. One entry is the default color for all the slices, otherwise each slice can define a background color.

Value: An array of Color values, usually one for each value in Data, or null to use the Chart.js default.

Hides BackgroundColor. When the array contains a single color, it's sent to Chart.js as a single value applied to all the slices.

Example:

var ds = (DoughnutDataSet)this.chartJS1.DataSets.Add("Tickets");
ds.Data = new object[] { 30, 12, 5 };
ds.BackgroundColor = new[] { Color.SteelBlue, Color.Orange, Color.Crimson };

Instance member BorderColor​

Color[]: Returns or sets the border colors of the data set. One entry is the default color for all the slices, otherwise each slice can define a different border color.

Value: An array of Color values, or null to use the Chart.js default.

Hides BorderColor. When the array contains a single color, it's sent to Chart.js as a single value applied to all the slices.

Example:

var ds = (DoughnutDataSet)this.chartJS1.DataSets.Add("Storage");

// white separators between the slices.
ds.BorderColor = new[] { Color.White };
ds.BorderWidth = 2;

Instance member HoverBackgroundColor​

Color[]: Returns or sets the hover colors of the data set. One entry is the default color for all the slices, otherwise each slice can define a different hover background color.

Value: An array of Color values, or null to use the Chart.js default.

Maps to the Chart.js dataset "hoverBackgroundColor" property. When the array contains a single color, it's sent to Chart.js as a single value applied to all the slices.

Example:

var ds = (DoughnutDataSet)this.chartJS1.DataSets.Add("Status");
ds.BackgroundColor = new[] { Color.LightGreen, Color.LightCoral };
ds.HoverBackgroundColor = new[] { Color.Green, Color.Red };