DoughnutDataSet
Namespace: Wisej.Web.Ext.ChartJS3
Assembly: Wisej.Web.Ext.ChartJS3 (4.1.0.0)
Specialized data set for the Doughnut chart.
- C#
- VB.NET
public class DoughnutDataSet : DataSet
Public Class DoughnutDataSet
Inherits DataSet
The DataSetCollection creates this type of data set when the ChartType is Doughnut. Each value in Data is drawn as a slice; color arrays with a single entry are sent to the client as a single color.
Example:
this.chartJS31.ChartType = ChartType.Doughnut;
this.chartJS31.Labels = new[] { "Rent", "Food", "Travel" };
var dataSet = (DoughnutDataSet)this.chartJS31.DataSets.Add("Budget");
dataSet.Data = new object[] { 1200, 450, 300 };
dataSet.BackgroundColor = new[] { Color.SlateBlue, Color.Coral, Color.MediumSeaGreen };
Constructors
DoughnutDataSet()
Constructs a new instance of DoughnutDataSet.
The new data set has Type set to Doughnut and a BorderWidth of 2.
Example:
var dataSet = new DoughnutDataSet
{
Label = "Budget",
Data = new object[] { 1200, 450, 300 }
};
this.chartJS31.DataSets.Add(dataSet);
Properties
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 slice, or null (the default) to use the Chart.js default.
Hides the inherited BackgroundColor and maps to the Chart.js dataset "backgroundColor" property.
Example:
var dataSet = (DoughnutDataSet)this.chartJS31.DataSets[0];
dataSet.BackgroundColor = new[] { Color.SlateBlue, Color.Coral, Color.MediumSeaGreen };
this.chartJS31.Update();
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 (the default) to use the Chart.js default.
Hides the inherited BorderColor and maps to the Chart.js dataset "borderColor" property. The width of the border is set by BorderWidth.
Example:
// separate the slices with a white border.
var dataSet = (DoughnutDataSet)this.chartJS31.DataSets[0];
dataSet.BorderColor = new[] { Color.White };
dataSet.BorderWidth = 3;
this.chartJS31.Update();
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 (the default) to use the Chart.js default.
Maps to the Chart.js dataset "hoverBackgroundColor" property.
Example:
var dataSet = (DoughnutDataSet)this.chartJS31.DataSets[0];
dataSet.BackgroundColor = new[] { Color.SlateBlue, Color.Coral, Color.MediumSeaGreen };
dataSet.HoverBackgroundColor = new[] { Color.DimGray };
this.chartJS31.Update();