Skip to main content

ManhattanBarSeriesView Class

Represents a series view of the Manhattan Bar type.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.dll

NuGet Package: DevExpress.Charts

#Declaration

public class ManhattanBarSeriesView :
    Bar3DSeriesView

#Remarks

The ManhattanBarSeriesView class provides the functionality of a series view of the manhattan bar type within a chart control.

The ManhattanBarSeriesView class inherits properties and methods from the base Bar3DSeriesView class which define the common settings of the 3D bar series views.

Note that a particular view type can be defined for a series via its SeriesBase.View property.

For more information on series views of the 3D bar type please see the Manhattan Bar Chart topic.

#Example

The following example demonstrates how to create a ChartControl with two series of the ManhattanBarSeriesView type, set its general properties, and add this chart to a form at runtime. Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and include all necessary assemblies to the References list of your project.

Then, add the following code to the Form.Load event handler.

using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
// ...

private void Form1_Load(object sender, EventArgs e) {
    // Create a new chart.
    ChartControl ManhattanBarChart = new ChartControl();

    // Add a bar series to it.
    Series series1 = new Series("Series 1", ViewType.ManhattanBar);
    Series series2 = new Series("Series 2", ViewType.ManhattanBar);

    // Add points to the series.
    series1.Points.Add(new SeriesPoint("A", 10));
    series1.Points.Add(new SeriesPoint("B", 12));
    series1.Points.Add(new SeriesPoint("C", 14));
    series1.Points.Add(new SeriesPoint("D", 17));
    series2.Points.Add(new SeriesPoint("A", 5));
    series2.Points.Add(new SeriesPoint("B", 4));
    series2.Points.Add(new SeriesPoint("C", 10));
    series2.Points.Add(new SeriesPoint("D", 12));

    // Add both series to the chart.
    ManhattanBarChart.Series.AddRange(new Series[] { series1, series2 });

    // Access labels of the first series.
    ((BarSeriesLabel)series1.Label).Visible = true;
    ((BarSeriesLabel)series1.Label).ResolveOverlappingMode = 
        ResolveOverlappingMode.Default;

    // Access the series options.
    series1.PointOptions.PointView = PointView.ArgumentAndValues;

    // Customize the view-type-specific properties of the series.
    Bar3DSeriesView myView = (Bar3DSeriesView)series2.View;
    myView.BarDepthAuto = false;
    myView.BarDepth = 1;
    myView.Transparency = 80;
    myView.ShowFacet = false;
    myView.Model = Bar3DModel.Cylinder;

    // Access the diagram's options.
    ((XYDiagram3D)ManhattanBarChart.Diagram).ZoomPercent = 110;

    // Add a title to the chart and hide the legend.
    ChartTitle chartTitle1 = new ChartTitle();
    chartTitle1.Text = "Manhattan Bar Chart";
    ManhattanBarChart.Titles.Add(chartTitle1);
    ManhattanBarChart.Legend.Visible = false;

    // Add the chart to the form.
    ManhattanBarChart.Dock = DockStyle.Fill;
    this.Controls.Add(ManhattanBarChart);
}
See Also