Xceed Chart for WinForms v4.4 Documentation
Advanced Shape Series

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > XY Scatter Series > Shape Series > Advanced Shape Series

This topic discusses some of the most common applications of shape series.

XYZ Scatter Bubble

An XYZ Scatter Bubble is displayed on figure 1. 

figure 1.

The following code was used:

VB.NET  

m_Chart = chartControl1.Charts(0)

' switch the PrimaryX and Depth axes in numeric mode in order to

' correctly scale the custom X and Z positions

m_Chart.Axis(StandardAxis.PrimaryX).ScaleMode = AxisScaleMode.Numeric

m_Chart.Axis(StandardAxis.Depth).ScaleMode = AxisScaleMode.Numeric

' create the shape series

m_Shape = CType(m_Chart.Series.Add(SeriesType.Shape), ShapeSeries)

' configure it

' 1. filling is specified per data point

m_Shape.Appearance.FillMode = AppearanceFillMode.DataPoints

' 2. borders are also specified per data point

m_Shape.Appearance.LineMode = AppearanceLineMode.DataPoints

' 3. show information about the data points in the legend

m_Shape.Legend.Mode = SeriesLegendMode.DataPoints

' 4. show the Y size and label in the legend

m_Shape.Legend.Format = "<ysize> <label>"

' 5. no data labels

m_Shape.DataLabels.Mode = DataLabelsMode.None

' use custom X positions

m_Shape.UseXValues = True

' use custom Z positions

m_Shape.UseZValues = True

' X sizes are specified in Model units (the default is Scale)

' this will make the bubbles size independant from the scale of the X axis

m_Shape.XSizesUnits = MeasurementUnits.Model

' Z sizes are specified in Model units (the default is Scale)

' this will make the bubbles size independant from the scale of the Z axis

m_Shape.ZSizesUnits = MeasurementUnits.Model

' Y sizes are specified in Model units (the default is Scale)

' this will make the bubbles size independant from the scale of the Y axis

m_Shape.YSizesUnits = MeasurementUnits.Model

' this will require to set the InflateMargins flag to true since in this mode

' scale is determined only by the X positions of the shape and will not take

' into account the size of the bubbles.

m_Shape.InflateMargins = True

' add the bubbles

' add bubble1

m_Shape.AddShape(10, ' Y center of bubble

12, ' X position

56, ' Z position

30, ' X size - 30 model units

30, ' Y size - 30 model units

30, ' Z size - 30 model units

"bubble1", ' label

New FillEffect(Color.LightGreen), ' filling

New LineProperties(1, Color.Black) ' border

)

' add bubble2

m_Shape.AddShape(20, ' Y center of bubble

34, ' X position - not used since UseXValue is set to false

12, ' Z position

10, ' X size - 10 model units

10, ' Y size - 10 model units

10, ' Z size - 10 model units

"bubble2", ' label

New FillEffect(Color.LightCoral), ' filling

New LineProperties(1, Color.Black) ' border

)

' add bubble3

m_Shape.AddShape( 15, ' Y center of bubble -> half its Y size

50, ' X position - not used since UseXValue is set to false

30, ' Z position

20, ' X size - 20 model units

20, ' Y size - 20 model units

20, ' Z size - 20 model units

"bubble3", ' label

New FillEffect(Color.LightSalmon), ' filling

New LineProperties(1, Color.Black) ' border

)

C#  

m_Chart = chartControl1.Charts[0];

// switch the PrimaryX and Depth axes in numeric mode in order to

// correctly scale the custom X and Z positions

m_Chart.Axis(StandardAxis.PrimaryX).ScaleMode = AxisScaleMode.Numeric;

m_Chart.Axis(StandardAxis.Depth).ScaleMode = AxisScaleMode.Numeric;

// create the shape series

m_Shape = (ShapeSeries)m_Chart.Series.Add(SeriesType.Shape);

// configure it

// 1. filling is specified per data point

m_Shape.Appearance.FillMode = AppearanceFillMode.DataPoints;

// 2. borders are also specified per data point

m_Shape.Appearance.LineMode = AppearanceLineMode.DataPoints;

// 3. show information about the data points in the legend

m_Shape.Legend.Mode = SeriesLegendMode.DataPoints;

// 4. show the Y size and label in the legend

m_Shape.Legend.Format = "<ysize> <label>";

// 5. no data labels m_Shape.DataLabels.Mode = DataLabelsMode.None;

// use custom X positions

m_Shape.UseXValues = true;

// use custom Z positions

m_Shape.UseZValues = true;

// X sizes are specified in Model units (the default is Scale)

// this will make the bubbles size independant from the scale of the X axis

m_Shape.XSizesUnits = MeasurementUnits.Model;

// Z sizes are specified in Model units (the default is Scale)

// this will make the bubbles size independant from the scale of the Z axis

m_Shape.ZSizesUnits = MeasurementUnits.Model;

// Y sizes are specified in Model units (the default is Scale)

// this will make the bubbles size independant from the scale of the Y axis

m_Shape.YSizesUnits = MeasurementUnits.Model;

// this will require to set the InflateMargins flag to true since in this mode

// scale is determined only by the X positions of the shape and will not take

// into account the size of the bubbles.

m_Shape.InflateMargins = true;

// add the bubbles

// add bubble1

m_Shape.AddShape(10, // Y center of bubble

12, // X position

56, // Z position

30, // X size - 30 model units

30, // Y size - 30 model units

30, // Z size - 30 model units

"bubble1", // label

new FillEffect(Color.LightGreen), // filling

new LineProperties(1, Color.Black) // border

};

// add bubble2

m_Shape.AddShape(20, // Y center of bubble

34, // X position - not used since UseXValue is set to false

12, // Z position

10, // X size - 10 model units

10, // Y size - 10 model units

10, // Z size - 10 model units

"bubble2", // label

new FillEffect(Color.LightCoral), // filling

new LineProperties(1, Color.Black) // border

);

// add bubble3

m_Shape.AddShape( 15, // Y center of bubble -> half its Y size

50, // X position - not used since UseXValue is set to false

30, // Z position

20, // X size - 20 model units

20, // Y size - 20 model units

20, // Z size - 20 model units

"bubble3", // label

new FillEffect(Color.LightSalmon), // filling

new LineProperties(1, Color.Black) // border

}

XY Scatter Bar

A typical XY Scatter Bar is displayed on figure 2. 

figure 2. 

The following code was used:

VB.NET  

m_Chart = chartControl1.Charts(0)

' switch the categories axis in numeric mode

m_Chart.Axis(StandardAxis.PrimaryX).ScaleMode = AxisScaleMode.Numeric

' create the shape series

m_Shape = (ShapeSeries)m_Chart.Series.Add(SeriesType.Shape)

' configure it

' 1. filling is specified per data point

m_Shape.Appearance.FillMode = AppearanceFillMode.DataPoints

' 2. borders are also specified per data point

m_Shape.Appearance.LineMode = AppearanceLineMode.DataPoints

' 3. show information about the data points in the legend

m_Shape.Legend.Mode = SeriesLegendMode.DataPoints

' 4. show the Y size and label in the legend

m_Shape.Legend.Format = "<ysize> <label>"

' 5. no data labels

m_Shape.DataLabels.Mode = DataLabelsMode.None

' use custom X positions

m_Shape.UseXValues = True

' X sizes are specified in Model units (the default is Scale)

' this will make the bars size independant from the scale of the X axis

m_Shape.XSizesUnits = MeasurementUnits.Model

' this will require to set the InflateMargins flag to true since in this mode

' scale is determined only by the X positions of the shape and will not take

' into account the size of the bars.

m_Shape.InflateMargins = True

' position all shapes at the series Z order

m_Shape.UseZValues = False

' add the bars

' add Bar1

m_Shape.AddShape( 10, ' Y center of bar -> half its Y size

12, ' X position

0, ' Z position - not used since UseZValue is set to false

10, ' X size - 10 model units

20, ' Y size of bar

0.66, ' Z size - 2 thirds of series depth

"Bar1", ' label

new FillEffect(Color.LightGreen), ' filling

new LineProperties(1, Color.Black) ' border

)

add Bar2

m_Shape.AddShape( 20, ' Y center of bar -> half its Y size

34, ' X position - not used since UseXValue is set to false

0, ' Z position - not used since UseZValue is set to false

10, ' X size - 10 model units

40, ' Y size of bar

0.33, ' Z size - 1 third of series depth

"Bar2", ' label

new FillEffect(Color.LightCoral), ' filling

new LineProperties(1, Color.Black) ' border

)

' add Bar3

m_Shape.AddShape( 15, ' Y center of bar -> half its Y size

50, ' X position - not used since UseXValue is set to false

0, ' Z position - not used since UseZValue is set to false

10, ' X size - 10 model units

30, ' Y size of bar

0.5, ' Z size - half series depth

"Bar3", ' label

new FillEffect(Color.LightSalmon), ' filling

new LineProperties(1, Color.Black) ' border

)

C#  

m_Chart = chartControl1.Charts[0];

// switch the categories axis in numeric mode

m_Chart.Axis(StandardAxis.PrimaryX).ScaleMode = AxisScaleMode.Numeric;

// create the shape series

m_Shape = (ShapeSeries)m_Chart.Series.Add(SeriesType.Shape);

// configure it

// 1. filling is specified per data point

m_Shape.Appearance.FillMode = AppearanceFillMode.DataPoints;

// 2. borders are also specified per data point

m_Shape.Appearance.LineMode = AppearanceLineMode.DataPoints;

// 3. show information about the data points in the legend

m_Shape.Legend.Mode = SeriesLegendMode.DataPoints;

// 4. show the Y size and label in the legend

m_Shape.Legend.Format = "<ysize> <label>";

// 5. no data labels

m_Shape.DataLabels.Mode = DataLabelsMode.None;

// use custom X positions

m_Shape.UseXValues = true;

// X sizes are specified in Model units (the default is Scale)

// this will make the bars size independant from the scale of the X axis

m_Shape.XSizesUnits = MeasurementUnits.Model;

// this will require to set the InflateMargins flag to true since in this mode

// scale is determined only by the X positions of the shape and will not take

// into account the size of the bars.

m_Shape.InflateMargins = true;

// position all shapes at the series Z order

m_Shape.UseZValues = false;

// add the bars

// add Bar1

m_Shape.AddShape( 10, // Y center of bar -> half its Y size

12, // X position

0, // Z position - not used since UseZValue is set to false

10, // X size - 10 model units

20, // Y size of bar

0.66, // Z size - 2 thirds of series depth

"Bar1", // label

new FillEffect(Color.LightGreen), // filling

new LineProperties(1, Color.Black) // border

);

add Bar2

m_Shape.AddShape( 20, // Y center of bar -> half its Y size

34, // X position - not used since UseXValue is set to false

0, // Z position - not used since UseZValue is set to false

10, // X size - 10 model units

40, // Y size of bar

0.33, // Z size - 1 third of series depth

"Bar2", // label

new FillEffect(Color.LightCoral), // filling

new LineProperties(1, Color.Black) // border

);

// add Bar3

m_Shape.AddShape( 15, // Y center of bar -> half its Y size

50, // X position - not used since UseXValue is set to false

0, // Z position - not used since UseZValue is set to false

10, // X size - 10 model units

30, // Y size of bar

0.5, // Z size - half series depth

"Bar3", // label

new FillEffect(Color.LightSalmon), // filling

new LineProperties(1, Color.Black) // border

);

Related Examples

Windows Forms: Series\Shape\3D Modeling with shapes
Windows Forms: Series\Shape\Bars With Different Size
Windows Forms: Series\Shape\XY Scatter Bars
Windows Forms: Series\Shape\XYZ Scatter Bars
Windows Forms: Series\Shape\XYZ Scatter Bubble

See Also

ShapeSeries | Chart Coordinate System