Skip to main content

BarDataSet

Namespace: Wisej.Web.Ext.ChartJS

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

Specialized data set for the Bar chart.

public class BarDataSet : DataSet

Add creates a BarDataSet when ChartType is Bar.

Example:

this.chartJS1.ChartType = ChartType.Bar;
this.chartJS1.Labels = new[] { "North", "South", "East", "West" };

var units = (BarDataSet)this.chartJS1.DataSets.Add("Units Sold");
units.Data = new object[] { 340, 210, 480, 150 };
units.BackgroundColor = new[] { Color.CornflowerBlue };

Constructors​

Instance member BarDataSet()​

Constructs a new instance of BarDataSet.

Sets Type to Bar.

Example:

var returns = new BarDataSet
{
Label = "Returns",
Data = new object[] { 12, 8, 15, 4 }
};
this.chartJS1.DataSets.Add(returns);

Properties​

Instance member BackgroundColor​

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

Value: An array of Color values, 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 bars.

Example:

var ds = (BarDataSet)this.chartJS1.DataSets.Add("Stock");
ds.Data = new object[] { 50, 5, 30 };
ds.BackgroundColor = new[] { Color.LightGreen, Color.Salmon, Color.LightGreen };

Instance member BorderColor​

Color[]: Returns or sets the border colors of the data set. One entry is the default color for all the bars, otherwise each bar 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 bars. Set BorderWidth to a value greater than 0 to show the border.

Example:

var ds = (BarDataSet)this.chartJS1.DataSets.Add("Hours");
ds.BackgroundColor = new[] { Color.FromArgb(100, Color.Purple) };
ds.BorderColor = new[] { Color.Purple };
ds.BorderWidth = 1;

Instance member HoverBackgroundColor​

Color[]: Returns or sets the hover colors of the data set. One entry is the default color for all the bars, otherwise each bar 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 bars.

Example:

var ds = (BarDataSet)this.chartJS1.DataSets.Add("Downloads");
ds.BackgroundColor = new[] { Color.SkyBlue };
ds.HoverBackgroundColor = new[] { Color.DodgerBlue };

Inherited By​

NameDescription
HorizontalBarDataSetSpecialized data set for the HorizontalBar chart.