I have a ChartObject
, with 10 Series
. I have two Series
with .PlotOrder
= 1, and two other with .PlotOrder
= 2. Therefore, the .PlotOrder
of the last Series
is 8. Can this be explained? I expected .PlotOrder
to span from 1 to .Count
.
Proof of what I have is that, during execution of a Sub
, I get in cho
a reference to the ChartObject
in question. Then, in the immediate window:
? cho.Chart.SeriesCollection(cho.Chart.SeriesCollection.Count).PlotOrder
8
? cho.Chart.SeriesCollection.Count
10
Reply to @chrisneilsen, but it is too long for adding as a comment.
The reply is partially correct (I summarize here what I found):
The repeated PlotOrder
s are due to the Chart
having more than one ChartGroup
I do not have Series
with different format (they have different ChartType
s, but all with format XYScatter
).
The grouping is not automatically done by ChartType
, with the ChartType
s of my case, so this does not seem to be the cause for having more than one ChartGroup
. It may have been automatic (and it probably was), but based on other criteria.
Details:
Working with another chart that presents the same situation (all Series
with format XYScatter
), I have executed a Sub to dump info on all ChartGroups
and all the Series
in the chart. Indented once it dumps ChartGroups
, and indented twice it dumps Series
in each ChartGroup
.
ChartObject 'Chart 36', no. series: 6
* ChartGroup, .Index: 1, no. series: 2
** plot order: 1, type: -4169, chart: 'Chart 36', chart type: 73, no. points: 17
** plot order: 2, type: -4169, chart: 'Chart 36', chart type: -4169, no. points: 17
* ChartGroup, .Index: 2, no. series: 4
** plot order: 1, type: -4169, chart: 'Chart 36', chart type: 75, no. points: 2
** plot order: 2, type: -4169, chart: 'Chart 36', chart type: -4169, no. points: 24
** plot order: 3, type: -4169, chart: 'Chart 36', chart type: 75, no. points: 33
** plot order: 4, type: -4169, chart: 'Chart 36', chart type: -4169, no. points: 5
Therefore, the repeated PlotOrder
s are due to the Chart
having more than one ChartGroup
(as correctly guessed by @chrisnielsen).
On the other hand, ChartGroup
s do not group series by ChartType
(as stated by @chrisnielsen) as seen in the dump. Moreover, I do not know how were the ChartGroup
s created and the Series
included in each ChartGroup
(I never did this intentionally).
And to test whether the grouping may have been done automatically, I created another Chart
which has Series with the same ChartType
s as the one above, and they all belong to a single ChartGroup
, as shown in the dump
ChartObject 'Chart 1', no. series: 6
* ChartGroup, .Index: 1, no. series: 6
** plot order: 1, type: -4169, chart: 'Chart 1', chart type: 73, no. points: 17
** plot order: 2, type: -4169, chart: 'Chart 1', chart type: -4169, no. points: 17
** plot order: 3, type: -4169, chart: 'Chart 1', chart type: 75, no. points: 2
** plot order: 4, type: -4169, chart: 'Chart 1', chart type: -4169, no. points: 24
** plot order: 5, type: -4169, chart: 'Chart 1', chart type: 75, no. points: 33
** plot order: 6, type: -4169, chart: 'Chart 1', chart type: -4169, no. points: 5
So the grouping is not automatically done by ChartType
, with the ChartType
s of my case. It may have been automatic (and it probably was), but based on other criteria.
The official site is not very helpful:
http://msdn.microsoft.com/en-us/library/office/aa173251%28v=office.11%29.aspx
http://msdn.microsoft.com/en-us/library/office/aa173240%28v=office.11%29.aspx
http://msdn.microsoft.com/en-us/library/office/aa195778%28v=office.11%29.aspx
This sparks another question, which I posted in
Excel: In which ways can one create ChartGroups?