BarWidthArray

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common > Charts > ChartControl >

BarWidthArray

Previous page Return to chapter overview Next page

Definition

An array containing the values of the BarWidth properties of all Bars objects applied to the chart.

 

Property Value

An array of double variables containing the values of the BarWidth properties of Bars objects on the chart.

 

Syntax

<ChartControl>.BarWidthArray[]

 

Examples

ns

protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
  // Assign BarWidthArray to a new array
  double[] barWidths = chartControl.BarWidthArray;
 
  double referenceWidth = barWidths[0];
 
  // Trigger an alert if bar widths on the chart differ
  foreach (double width in barWidths)
  {
      if (width != referenceWidth)
          Alert("mismatchWidths", Priority.Low, "Bar widths on the chart do not match!", " ", 20, Brushes.White, Brushes.Black);
  }
}