MindFusion WinForms Programmer's Guide
Creating Line Charts

A. Create a new Visual Studio Project

  1. Open Visual Studio.
  2. On the File menu, select New, and then choose Project.
  3. Select the desired project type from the list of installed templates.
  4. Type the name of your project, and click OK.

B. Create a line chart object

  1. Click on the LineChart icon in the Toolbox, and drag it to the form's working area. This creates a new line chart object.
  2. Click on the selection handles and expand the area of the control as desired.

C. Set the properties of the LineChart object

  1. Select the newly created LineChart object by clicking in the area within the form.
  2. Set the LineType to Line3D.

 Note

To display properly the 3D line chart, set the Depth3D property to a value greater than zero, for example to 30.

  1. Enter 'Products' in the TitleText property field, choose bold Verdana TitleFont, size 16pt.
  2. Set the ChartPens property by using the PenCollection Editor.
    Choose blue Pen0 and green Pen1, Width = 3.

  1. Set the ChartBrushes property to light blue and light green colors by using the PenCollection Editor.
  2. Set GridType to HorScale, choose Light Gray GridBrush and GridPen of Dot Style.
  3. Set AltGridBrush to Gradient Style, from white start color to pink end color.

 Note

To draw the chart by using of curves, set the Curve property to true.

D. Set data for the line chart

Add XData and YData values for two series.

  1. Click the XData property in the Properties window.
  2. The SeriesCollection Editor appears. Add the XData values in one series. In this way, both line graphics will have the same X values.

  1. Add YData values in two series

 

 Note

For a line chart to be drawn, the count of members in both XData and YData lists must be equal. If the count of lists in XData is not equal to the count of lists in YData, the control cycles through them. If the count of numbers in lists at matching positions in XData and YData are not equal, the control completes the list with less values automatically.

E. Set the XAxisSettings and YAxisSettings properties

F. Set the labels of the line chart

  1. Select the XLabels property. The LabelsCollection Editor appears.
  2. Enter the XLabels values: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct'

  1. Set LabelFont to Verdana, size 14.
  2. Set YAxisSettings.DrawZero to true to show the zero label.

Click in the Form area. The line chart is displayed according to the specified properties values as shown below.

 Note

To draw the chart as Area3D, set LineType to Area3D.