Line Chart
- 3 minutes to read
Short Description
The Line Chart is represented by the Line3DSeriesView object, which belongs to Point, Line and Spline Series Views. This view allows you to show trends for multiple series on the same diagram, and to compare the values of several series for the same point arguments.
A Line chart is shown in the image below.
Chart Type Characteristics
The table below lists the main characteristics of this chart type.
Feature | Value |
---|---|
Series View type | Line3DSeriesView |
Diagram type | XYDiagram3D |
Number of arguments per series point | 1 |
Number of values per series point | 1 |
Note
For information on which chart types can be combined with the Line Chart, refer to the following help topic: Combining Different Series Views.
Example
The following example creates a ChartControl with a series of the Line3DSeriesView type, sets its general properties, and adds this chart to a form at runtime. Before proceeding with this example, first create a Windows Forms Application in Visual Studio, and add all required assemblies to the project’s References list.
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 LineChart3D = new ChartControl();
// Add a line series to it.
Series series1 = new Series("Series 1", ViewType.Line3D);
// Add points to the series.
series1.Points.Add(new SeriesPoint("A", 12));
series1.Points.Add(new SeriesPoint("B", 4));
series1.Points.Add(new SeriesPoint("C", 17));
series1.Points.Add(new SeriesPoint("D", 7));
series1.Points.Add(new SeriesPoint("E", 12));
series1.Points.Add(new SeriesPoint("F", 4));
series1.Points.Add(new SeriesPoint("G", 17));
series1.Points.Add(new SeriesPoint("H", 7));
// Add both series to the chart.
LineChart3D.Series.Add(series1);
// Customize the view-type-specific properties of the series.
Line3DSeriesView myView = (Line3DSeriesView)series1.View;
myView.LineWidth = 5;
myView.LineThickness = 4;
// Access the diagram's options.
((XYDiagram3D)LineChart3D.Diagram).ZoomPercent = 110;
((XYDiagram3D)LineChart3D.Diagram).VerticalScrollPercent = 10;
// Add a title to the chart and hide the legend.
ChartTitle chartTitle1 = new ChartTitle();
chartTitle1.Text = "3D Line Chart";
LineChart3D.Titles.Add(chartTitle1);
LineChart3D.Legend.Visible = false;
// Add the chart to the form.
LineChart3D.Dock = DockStyle.Fill;
this.Controls.Add(LineChart3D);
}