locked
What is the relationship between ShapeRange, Chart, ChartArea, & PlotArea RRS feed

  • Question

  • Ok, so a ChartObject has a Chart & ShapeRange member. And a Chart has a ChartArea and PlotArea member:

    1. What exactly is the Chart member? It say's it "represents" the chart - what does that mean?
    2. Is the ShapeRange a range the ChartObject holds? And if so, what can be in it? Or is it a parent range that the ChartObject is in?
    3. The ChartArea says it's the "chart area." What is that?
    4. The PlotArea says it's the "plot area." What is that?
    5. This example shows setting a Series.ChartArea but the documentation does not show ChartArea as a Series property. Can ChartArea (and PlotArea) be set in a Series? And if so, what does that mean?

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Friday, October 26, 2018 3:03 PM

Answers

  • 1. Chart, an object that implements a 'chart' with its methods and properties. In Excel it can be a chart sheet (workbook.charts.count) or 'contained' in a ChartObject, typically on a worksheet but charts can also 'contain' further chartobjects.

    2. The latter. Though ShapeRange is the property of a ChartObject for most purposes consider Shape/s, as documented in the link you referred to.

    There are many different shape types, a chart type is identified by Shape.Type = msoChart, see msoShapeType in object browser.

    ChartObject is almost a legacy object type, along with others such as Rectangles, Lines, Pictures etc, dating back to pre Excel 97. When Shapes were introduced the intention was likely to depricate these object types entirely, fortunately that did not happen and is unlikely to.

    3. The ChartArea is a layer of the Chart, it's a chart 'element' that contains all other chart elements. There are about 30 different chart element types, see xlChartItem in object browser.

    4. The PlotArea is the is separate a rectangle on the CharArea for the series and axes, you can select it, resize it, it has its own properties.

    5. The links you refer to do not relate to Excel charts. (MS produce a variety of chart type controls, some of which can also be used in Excel but I assume not what you are working with)

    https://docs.microsoft.com/en-us/office/vba/api/excel.chart(object)


    Friday, October 26, 2018 6:47 PM
  • 1. Apart from 'that's the way it is' a Chart object (two words) needs some form of container, either a special chart sheet or a ChartObject

    2. The ChartArea has it's own properties (none of which is SeriesCollection) and is the first layer in the building block of the chart. FWIW typically it's slightly smaller than its container chartobject parent depending on the latter's border properties.

    3. Depends what you mean by 'hold'. Chart elements such as the SeriesCollection of series are properties of and 'held' by the Chart. A series is not a property of the chartarea, a series' parent is ChartGroup, and in turn the Chart. Only in the physical sense does the chartarea 'hold' a Series.

    • Marked as answer by DavidThielen Saturday, October 27, 2018 12:25 PM
    Friday, October 26, 2018 8:49 PM

All replies

  • 1. Chart, an object that implements a 'chart' with its methods and properties. In Excel it can be a chart sheet (workbook.charts.count) or 'contained' in a ChartObject, typically on a worksheet but charts can also 'contain' further chartobjects.

    2. The latter. Though ShapeRange is the property of a ChartObject for most purposes consider Shape/s, as documented in the link you referred to.

    There are many different shape types, a chart type is identified by Shape.Type = msoChart, see msoShapeType in object browser.

    ChartObject is almost a legacy object type, along with others such as Rectangles, Lines, Pictures etc, dating back to pre Excel 97. When Shapes were introduced the intention was likely to depricate these object types entirely, fortunately that did not happen and is unlikely to.

    3. The ChartArea is a layer of the Chart, it's a chart 'element' that contains all other chart elements. There are about 30 different chart element types, see xlChartItem in object browser.

    4. The PlotArea is the is separate a rectangle on the CharArea for the series and axes, you can select it, resize it, it has its own properties.

    5. The links you refer to do not relate to Excel charts. (MS produce a variety of chart type controls, some of which can also be used in Excel but I assume not what you are working with)

    https://docs.microsoft.com/en-us/office/vba/api/excel.chart(object)


    Friday, October 26, 2018 6:47 PM
  • Thank you, a couple of follow-up questions:

    1. So then why both ChartObject & Chart? Why the need to have the outer containing ChartObject class. (I figure if I understand why, I'll understand it better.)
    2. So it's a Parent - what you said there all makes sense.
    3. This is weird because the Chart holds the Series, yet the ChartArea does too? What purpose does the ChartArea serve then?
    4. Ok that makes sense.

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Friday, October 26, 2018 8:20 PM
  • 1. Apart from 'that's the way it is' a Chart object (two words) needs some form of container, either a special chart sheet or a ChartObject

    2. The ChartArea has it's own properties (none of which is SeriesCollection) and is the first layer in the building block of the chart. FWIW typically it's slightly smaller than its container chartobject parent depending on the latter's border properties.

    3. Depends what you mean by 'hold'. Chart elements such as the SeriesCollection of series are properties of and 'held' by the Chart. A series is not a property of the chartarea, a series' parent is ChartGroup, and in turn the Chart. Only in the physical sense does the chartarea 'hold' a Series.

    • Marked as answer by DavidThielen Saturday, October 27, 2018 12:25 PM
    Friday, October 26, 2018 8:49 PM
  • Thank you - this has helped me understand it better

    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Saturday, October 27, 2018 12:25 PM