Current filter:
                                You should refresh the page.

                                How to add strips to an axis

                                0

                                This example demonstrates how strips can be created and customized at runtime.

                                Since strips reside in an appropriate axis collection, you should first cast your diagram object to the required diagram type. Then, you can access the collection via the axis.Strips property.

                                You must  log in  or  register  to leave comments
                                Select file
                                • Form1.cs
                                Select language
                                • C#
                                • VB.NET
                                Select version
                                • v2012 vol 1.5 - v2013 vol 1.2
                                • v2008 vol 3.6 - v2011 vol 2.14
                                using System;
                                using System.Drawing;
                                using System.Windows.Forms;
                                using DevExpress.XtraCharts;
                                // ...
                                
                                namespace Strips {
                                    public partial class Form1 : Form {
                                        public Form1() {
                                            InitializeComponent();
                                        }
                                
                                        private void Form1_Load(object sender, EventArgs e) {
                                            // Create an empty chart.
                                            ChartControl chartControl1 = new ChartControl();
                                
                                            // Create a series and add points to it.
                                            Series series1 = new Series("Series 1", ViewType.SplineArea);
                                            series1.Points.Add(new SeriesPoint("A", new double[] { 10 }));
                                            series1.Points.Add(new SeriesPoint("B", new double[] { 2 }));
                                            series1.Points.Add(new SeriesPoint("C", new double[] { 17 }));
                                            series1.Points.Add(new SeriesPoint("D", new double[] { 4 }));
                                            series1.Points.Add(new SeriesPoint("E", new double[] { 17 }));
                                            series1.Points.Add(new SeriesPoint("F", new double[] { 10 }));
                                            series1.Points.Add(new SeriesPoint("G", new double[] { 15 }));
                                
                                            // Add the series to the chart.
                                            chartControl1.Series.Add(series1);
                                
                                            // Cast the chart's diagram to the XYDiagram type, to access its axes.
                                            XYDiagram diagram = chartControl1.Diagram as XYDiagram;
                                
                                            // Create a strip.
                                            diagram.AxisY.Strips.Add(new Strip("Strip 1"));
                                
                                            // Enable and define its MaxLimit and MinLimit properties.
                                            diagram.AxisY.Strips[0].MaxLimit.Enabled = true;
                                            diagram.AxisY.Strips[0].MinLimit.Enabled = true;
                                
                                            diagram.AxisY.Strips[0].MaxLimit.AxisValue = 15;
                                            diagram.AxisY.Strips[0].MinLimit.AxisValue = 5;
                                
                                            // Customize the strip's behavior.
                                            diagram.AxisY.Strips[0].Visible = true;
                                            diagram.AxisY.Strips[0].ShowAxisLabel = true;
                                            diagram.AxisY.Strips[0].AxisLabelText = "My Range";
                                            diagram.AxisY.Strips[0].ShowInLegend = true;
                                            diagram.AxisY.Strips[0].LegendText = "A Sample Strip";
                                
                                            //  Customize the strip's appearance.
                                            diagram.AxisY.Strips[0].Color = Color.CornflowerBlue;
                                            diagram.AxisY.Strips[0].FillStyle.FillMode = FillMode.Empty;
                                
                                            // Add the chart to the form.
                                            chartControl1.Dock = DockStyle.Fill;
                                            this.Controls.Add(chartControl1);
                                        }
                                
                                    }
                                }