Aspose::Words::Drawing::Charts::ChartMarker Class Reference

Detailed Description

Represents a chart data marker.

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/ChartMarker.h>

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

Public Member Functions

SharedPtr< ChartFormatget_Format ()
 Provides access to fill and line formatting of this marker. More...
 
int32_t get_Size ()
 Gets or sets chart marker size. Default value is 7. More...
 
MarkerSymbol get_Symbol ()
 Gets or sets chart marker symbol. More...
 
virtual const TypeInfoGetType () const override
 
virtual bool Is (const TypeInfo &target) const override
 
void set_Size (int32_t value)
 Setter for get_Size. More...
 
void set_Symbol (MarkerSymbol value)
 Setter for get_Symbol. More...
 

Static Public Member Functions

static const TypeInfoType ()
 

Member Function Documentation

◆ get_Format()

System::SharedPtr< Aspose::Words::Drawing::Charts::ChartFormat > Aspose::Words::Drawing::Charts::ChartMarker::get_Format ( )

Provides access to fill and line formatting of this marker.

Examples

Show how to set marker formatting.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);
SharedPtr<Shape> shape = builder->InsertChart(ChartType::Scatter, 432, 252);
SharedPtr<Chart> chart = shape->get_Chart();
// Delete default generated series.
chart->get_Series()->Clear();
SharedPtr<ChartSeries> series =
chart->get_Series()->Add(u"AW Series 1", MakeArray<double>({0.7, 1.8, 2.6, 3.9}), MakeArray<double>({2.7, 3.2, 0.8, 1.7}));
// Set marker formatting.
series->get_Marker()->set_Size(40);
series->get_Marker()->set_Symbol(MarkerSymbol::Square);
SharedPtr<ChartDataPointCollection> dataPoints = series->get_DataPoints();
dataPoints->idx_get(0)->get_Marker()->get_Format()->get_Fill()->PresetTextured(PresetTexture::Denim);
dataPoints->idx_get(0)->get_Marker()->get_Format()->get_Stroke()->set_ForeColor(System::Drawing::Color::get_Yellow());
dataPoints->idx_get(0)->get_Marker()->get_Format()->get_Stroke()->set_BackColor(System::Drawing::Color::get_Red());
dataPoints->idx_get(1)->get_Marker()->get_Format()->get_Fill()->PresetTextured(PresetTexture::WaterDroplets);
dataPoints->idx_get(1)->get_Marker()->get_Format()->get_Stroke()->set_ForeColor(System::Drawing::Color::get_Yellow());
dataPoints->idx_get(1)->get_Marker()->get_Format()->get_Stroke()->set_Visible(false);
dataPoints->idx_get(2)->get_Marker()->get_Format()->get_Fill()->PresetTextured(PresetTexture::GreenMarble);
dataPoints->idx_get(2)->get_Marker()->get_Format()->get_Stroke()->set_ForeColor(System::Drawing::Color::get_Yellow());
dataPoints->idx_get(3)->get_Marker()->get_Format()->get_Fill()->PresetTextured(PresetTexture::Oak);
dataPoints->idx_get(3)->get_Marker()->get_Format()->get_Stroke()->set_ForeColor(System::Drawing::Color::get_Yellow());
dataPoints->idx_get(3)->get_Marker()->get_Format()->get_Stroke()->set_Transparency(0.5);
doc->Save(ArtifactsDir + u"Charts.MarkerFormatting.docx");

◆ get_Size()

int32_t Aspose::Words::Drawing::Charts::ChartMarker::get_Size ( )

Gets or sets chart marker size. Default value is 7.

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_Symbol()

Aspose::Words::Drawing::Charts::MarkerSymbol Aspose::Words::Drawing::Charts::ChartMarker::get_Symbol ( )

Gets or sets chart marker symbol.

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::ChartMarker::GetType ( ) const
overridevirtual

◆ Is()

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

◆ set_Size()

void Aspose::Words::Drawing::Charts::ChartMarker::set_Size ( int32_t  value)

◆ set_Symbol()

void Aspose::Words::Drawing::Charts::ChartMarker::set_Symbol ( Aspose::Words::Drawing::Charts::MarkerSymbol  value)

◆ Type()

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