PieDataSet
Namespace: Wisej.Web.Ext.ChartJS3
Assembly: Wisej.Web.Ext.ChartJS3 (4.1.0.0)
Specialized data set for the Pie chart.
- C#
- VB.NET
public class PieDataSet : DataSet
Public Class PieDataSet
Inherits DataSet
The DataSetCollection creates this type of data set when the ChartType is Pie. 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.Pie;
this.chartJS31.Labels = new[] { "Yes", "No", "Undecided" };
var dataSet = (PieDataSet)this.chartJS31.DataSets.Add("Votes");
dataSet.Data = new object[] { 540, 310, 150 };
dataSet.BackgroundColor = new[] { Color.SeaGreen, Color.Firebrick, Color.Silver };
Constructors
PieDataSet()
Constructs a new instance of PieDataSet.
The new data set has Type set to Pie and a BorderWidth of 2.
Example:
var dataSet = new PieDataSet
{
Label = "Votes",
Data = new object[] { 540, 310, 150 }
};
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 = (PieDataSet)this.chartJS31.DataSets[0];
dataSet.BackgroundColor = new[] { Color.SeaGreen, Color.Firebrick, Color.Silver };
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 = (PieDataSet)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 = (PieDataSet)this.chartJS31.DataSets[0];
dataSet.BackgroundColor = new[] { Color.SeaGreen, Color.Firebrick, Color.Silver };
dataSet.HoverBackgroundColor = new[] { Color.DimGray };
this.chartJS31.Update();