Skip to main content

BarOptions

Namespace: Wisej.Web.Ext.ChartJS

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

Options for the Bar chart.

public class BarOptions : Options

The Options property returns an instance of this class when ChartType is Bar or HorizontalBar.

Example:

this.chartJS1.ChartType = ChartType.HorizontalBar;

var options = (BarOptions)this.chartJS1.Options;
options.Stacked = false;
options.Legend.Display = false;

Constructors​

Instance member BarOptions()​

Default constructor.

Creates a standalone BarOptions set that is not yet attached to a ChartJS control. Assign it to the Options property of a bar chart.

Example:

var options = new BarOptions();
options.Title.Text = "Orders by Region";

this.chartJS1.ChartType = ChartType.Bar;
this.chartJS1.Options = options;

Instance member BarOptions(chart, defaults)​

Constructs a new instance of the BarOptions set.

NameTypeDescription
chartChartJSThe ChartJS 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 Title, Legend or Tooltips) are copied into the new instance, which is how the chart preserves the common settings when ChartType changes. The ChartJS control creates this instance automatically when ChartType is Bar or HorizontalBar.

Example:

var options = new BarOptions(this.chartJS1, this.chartJS1.Options);
options.Stacked = true;
this.chartJS1.Options = options;

Properties​

Instance member Stacked​

Boolean: Returns or sets whether the bars stack on top of each other along the y axis. (Default: False)

Value: true to stack the bars; otherwise, false. The default is false.

Serialized as the top level stacked option of the chart. The stacking of each axis can also be set using Stacked on the axes in Scales.

Example:

var options = (BarOptions)this.chartJS1.Options;
options.Stacked = true;
options.Scales.xAxes[0].Stacked = true;
options.Scales.yAxes[0].Stacked = true;