MindFusion.Charting Programmer's Guide

Creating Scatter Charts

C#  Copy Code

this.lineChart1.LineType = MindFusion.Charting.LineTypes.Scatter;

VB.NET  Copy Code

Me.LineChart1.LineType = MindFusion.Charting.LineTypes.Scatter

C#  Copy Code

this.lineChart1.GridType = MindFusion.Charting.GridType.HorScale;

VB.NET  Copy Code

Me.LineChart1.GridType = MindFusion.Charting.GridType.HorScale

  • Set the title label - enter 'Scatter Chart' in the TitleText property field. Use TitleFont and TitleBrush to set the font and color of the title.

C#  Copy Code

this.lineChart1.TitleText = "Scatter Chart";

VB.NET  Copy Code

Me.LineChart1.TitleText = "Scatter chart"

C#  Copy Code

this.lineChart1.XData = new MindFusion.Charting.SeriesCollection("1,3,5,7,9");

VB.NET  Copy Code

Me.LineChart1.XData = New MindFusion.Charting.SeriesCollection("1,3,5,7,9")

  • Enter two series of data in the YData property: Serie0: 30,44,18,33 and Serie1: 10,20,35,22 by using the SeriesCollection Editor.

C#  Copy Code

this.lineChart1.YData = new MindFusion.Charting.SeriesCollection("30,44,18,33;10,20,35,22");

VB.NET  Copy Code

Me.LineChart1.YData = New MindFusion.Charting.SeriesCollection("30,44,18,33;10,20,35,22")

  • Set the following properties of the X-axis with the XAxisSettings object:

  • Set the appearance options for the Y-axis with the YAxisSettings property:

    • Set AxisLabelType to AutoScale
    • Set DivMarkerAlignment to Far to draw the scale divisions out of the plot area towards the labels
    • Set the length of the scale divisions to 5, that is DivMarkerLength = 5

  • Set the YAxisSettings.DrawZero property to true to show the zero label at the Y-axis.
  • Specify the type of Shape-s that you want for the scatter chart. Add the chosen values to the Shapes property, clear any already added Shape objects beforehand. Update the chart with the newly set options. Write the following lines of code in the constructor of the Form, which contains the chart control, after InitializeComponent:

C#  Copy Code

 this.lineChart1.Shapes.Clear();
 this.lineChart1.Shapes.Add(MindFusion.Charting.Shape.Rhombus);
 this.lineChart1.Shapes.Add(MindFusion.Charting.Shape.Circle);
 this.lineChart1.UpdateChart();

VB.NET  Copy Code

 Me.LineChart1.Shapes.Clear()
 Me.LineChart1.Shapes.Add(MindFusion.Charting.Shape.Rhombus)
 Me.LineChart1.Shapes.Add(MindFusion.Charting.Shape.Circle)
 Me.LineChart1.UpdateChart()

  • Use the ShapePens property to specify the pens that draw the outlining of the scatter Shapes. Add and edit the pens with the PenCollection Editor.
  • Set the size of the scatter shapes using ShapeSizes. Enter the desired values, for example 20 and 30, separated by commas in the Property Designer of Visual Studio, for example write "20,30".
  • The Scatter chart will be updated with the described settings: