LibreOffice Module chart2 (master) 1
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
chart::SeriesPlotterContainer Class Reference

This class is a container of SeriesPlotter objects (such as PieChart instances). More...

#include <SeriesPlotterContainer.hxx>

Public Member Functions

 SeriesPlotterContainer (std::vector< std::unique_ptr< VCoordinateSystem > > &rVCooSysList)
 
 ~SeriesPlotterContainer ()
 
void initializeCooSysAndSeriesPlotter (ChartModel &rModel)
 It is used to set coordinate systems (m_rVCooSysList), this method is invoked by ChartView::createShapes2D before of ChartView::impl_createDiagramAndContent. More...
 
void initAxisUsageList (const Date &rNullDate)
 This method is invoked by ChartView::impl_createDiagramAndContent. More...
 
void doAutoScaling (ChartModel &rModel)
 Perform automatic axis scaling and determine the amount and spacing of increments. More...
 
void updateScalesAndIncrementsOnAxes ()
 After auto-scaling is performed, call this method to set the explicit scaling and increment data to all relevant VAxis objects. More...
 
void setScalesFromCooSysToPlotter ()
 After auto-scaling is performed, call this method to set the explicit scaling data to all the plotters. More...
 
void setNumberFormatsFromAxes ()
 
css::drawing::Direction3D getPreferredAspectRatio ()
 
std::vector< std::unique_ptr< VSeriesPlotter > > & getSeriesPlotterList ()
 
std::vector< std::unique_ptr< VCoordinateSystem > > & getCooSysList ()
 
std::vector< LegendEntryProvider * > getLegendEntryProviderList ()
 
void AdaptScaleOfYAxisWithoutAttachedSeries (ChartModel &rModel)
 
bool isCategoryPositionShifted (const css::chart2::ScaleData &rSourceScale, bool bHasComplexCategories)
 

Static Public Member Functions

static VCoordinateSystemgetCooSysForPlotter (const std::vector< std::unique_ptr< VCoordinateSystem > > &rVCooSysList, MinimumAndMaximumSupplier *pMinimumAndMaximumSupplier)
 
static VCoordinateSystemaddCooSysToList (std::vector< std::unique_ptr< VCoordinateSystem > > &rVCooSysList, const rtl::Reference< BaseCoordinateSystem > &xCooSys, ChartModel &rChartModel)
 
static VCoordinateSystemfindInCooSysList (const std::vector< std::unique_ptr< VCoordinateSystem > > &rVCooSysList, const rtl::Reference< BaseCoordinateSystem > &xCooSys)
 

Private Attributes

std::vector< std::unique_ptr< VSeriesPlotter > > m_aSeriesPlotterList
 A vector of series plotters. More...
 
std::vector< std::unique_ptr< VCoordinateSystem > > & m_rVCooSysList
 A vector of coordinate systems. More...
 
std::map< rtl::Reference< Axis >, AxisUsagem_aAxisUsageList
 A map whose key is a XAxis interface and the related value is an object of AxisUsage type. More...
 
sal_Int32 m_nMaxAxisIndex
 Max axis index of all dimensions. More...
 
bool m_bChartTypeUsesShiftedCategoryPositionPerDefault
 
bool m_bForceShiftPosition = false
 
sal_Int32 m_nDefaultDateNumberFormat
 

Detailed Description

This class is a container of SeriesPlotter objects (such as PieChart instances).

It is used for initializing coordinate systems, axes and scales of all series plotters which belongs to the container.

Definition at line 31 of file SeriesPlotterContainer.hxx.

Constructor & Destructor Documentation

◆ SeriesPlotterContainer()

chart::SeriesPlotterContainer::SeriesPlotterContainer ( std::vector< std::unique_ptr< VCoordinateSystem > > &  rVCooSysList)
explicit

Definition at line 57 of file SeriesPlotterContainer.cxx.

◆ ~SeriesPlotterContainer()

chart::SeriesPlotterContainer::~SeriesPlotterContainer ( )

Definition at line 66 of file SeriesPlotterContainer.cxx.

References m_rVCooSysList.

Member Function Documentation

◆ AdaptScaleOfYAxisWithoutAttachedSeries()

void chart::SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries ( ChartModel &  rModel)

◆ addCooSysToList()

VCoordinateSystem * chart::SeriesPlotterContainer::addCooSysToList ( std::vector< std::unique_ptr< VCoordinateSystem > > &  rVCooSysList,
const rtl::Reference< BaseCoordinateSystem > &  xCooSys,
ChartModel &  rChartModel 
)
static

◆ doAutoScaling()

void chart::SeriesPlotterContainer::doAutoScaling ( ChartModel &  rModel)

Perform automatic axis scaling and determine the amount and spacing of increments.

It assumes that the caller has determined the size of the largest axis label text object prior to calling this method.

The new axis scaling data will be stored in the VCoordinateSystem objects. The label alignment direction for each axis will also get determined during this process, and stored in VAxis.

This method is invoked by ChartView::impl_createDiagramAndContent soon after initAxisUsageList. It initializes explicit scale and increment objects for all coordinate systems in m_rVCooSysList. This action is achieved by iterating on the m_aAxisUsageList container, and performing 3 steps: 1- call VCoordinateSystem::prepareAutomaticAxisScaling for setting scaling parameters of the aAutoScaling member (a ScaleAutomatism object) for the current AxisUsage instance (see VCoordinateSystem::prepareAutomaticAxisScaling); 2- calculate the explicit scale and increment objects (see ScaleAutomatism::calculateExplicitScaleAndIncrement); 3- set the explicit scale and increment objects for each coordinate system.

Definition at line 503 of file SeriesPlotterContainer.cxx.

References AdaptScaleOfYAxisWithoutAttachedSeries(), m_aAxisUsageList, m_aSeriesPlotterList, and m_nMaxAxisIndex.

◆ findInCooSysList()

VCoordinateSystem * chart::SeriesPlotterContainer::findInCooSysList ( const std::vector< std::unique_ptr< VCoordinateSystem > > &  rVCooSysList,
const rtl::Reference< BaseCoordinateSystem > &  xCooSys 
)
static

◆ getCooSysForPlotter()

VCoordinateSystem * chart::SeriesPlotterContainer::getCooSysForPlotter ( const std::vector< std::unique_ptr< VCoordinateSystem > > &  rVCooSysList,
MinimumAndMaximumSupplier pMinimumAndMaximumSupplier 
)
static

◆ getCooSysList()

std::vector< std::unique_ptr< VCoordinateSystem > > & chart::SeriesPlotterContainer::getCooSysList ( )
inline

Definition at line 113 of file SeriesPlotterContainer.hxx.

References m_rVCooSysList.

◆ getLegendEntryProviderList()

std::vector< LegendEntryProvider * > chart::SeriesPlotterContainer::getLegendEntryProviderList ( )

Definition at line 73 of file SeriesPlotterContainer.cxx.

References m_aSeriesPlotterList.

◆ getPreferredAspectRatio()

drawing::Direction3D chart::SeriesPlotterContainer::getPreferredAspectRatio ( )

Definition at line 703 of file SeriesPlotterContainer.cxx.

References m_aSeriesPlotterList.

◆ getSeriesPlotterList()

std::vector< std::unique_ptr< VSeriesPlotter > > & chart::SeriesPlotterContainer::getSeriesPlotterList ( )
inline

Definition at line 109 of file SeriesPlotterContainer.hxx.

References m_aSeriesPlotterList.

◆ initAxisUsageList()

void chart::SeriesPlotterContainer::initAxisUsageList ( const Date rNullDate)

This method is invoked by ChartView::impl_createDiagramAndContent.

It iterates on every axis of every coordinate systems, and if the axis is not yet present in m_aAxisUsageList it creates a new AxisUsage object and initialize its aAutoScaling member to the ScaleData object of the current axis.

Definition at line 356 of file SeriesPlotterContainer.cxx.

References chart::AxisUsage::addCoordinateSystem(), chart::AxisHelper::checkDateAxis(), chart::AxisHelper::getChartTypeByIndex(), chart::ExplicitCategoriesProvider::hasComplexCategories(), isCategoryPositionShifted(), chart::ChartTypeHelper::isSupportingComplexCategory(), chart::ChartTypeHelper::isSupportingDateAxis(), m_aAxisUsageList, m_nMaxAxisIndex, m_rVCooSysList, and nDimCount.

◆ initializeCooSysAndSeriesPlotter()

void chart::SeriesPlotterContainer::initializeCooSysAndSeriesPlotter ( ChartModel &  rModel)

It is used to set coordinate systems (m_rVCooSysList), this method is invoked by ChartView::createShapes2D before of ChartView::impl_createDiagramAndContent.

Coordinate systems are retrieved through the XCoordinateSystemContainer interface implemented by a diagram object which is provided by the ChartModel object passed to the method (rChartModel.getFirstDiagram()).

It is used for creating series plotters and appending them to m_aSeriesPlotterList. The created series plotters are initialized through data (number formats supplier, color scheme, data series), extracted from the chart model or the diagram objects. An exception is the explicit category provider that is retrieved through the VCoordinateSystem object used by the series plotter.

It sets the minimum-maximum supplier for a coordinate system: this supplier is the series plotter itself which utilizes the given coordinate system. In fact VSeriesPlotter has MinimumMaximumSupplier as one of its base classes. Hence, for instance, a PieChart, which is a series plotter, is a MinimumMaximumSupplier, too.

Definition at line 131 of file SeriesPlotterContainer.cxx.

References addCooSysToList(), chart::VCoordinateSystem::addMinimumAndMaximumSupplier(), chart::VSeriesPlotter::addSeries(), CHART2_SERVICE_NAME_CHARTTYPE_PIE, CHART_UNONAME_SORT_BY_XVALUES, chart::ObjectIdentifier::createParticleForSeries(), chart::VSeriesPlotter::createSeriesPlotter(), DBG_UNHANDLED_EXCEPTION, chart::Excluding, chart::DiagramHelper::getDateNumberFormat(), chart::VCoordinateSystem::getExplicitCategoriesProvider(), chart::ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection(), chart::ChartTypeHelper::isSupportingSecondaryAxis(), m_aSeriesPlotterList, m_bChartTypeUsesShiftedCategoryPositionPerDefault, m_bForceShiftPosition, m_nDefaultDateNumberFormat, m_rVCooSysList, chart::MAIN_AXIS_INDEX, chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, chart::VSeriesPlotter::setColorScheme(), chart::VSeriesPlotter::setExplicitCategoriesProvider(), chart::VSeriesPlotter::setNumberFormatsSupplier(), chart::ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault(), and TOOLS_WARN_EXCEPTION.

◆ isCategoryPositionShifted()

bool chart::SeriesPlotterContainer::isCategoryPositionShifted ( const css::chart2::ScaleData &  rSourceScale,
bool  bHasComplexCategories 
)

◆ setNumberFormatsFromAxes()

void chart::SeriesPlotterContainer::setNumberFormatsFromAxes ( )

◆ setScalesFromCooSysToPlotter()

void chart::SeriesPlotterContainer::setScalesFromCooSysToPlotter ( )

◆ updateScalesAndIncrementsOnAxes()

void chart::SeriesPlotterContainer::updateScalesAndIncrementsOnAxes ( )

After auto-scaling is performed, call this method to set the explicit scaling and increment data to all relevant VAxis objects.

Definition at line 497 of file SeriesPlotterContainer.cxx.

References m_rVCooSysList.

Member Data Documentation

◆ m_aAxisUsageList

std::map<rtl::Reference<Axis>, AxisUsage> chart::SeriesPlotterContainer::m_aAxisUsageList
private

A map whose key is a XAxis interface and the related value is an object of AxisUsage type.

Definition at line 143 of file SeriesPlotterContainer.hxx.

Referenced by AdaptScaleOfYAxisWithoutAttachedSeries(), doAutoScaling(), and initAxisUsageList().

◆ m_aSeriesPlotterList

std::vector<std::unique_ptr<VSeriesPlotter> > chart::SeriesPlotterContainer::m_aSeriesPlotterList
private

◆ m_bChartTypeUsesShiftedCategoryPositionPerDefault

bool chart::SeriesPlotterContainer::m_bChartTypeUsesShiftedCategoryPositionPerDefault
private

◆ m_bForceShiftPosition

bool chart::SeriesPlotterContainer::m_bForceShiftPosition = false
private

◆ m_nDefaultDateNumberFormat

sal_Int32 chart::SeriesPlotterContainer::m_nDefaultDateNumberFormat
private

◆ m_nMaxAxisIndex

sal_Int32 chart::SeriesPlotterContainer::m_nMaxAxisIndex
private

Max axis index of all dimensions.

Currently this can be either 0 or 1 since we only support primary and secondary axes per dimension. The value of 0 means all dimensions have only primary axis, while 1 means at least one dimension has a secondary axis.

Definition at line 151 of file SeriesPlotterContainer.hxx.

Referenced by AdaptScaleOfYAxisWithoutAttachedSeries(), doAutoScaling(), and initAxisUsageList().

◆ m_rVCooSysList

std::vector<std::unique_ptr<VCoordinateSystem> >& chart::SeriesPlotterContainer::m_rVCooSysList
private

The documentation for this class was generated from the following files: