Aspose::Slides::Charts::ChartData Class Reference

Represents data used for a chart plotting. More...

Inherits Aspose::Slides::Charts::IChartData, and Aspose::Slides::IDOMObject.

Public Member Functions

System::SharedPtr< IChartDataWorkbookget_ChartDataWorkbook () override
 Gets the cells factory to create cells used for chart series or categories. Read-only IChartDataWorkbook. More...
 
System::SharedPtr< IChartSeriesCollectionget_Series () override
 Gets the series. Read-only IChartSeriesCollection. More...
 
System::SharedPtr< IChartSeriesGroupCollectionget_SeriesGroups () override
 Gets the groups of series. Read-only IChartSeriesGroupCollection. More...
 
System::SharedPtr< IChartCategoryCollectionget_Categories () override
 Gets the primary categories (or both primary and secondary categories if ChartData::set_UseSecondaryCategories is set to false). Read-only IChartCategoryCollection. More...
 
bool get_UseSecondaryCategories () override
 If set to false then ChartData::get_SecondaryCategories returns null and data in ChartData::get_Categories is used both for primary and secondary series. If set to true then data in ChartData::get_SecondaryCategories is used for secondary series and data in ChartData::get_Categories is used for primary series. Read bool. More...
 
void set_UseSecondaryCategories (bool value) override
 If set to false then ChartData::get_SecondaryCategories returns null and data in ChartData::get_Categories is used both for primary and secondary series. If set to true then data in ChartData::get_SecondaryCategories is used for secondary series and data in ChartData::get_Categories is used for primary series. Write bool. More...
 
System::SharedPtr< IChartCategoryCollectionget_SecondaryCategories () override
 Gets the secondary categories if ChartData::get_UseSecondaryCategories is true. Read-only IChartCategoryCollection. More...
 
ChartDataSourceType get_DataSourceType () override
 Represents external workbook path if external data source, null otherwise More...
 
System::String get_ExternalWorkbookPath () override
 Represents data source of the chart More...
 
System::SharedPtr< IDOMObjectget_Parent_Immediate () override
 Returns Parent_Immediate object. Read-only IDOMObject. More...
 
System::SharedPtr< System::IO::MemoryStreamReadWorkbookStream () override
 
void WriteWorkbookStream (System::SharedPtr< System::IO::MemoryStream > ms) override
 Initializes the internally contained Excel workbook with user-specified value. More...
 
System::String GetRange () override
 Gets chart data range. More...
 
void SetRange (System::String formula) override
 Set chart data range. Series and categories will be updated based on new data range. If amount of series in data range greater than count of series in the chart data then additional series with the same type as a last series in the current collection will be added to the end of the collection. More...
 
void SetExternalWorkbook (System::String workbookPath) override
 Sets external workbook as a data source for the chart. Chart data will be updated from the target workbook. More...
 
void SetExternalWorkbook (System::String workbookPath, bool updateChartData) override
 Sets external workbook as a data source for the chart. More...
 
void SwitchRowColumn () override
 Swap the data over the axis. Data being charted on the X axis will move to the Y axis and vice versa. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (unsigned int argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Protected Member Functions

virtual ~ChartData ()
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 

Detailed Description

Represents data used for a chart plotting.

Constructor & Destructor Documentation

◆ ~ChartData()

virtual Aspose::Slides::Charts::ChartData::~ChartData ( )
protectedvirtual

Member Function Documentation

◆ get_Categories()

System::SharedPtr<IChartCategoryCollection> Aspose::Slides::Charts::ChartData::get_Categories ( )
overridevirtual

Gets the primary categories (or both primary and secondary categories if ChartData::set_UseSecondaryCategories is set to false). Read-only IChartCategoryCollection.

If ChartData::set_UseSecondaryCategories is set to false then ChartData::get_SecondaryCategories returns null and data in ChartData::get_Categories is used both for primary and secondary series. If ChartData::set_UseSecondaryCategories is set to true then data in ChartData::get_SecondaryCategories is used for secondary series and data in ChartData::get_Categories is used for primary series.

Example. What categories are related to series - ChartData.Categories or ChartData.SecondaryCategories?

if (series->get_PlotOnSecondAxis() && series->get_Chart()->get_ChartData()->get_UseSecondaryCategories())
{
// related categories are series->get_Chart()->get_ChartData()->get_SecondaryCategories()
}
else
{
// related categories are series->get_Chart()->get_ChartData()->get_Categories()
}

Implements Aspose::Slides::Charts::IChartData.

◆ get_ChartDataWorkbook()

System::SharedPtr<IChartDataWorkbook> Aspose::Slides::Charts::ChartData::get_ChartDataWorkbook ( )
overridevirtual

Gets the cells factory to create cells used for chart series or categories. Read-only IChartDataWorkbook.

Implements Aspose::Slides::Charts::IChartData.

◆ get_DataSourceType()

ChartDataSourceType Aspose::Slides::Charts::ChartData::get_DataSourceType ( )
overridevirtual

Represents external workbook path if external data source, null otherwise

Implements Aspose::Slides::Charts::IChartData.

◆ get_ExternalWorkbookPath()

System::String Aspose::Slides::Charts::ChartData::get_ExternalWorkbookPath ( )
overridevirtual

Represents data source of the chart

Implements Aspose::Slides::Charts::IChartData.

◆ get_Parent_Immediate()

System::SharedPtr<IDOMObject> Aspose::Slides::Charts::ChartData::get_Parent_Immediate ( )
overridevirtual

Returns Parent_Immediate object. Read-only IDOMObject.

Implements Aspose::Slides::IDOMObject.

◆ get_SecondaryCategories()

System::SharedPtr<IChartCategoryCollection> Aspose::Slides::Charts::ChartData::get_SecondaryCategories ( )
overridevirtual

Gets the secondary categories if ChartData::get_UseSecondaryCategories is true. Read-only IChartCategoryCollection.

If ChartData::set_UseSecondaryCategories is set to false then ChartData::get_SecondaryCategories returns null and data in ChartData::get_Categories is used both for primary and secondary series. If ChartData::set_UseSecondaryCategories is set to true then data in ChartData::get_SecondaryCategories is used for secondary series and data in ChartData::get_Categories is used for primary series.

Example. What categories are related to series - ChartData.Categories or ChartData.SecondaryCategories?

if (series->get_PlotOnSecondAxis() && series->get_Chart()->get_ChartData()->get_UseSecondaryCategories())
{
// related categories are series->get_Chart()->get_ChartData()->get_SecondaryCategories()
}
else
{
// related categories are series->get_Chart()->get_ChartData()->get_Categories()
}

Implements Aspose::Slides::Charts::IChartData.

◆ get_Series()

System::SharedPtr<IChartSeriesCollection> Aspose::Slides::Charts::ChartData::get_Series ( )
overridevirtual

Gets the series. Read-only IChartSeriesCollection.

Implements Aspose::Slides::Charts::IChartData.

◆ get_SeriesGroups()

System::SharedPtr<IChartSeriesGroupCollection> Aspose::Slides::Charts::ChartData::get_SeriesGroups ( )
overridevirtual

Gets the groups of series. Read-only IChartSeriesGroupCollection.

1) Each group of series contains series with combinable types. Groups of combinable series types defined and described with CombinableSeriesTypesGroup enum. Also each group of series contains series witch is plotted whether on primary axes or on secondary axes (not both cases in one group). So, principle of series grouping is a grouping by type groups mentioned above and by primary/secondary plotting type.

2) Group of series contains some series properies whitch is common for each series in group ("series group properties"). "Series group properties" in ChartSeriesGroup class is read/write. Each of "series group properties" can have a read-only projection in ChartSeries class.

Implements Aspose::Slides::Charts::IChartData.

◆ get_UseSecondaryCategories()

bool Aspose::Slides::Charts::ChartData::get_UseSecondaryCategories ( )
overridevirtual

If set to false then ChartData::get_SecondaryCategories returns null and data in ChartData::get_Categories is used both for primary and secondary series. If set to true then data in ChartData::get_SecondaryCategories is used for secondary series and data in ChartData::get_Categories is used for primary series. Read bool.

Example. What categories are related to series - ChartData.Categories or ChartData.SecondaryCategories?

if (series->get_PlotOnSecondAxis() && series->get_Chart()->get_ChartData()->get_UseSecondaryCategories())
{
// related categories are series->get_Chart()->get_ChartData()->get_SecondaryCategories()
}
else
{
// related categories are series->get_Chart()->get_ChartData()->get_Categories()
}

Implements Aspose::Slides::Charts::IChartData.

◆ GetRange()

System::String Aspose::Slides::Charts::ChartData::GetRange ( )
overridevirtual

Gets chart data range.

Returns
Cells data range formula. E.g: "Sheet1!$A$1:$C$4"
Exceptions
System::InvalidOperationExceptionChart doesn't use workbook as a data source
auto pres = MakeObject<Presentation>();
auto chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(Charts::ChartType::PercentsStackedBar, 0.0f, 0.0f, 100.0f, 100.0f);
String result = (DynamicCast_noexcept<Charts::ChartData>(chart->get_ChartData()))->GetRange();

Implements Aspose::Slides::Charts::IChartData.

◆ ReadWorkbookStream()

System::SharedPtr<System::IO::MemoryStream> Aspose::Slides::Charts::ChartData::ReadWorkbookStream ( )
overridevirtual

Writes the internally contained Excel workbook it into an in-memory stream.

Returns
Returns an instance of MemoryStream containing a copy of the internally contained Excel workbook.

Implements Aspose::Slides::Charts::IChartData.

◆ set_UseSecondaryCategories()

void Aspose::Slides::Charts::ChartData::set_UseSecondaryCategories ( bool  value)
overridevirtual

If set to false then ChartData::get_SecondaryCategories returns null and data in ChartData::get_Categories is used both for primary and secondary series. If set to true then data in ChartData::get_SecondaryCategories is used for secondary series and data in ChartData::get_Categories is used for primary series. Write bool.

Example. What categories are related to series - ChartData.Categories or ChartData.SecondaryCategories?

if (series->get_PlotOnSecondAxis() && series->get_Chart()->get_ChartData()->get_UseSecondaryCategories())
{
// related categories are series->get_Chart()->get_ChartData()->get_SecondaryCategories()
}
else
{
// related categories are series->get_Chart()->get_ChartData()->get_Categories()
}

Implements Aspose::Slides::Charts::IChartData.

◆ SetExternalWorkbook() [1/2]

void Aspose::Slides::Charts::ChartData::SetExternalWorkbook ( System::String  workbookPath)
overridevirtual

Sets external workbook as a data source for the chart. Chart data will be updated from the target workbook.

Parameters
workbookPathPath to the target workbook
Exceptions
System::InvalidOperationExceptionExternal workbook is not available or can't be loaded.
auto pres = System::MakeObject<Presentation>();
auto chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Pie, 50.0f, 50.0f, 400.0f, 600.0f, true);
auto chartData = chart->get_ChartData();
(System::DynamicCast_noexcept<Aspose::Slides::Charts::ChartData>(chartData))->SetExternalWorkbook(u"../../workbook.xlsx");

Implements Aspose::Slides::Charts::IChartData.

◆ SetExternalWorkbook() [2/2]

void Aspose::Slides::Charts::ChartData::SetExternalWorkbook ( System::String  workbookPath,
bool  updateChartData 
)
overridevirtual

Sets external workbook as a data source for the chart.

Parameters
workbookPathPath to the target workbook
updateChartDataIf value is false only workbook path will be updated. Chart data won't be loaded and updated from the target workbook. Can be used when target workbook doesn't exist or it's not available. If value is true chart data will be updated from the target workbook.
Exceptions
System::InvalidOperationExceptionExternal workbook is not available or can't be loaded.
auto pres = System::MakeObject<Presentation>();
auto chart = pres->get_Slides()->idx_get(0)->get_Shapes()->AddChart(Aspose::Slides::Charts::ChartType::Pie, 50.0f, 50.0f, 400.0f, 600.0f, true);
auto chartData = chart->get_ChartData();
(System::DynamicCast_noexcept<Aspose::Slides::Charts::ChartData>(chartData))->SetExternalWorkbook(u"http://path/doesnt/exists", false);

Implements Aspose::Slides::Charts::IChartData.

◆ SetRange()

void Aspose::Slides::Charts::ChartData::SetRange ( System::String  formula)
overridevirtual

Set chart data range. Series and categories will be updated based on new data range. If amount of series in data range greater than count of series in the chart data then additional series with the same type as a last series in the current collection will be added to the end of the collection.

Parameters
formulaThe cells data range formula. E.g: "Sheet1!$A$1:$C$4" , "SomeSheetName!A1:B100", "Sheet1!$A$1:$B$5;Sheet1!$D$1:$D$5".
Exceptions
System::ArgumentNullExceptionformula is null.
System::InvalidOperationExceptionUnsupported chart type
System::ArgumentExceptionformula has incorrect format.

Implements Aspose::Slides::Charts::IChartData.

◆ SwitchRowColumn()

void Aspose::Slides::Charts::ChartData::SwitchRowColumn ( )
overridevirtual

Swap the data over the axis. Data being charted on the X axis will move to the Y axis and vice versa.

Implements Aspose::Slides::Charts::IChartData.

◆ WriteWorkbookStream()

void Aspose::Slides::Charts::ChartData::WriteWorkbookStream ( System::SharedPtr< System::IO::MemoryStream ms)
overridevirtual

Initializes the internally contained Excel workbook with user-specified value.

Parameters
msThe user-supplied stream containing the entire Excel workbook.

Implements Aspose::Slides::Charts::IChartData.