search/mag_sel search/close
Aspose::Words::Drawing::Charts::ChartDataPointCollection Class Reference

Represents collection of a ChartDataPoint.

Examples

Shows how to work with data points on a line chart.

void ChartDataPoint_()
{
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 500, 350);
SharedPtr<Chart> chart = shape->get_Chart();
ASSERT_EQ(3, chart->get_Series()->get_Count());
ASSERT_EQ(u"Series 1", chart->get_Series()->idx_get(0)->get_Name());
ASSERT_EQ(u"Series 2", chart->get_Series()->idx_get(1)->get_Name());
ASSERT_EQ(u"Series 3", chart->get_Series()->idx_get(2)->get_Name());
// Emphasize the chart's data points by making them appear as diamond shapes.
for (const auto& series : System::IterateOver(chart->get_Series()))
{
ApplyDataPoints(series, 4, MarkerSymbol::Diamond, 15);
}
// Smooth out the line that represents the first data series.
chart->get_Series()->idx_get(0)->set_Smooth(true);
// Verify that data points for the first series will not invert their colors if the value is negative.
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<ChartDataPoint>>> enumerator =
chart->get_Series()->idx_get(0)->get_DataPoints()->GetEnumerator();
while (enumerator->MoveNext())
{
ASSERT_FALSE(enumerator->get_Current()->get_InvertIfNegative());
}
}
// For a cleaner looking graph, we can clear format individually.
chart->get_Series()->idx_get(1)->get_DataPoints()->idx_get(2)->ClearFormat();
// We can also strip an entire series of data points at once.
chart->get_Series()->idx_get(2)->get_DataPoints()->ClearFormat();
doc->Save(ArtifactsDir + u"Charts.ChartDataPoint.docx");
}
static void ApplyDataPoints(SharedPtr<ChartSeries> series, int dataPointsCount, MarkerSymbol markerSymbol, int dataPointSize)
{
for (int i = 0; i < dataPointsCount; i++)
{
SharedPtr<ChartDataPoint> point = series->get_DataPoints()->idx_get(i);
point->get_Marker()->set_Symbol(markerSymbol);
point->get_Marker()->set_Size(dataPointSize);
ASSERT_EQ(i, point->get_Index());
}
}

#include <Aspose.Words.Cpp/Drawing/Charts/ChartDataPointCollection.h>

+ Inheritance diagram for Aspose::Words::Drawing::Charts::ChartDataPointCollection:

Public Member Functions

SharedPtr< ChartDataPointAdd (int32_t index)
 
void Clear ()
 
void ClearFormat ()
 Clears format of all ChartDataPoint in this collection. More...
 
int32_t get_Count ()
 Returns the number of ChartDataPoint in this collection. More...
 
SharedPtr< IEnumerator< SharedPtr< ChartDataPoint > > > GetEnumerator () override
 Returns an enumerator object. More...
 
virtual const TypeInfoGetType () const override
 
SharedPtr< ChartDataPointidx_get (int32_t index)
 Returns ChartDataPoint for the specified index. More...
 
virtual bool Is (const TypeInfo &target) const override
 
void RemoveAt (int32_t index)
 

Static Public Member Functions

static const TypeInfoType ()
 

Member Function Documentation

◆ Add()

System::SharedPtr<Aspose::Words::Drawing::Charts::ChartDataPoint> Aspose::Words::Drawing::Charts::ChartDataPointCollection::Add ( int32_t  index)
Parameters
indexTarget data point index.

◆ Clear()

void Aspose::Words::Drawing::Charts::ChartDataPointCollection::Clear ( )

◆ ClearFormat()

void Aspose::Words::Drawing::Charts::ChartDataPointCollection::ClearFormat ( )

Clears format of all ChartDataPoint in this collection.

Examples

Shows how to work with data points on a line chart.

void ChartDataPoint_()
{
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 500, 350);
SharedPtr<Chart> chart = shape->get_Chart();
ASSERT_EQ(3, chart->get_Series()->get_Count());
ASSERT_EQ(u"Series 1", chart->get_Series()->idx_get(0)->get_Name());
ASSERT_EQ(u"Series 2", chart->get_Series()->idx_get(1)->get_Name());
ASSERT_EQ(u"Series 3", chart->get_Series()->idx_get(2)->get_Name());
// Emphasize the chart's data points by making them appear as diamond shapes.
for (const auto& series : System::IterateOver(chart->get_Series()))
{
ApplyDataPoints(series, 4, MarkerSymbol::Diamond, 15);
}
// Smooth out the line that represents the first data series.
chart->get_Series()->idx_get(0)->set_Smooth(true);
// Verify that data points for the first series will not invert their colors if the value is negative.
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<ChartDataPoint>>> enumerator =
chart->get_Series()->idx_get(0)->get_DataPoints()->GetEnumerator();
while (enumerator->MoveNext())
{
ASSERT_FALSE(enumerator->get_Current()->get_InvertIfNegative());
}
}
// For a cleaner looking graph, we can clear format individually.
chart->get_Series()->idx_get(1)->get_DataPoints()->idx_get(2)->ClearFormat();
// We can also strip an entire series of data points at once.
chart->get_Series()->idx_get(2)->get_DataPoints()->ClearFormat();
doc->Save(ArtifactsDir + u"Charts.ChartDataPoint.docx");
}
static void ApplyDataPoints(SharedPtr<ChartSeries> series, int dataPointsCount, MarkerSymbol markerSymbol, int dataPointSize)
{
for (int i = 0; i < dataPointsCount; i++)
{
SharedPtr<ChartDataPoint> point = series->get_DataPoints()->idx_get(i);
point->get_Marker()->set_Symbol(markerSymbol);
point->get_Marker()->set_Size(dataPointSize);
ASSERT_EQ(i, point->get_Index());
}
}

◆ get_Count()

int32_t Aspose::Words::Drawing::Charts::ChartDataPointCollection::get_Count ( )

Returns the number of ChartDataPoint in this collection.

Examples

Shows how to work with data points on a line chart.

void ChartDataPoint_()
{
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 500, 350);
SharedPtr<Chart> chart = shape->get_Chart();
ASSERT_EQ(3, chart->get_Series()->get_Count());
ASSERT_EQ(u"Series 1", chart->get_Series()->idx_get(0)->get_Name());
ASSERT_EQ(u"Series 2", chart->get_Series()->idx_get(1)->get_Name());
ASSERT_EQ(u"Series 3", chart->get_Series()->idx_get(2)->get_Name());
// Emphasize the chart's data points by making them appear as diamond shapes.
for (const auto& series : System::IterateOver(chart->get_Series()))
{
ApplyDataPoints(series, 4, MarkerSymbol::Diamond, 15);
}
// Smooth out the line that represents the first data series.
chart->get_Series()->idx_get(0)->set_Smooth(true);
// Verify that data points for the first series will not invert their colors if the value is negative.
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<ChartDataPoint>>> enumerator =
chart->get_Series()->idx_get(0)->get_DataPoints()->GetEnumerator();
while (enumerator->MoveNext())
{
ASSERT_FALSE(enumerator->get_Current()->get_InvertIfNegative());
}
}
// For a cleaner looking graph, we can clear format individually.
chart->get_Series()->idx_get(1)->get_DataPoints()->idx_get(2)->ClearFormat();
// We can also strip an entire series of data points at once.
chart->get_Series()->idx_get(2)->get_DataPoints()->ClearFormat();
doc->Save(ArtifactsDir + u"Charts.ChartDataPoint.docx");
}
static void ApplyDataPoints(SharedPtr<ChartSeries> series, int dataPointsCount, MarkerSymbol markerSymbol, int dataPointSize)
{
for (int i = 0; i < dataPointsCount; i++)
{
SharedPtr<ChartDataPoint> point = series->get_DataPoints()->idx_get(i);
point->get_Marker()->set_Symbol(markerSymbol);
point->get_Marker()->set_Size(dataPointSize);
ASSERT_EQ(i, point->get_Index());
}
}

◆ GetEnumerator()

System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Words::Drawing::Charts::ChartDataPoint> > > Aspose::Words::Drawing::Charts::ChartDataPointCollection::GetEnumerator ( )
override

Returns an enumerator object.

Examples

Shows how to work with data points on a line chart.

void ChartDataPoint_()
{
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 500, 350);
SharedPtr<Chart> chart = shape->get_Chart();
ASSERT_EQ(3, chart->get_Series()->get_Count());
ASSERT_EQ(u"Series 1", chart->get_Series()->idx_get(0)->get_Name());
ASSERT_EQ(u"Series 2", chart->get_Series()->idx_get(1)->get_Name());
ASSERT_EQ(u"Series 3", chart->get_Series()->idx_get(2)->get_Name());
// Emphasize the chart's data points by making them appear as diamond shapes.
for (const auto& series : System::IterateOver(chart->get_Series()))
{
ApplyDataPoints(series, 4, MarkerSymbol::Diamond, 15);
}
// Smooth out the line that represents the first data series.
chart->get_Series()->idx_get(0)->set_Smooth(true);
// Verify that data points for the first series will not invert their colors if the value is negative.
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<ChartDataPoint>>> enumerator =
chart->get_Series()->idx_get(0)->get_DataPoints()->GetEnumerator();
while (enumerator->MoveNext())
{
ASSERT_FALSE(enumerator->get_Current()->get_InvertIfNegative());
}
}
// For a cleaner looking graph, we can clear format individually.
chart->get_Series()->idx_get(1)->get_DataPoints()->idx_get(2)->ClearFormat();
// We can also strip an entire series of data points at once.
chart->get_Series()->idx_get(2)->get_DataPoints()->ClearFormat();
doc->Save(ArtifactsDir + u"Charts.ChartDataPoint.docx");
}
static void ApplyDataPoints(SharedPtr<ChartSeries> series, int dataPointsCount, MarkerSymbol markerSymbol, int dataPointSize)
{
for (int i = 0; i < dataPointsCount; i++)
{
SharedPtr<ChartDataPoint> point = series->get_DataPoints()->idx_get(i);
point->get_Marker()->set_Symbol(markerSymbol);
point->get_Marker()->set_Size(dataPointSize);
ASSERT_EQ(i, point->get_Index());
}
}

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::Drawing::Charts::ChartDataPointCollection::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ idx_get()

System::SharedPtr<Aspose::Words::Drawing::Charts::ChartDataPoint> Aspose::Words::Drawing::Charts::ChartDataPointCollection::idx_get ( int32_t  index)

Returns ChartDataPoint for the specified index.

Examples

Shows how to work with data points on a line chart.

void ChartDataPoint_()
{
auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Line, 500, 350);
SharedPtr<Chart> chart = shape->get_Chart();
ASSERT_EQ(3, chart->get_Series()->get_Count());
ASSERT_EQ(u"Series 1", chart->get_Series()->idx_get(0)->get_Name());
ASSERT_EQ(u"Series 2", chart->get_Series()->idx_get(1)->get_Name());
ASSERT_EQ(u"Series 3", chart->get_Series()->idx_get(2)->get_Name());
// Emphasize the chart's data points by making them appear as diamond shapes.
for (const auto& series : System::IterateOver(chart->get_Series()))
{
ApplyDataPoints(series, 4, MarkerSymbol::Diamond, 15);
}
// Smooth out the line that represents the first data series.
chart->get_Series()->idx_get(0)->set_Smooth(true);
// Verify that data points for the first series will not invert their colors if the value is negative.
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<ChartDataPoint>>> enumerator =
chart->get_Series()->idx_get(0)->get_DataPoints()->GetEnumerator();
while (enumerator->MoveNext())
{
ASSERT_FALSE(enumerator->get_Current()->get_InvertIfNegative());
}
}
// For a cleaner looking graph, we can clear format individually.
chart->get_Series()->idx_get(1)->get_DataPoints()->idx_get(2)->ClearFormat();
// We can also strip an entire series of data points at once.
chart->get_Series()->idx_get(2)->get_DataPoints()->ClearFormat();
doc->Save(ArtifactsDir + u"Charts.ChartDataPoint.docx");
}
static void ApplyDataPoints(SharedPtr<ChartSeries> series, int dataPointsCount, MarkerSymbol markerSymbol, int dataPointSize)
{
for (int i = 0; i < dataPointsCount; i++)
{
SharedPtr<ChartDataPoint> point = series->get_DataPoints()->idx_get(i);
point->get_Marker()->set_Symbol(markerSymbol);
point->get_Marker()->set_Size(dataPointSize);
ASSERT_EQ(i, point->get_Index());
}
}

◆ Is()

virtual bool Aspose::Words::Drawing::Charts::ChartDataPointCollection::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ RemoveAt()

void Aspose::Words::Drawing::Charts::ChartDataPointCollection::RemoveAt ( int32_t  index)
Parameters
indexThe zero-based index of the data point to clear format.

◆ Type()

static const System::TypeInfo& Aspose::Words::Drawing::Charts::ChartDataPointCollection::Type ( )
static