Ungroup Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Moves the specified series into a new layer.
expression.Ungroup(UseNewScaling)
expression Required. An expression that returns a ChSeries object.
UseNewScaling Optional Boolean. Set this argument to True to specify that the series uses a different scaling than the previous layer. The default value is False.
Remarks
When you move a series into a new layer, you can assign the series to an axis that is based on a different value scale.
Example
This example creates a combination chart based on literal data. The first data series is plotted as a line. The second data series is plotted as columns, and on a it's own value axis.
Sub Window_Onload()
Dim asSeriesNames(1)
Dim asCategories(3)
Dim aiSeries1(3)
Dim alSeries2(3)
Dim chConstants
Dim chtNewChart
Dim serUnitSales
Dim serDispInc
Dim axIncomeAxis
asSeriesNames(0) = "UnitSales"
asSeriesNames(1) = "Disposable Income"
asCategories(0) = "Item 1"
asCategories(1) = "Item 2"
asCategories(2) = "Item 3"
asCategories(3) = "Item 4"
aiSeries1(0) = 75
aiSeries1(1) = 84
aiSeries1(2) = 30
aiSeries1(3) = 94
alSeries2(0) = 14522
alSeries2(1) = 17321
alSeries2(2) = 9424
alSeries2(3) = 41782
Set chConstants = ChartSpace1.Constants
' Enagble the display of the legend.
ChartSpace1.HasChartSpaceLegend = True
' Add a new chart to Chartspace1.
Set chtNewChart = ChartSpace1.Charts.Add
' Specify that the chart is a column chart.
chtNewChart.Type = chConstants.chChartTypeLineMarkers
' Bind the chart to the arrays.
chtNewChart.SetData chConstants.chDimSeriesNames, chConstants.chDataLiteral, asSeriesNames
chtNewChart.SetData chConstants.chDimCategories, chConstants.chDataLiteral, asCategories
Set serUnitSales = chtNewChart.SeriesCollection(0)
serUnitSales.SetData chConstants.chDimValues, chConstants.chDataLiteral, aiSeries1
Set serDispInc = chtNewChart.SeriesCollection(1)
serDispInc.SetData chConstants.chDimValues, chConstants.chDataLiteral, alSeries2
' Ungroup the series.
serDispInc.Ungroup True
' Add a new value axis to the chart based on the values in the series.
Set axIncomeAxis = chtNewChart.Axes.Add(serDispInc.Scalings(chConstants.chDimValues))
' Place the axis on the right side of the chart.
axIncomeAxis.Position = chConstants.chAxisPositionRight
' Display the series as columns.
serDispInc.Type = chConstants.chChartTypeColumnClustered
End Sub