windowsforms-114455-controls-and-libraries-chart-control-end-user-features-chart-ribbon-and-toolbars.md
The Ribbon and Toolbars allow users to perform basic charting tasks, for example, change a series’s view type, print/export a chart or use the Chart Designer to customize the chart.
The Chart Control with the Ribbon
The Chart Control with Toolbars
Note
The Chart Control can use only one command UI type at a time.
Shows the Chart Control with a Ribbon:
Shows the Chart Control with Toolbars:
The newly added Ribbon contains the Chart Tools page category with the Design and Other contextual pages, and the Toolbars contain the Design and Other groups of bars.
The Ribbon with the Design and Other pages
The Toolbar with the Design and Other bars.
Note
See the Financial Options section for information on how to add the Financial Options page/toolbar.
Click the Chart Control’s smart-tag and select Create Ribbon :
Refer to the Ribbon Control for more information about the Ribbon.
Click the Chart Control’s smart-tag and select the Create BarManager link:
Refer to the Bars for more information about the Bar Manager.
After the Chart Control’s Ribbon/Toolbars are added, the smart tag’s menu includes the following commands:
To remove a UI element from the Ribbon or Toolbar, select the element and click the Delete key.
The Design page/toolbar allows you to customize the chart’s appearance and series’ view type.
Ribbon
Toolbar
The Design page/toolbar includes the following groups:
The Other page/toolbar elements allow you to do the following:
Ribbon
Toolbar
Select the Create Financial Bars link in the chart control smart tag’s menu to add the Financial Options page/toolbar.
The Financial Options page/toolbar provides the following commands:
Ribbon
Toolbar
You can customize the list of views in the Ribbon and the Toolbar.
Click the View Type element’s smart tag. Select the All Properties… item.
Click the Options. Edit. Items property’s ellipsis button. To select multiple views in the Choose Series View dialog, press Ctrl or Shift and click the series’ view icons.
You can customize the list of measurement units in the Ribbon and Toolbar.
Click the Axis Unit ( Period ) element’s smart tag. Select the All Properties… item.
Click the Options. Edit. Items property’s ellipsis button. Use the Add button to add a new item. Specify the MeasureUnit and MeasureUnitMultiplier properties.
Note
You can only configure axis units and periods for date-time x-axes.
The following example shows how to handle the CheckedChanged events of the Indicators group’s items (DrawTrendLineIndicatorBarItem, DrawFibonacciArcsIndicatorBarItem, DrawFibonacciFansIndicatorBarItem, DrawFibonacciRetracementIndicatorBarItem and RemoveIndicatorBarItem) to disable the Crosshair Cursor and scrolling capabilities while you draw or remove an indicator:
drawTrendLineIndicatorBarItem1.CheckedChanged += OnCheckedChanged;
drawFibonacciArcsIndicatorBarItem1.CheckedChanged += OnCheckedChanged;
drawFibonacciFansIndicatorBarItem1.CheckedChanged += OnCheckedChanged;
drawFibonacciRetracementIndicatorBarItem1.CheckedChanged += OnCheckedChanged;
removeIndicatorBarItem1.CheckedChanged += OnCheckedChanged;
// ...
private void OnCheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
bool isNotChecked = !drawTrendLineIndicatorBarItem1.Checked && !drawFibonacciArcsIndicatorBarItem1.Checked && !drawFibonacciFansIndicatorBarItem1.Checked &&
!drawFibonacciRetracementIndicatorBarItem1.Checked && !removeIndicatorBarItem1.Checked;
// Disable the Crosshair Cursor.
chartControl1.CrosshairEnabled = isNotChecked ? DefaultBoolean.True : DefaultBoolean.False;
// Disable the capability to scroll the chart.
XYDiagram diagram = (XYDiagram)chartControl1.Diagram;
diagram.EnableAxisXScrolling = isNotChecked;
}
drawTrendLineIndicatorBarItem1.CheckedChanged += OnCheckedChanged
drawFibonacciArcsIndicatorBarItem1.CheckedChanged += OnCheckedChanged
drawFibonacciFansIndicatorBarItem1.CheckedChanged += OnCheckedChanged
drawFibonacciRetracementIndicatorBarItem1.CheckedChanged += OnCheckedChanged
removeIndicatorBarItem1.CheckedChanged += OnCheckedChanged
'...
Private Sub OnCheckedChanged(ByVal sender As Object, ByVal e As DevExpress.XtraBars.ItemClickEventArgs)
Dim isNotChecked As Boolean = Not drawTrendLineIndicatorBarItem1.Checked AndAlso Not drawFibonacciArcsIndicatorBarItem1.Checked AndAlso Not drawFibonacciFansIndicatorBarItem1.Checked AndAlso Not drawFibonacciRetracementIndicatorBarItem1.Checked AndAlso Not removeIndicatorBarItem1.Checked
' Disable the Crosshair Cursor.
chartControl1.CrosshairEnabled = If(isNotChecked, DefaultBoolean.[True], DefaultBoolean.[False])
' Disable the capability to scroll the chart.
Dim diagram As XYDiagram = CType(chartControl1.Diagram, XYDiagram)
diagram.EnableAxisXScrolling = isNotChecked
End Sub