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

#include <VCartesianAxis.hxx>

Inheritance diagram for chart::VCartesianAxis:
[legend]
Collaboration diagram for chart::VCartesianAxis:
[legend]

Classes

struct  ScreenPosAndLogicPos
 

Public Member Functions

 VCartesianAxis (const AxisProperties &rAxisProperties, const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier, sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount, PlottingPositionHelper *pPosHelper=nullptr)
 
virtual ~VCartesianAxis () override
 
virtual void createMaximumLabels () override
 
virtual void createLabels () override
 
virtual void updatePositions () override
 
virtual void createShapes () override
 
virtual sal_Int32 estimateMaximumAutoMainIncrementCount () override
 
virtual void createAllTickInfos (TickInfoArraysType &rAllTickInfos) override
 
void createAllTickInfosFromComplexCategories (TickInfoArraysType &rAllTickInfos, bool bShiftedPosition)
 
TickItercreateLabelTickIterator (sal_Int32 nTextLevel)
 
TickItercreateMaximumLabelTickIterator (sal_Int32 nTextLevel)
 
sal_Int32 getTextLevelCount () const
 
virtual TickFactorycreateTickFactory () override
 
double getAxisIntersectionValue () const
 Get the value at which the other axis crosses. More...
 
double getLabelLineIntersectionValue () const
 Get the value at which label line crosses the other axis. More...
 
double getExtraLineIntersectionValue () const
 Get the value at which extra line crosses the other axis. More...
 
void get2DAxisMainLine (basegfx::B2DVector &rStart, basegfx::B2DVector &rEnd, AxisLabelAlignment &rLabelAlignment, double fCrossesOtherAxis) const
 
void createDataTableView (std::vector< std::unique_ptr< VSeriesPlotter > > &rSeriesPlotterList, css::uno::Reference< css::util::XNumberFormatsSupplier > const &xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel > const &xChartDoc, css::uno::Reference< css::uno::XComponentContext > const &rComponentContext) override
 
- Public Member Functions inherited from chart::VAxisBase
 VAxisBase (sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount, const AxisProperties &rAxisProperties, const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier)
 
virtual ~VAxisBase () override
 
sal_Int32 getDimensionCount () const
 Return the number of dimensions the diagram has. More...
 
virtual void createMaximumLabels ()=0
 
virtual void createLabels ()=0
 
virtual void updatePositions ()=0
 
virtual bool isAnythingToDraw ()
 
virtual void initAxisLabelProperties (const css::awt::Size &rFontReferenceSize, const css::awt::Rectangle &rMaximumSpaceForLabels)
 
virtual void setExplicitScaleAndIncrement (const ExplicitScaleData &rScale, const ExplicitIncrementData &rIncrement) override
 
virtual sal_Int32 estimateMaximumAutoMainIncrementCount ()
 
virtual void createAllTickInfos (TickInfoArraysType &rAllTickInfos)
 
void setExtraLinePositionAtOtherAxis (double fCrossingAt)
 
virtual void createDataTableView (std::vector< std::unique_ptr< VSeriesPlotter > > &rSeriesPlotterList, css::uno::Reference< css::util::XNumberFormatsSupplier > const &xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel > const &xChartDoc, css::uno::Reference< css::uno::XComponentContext > const &rComponentContext)
 
std::shared_ptr< DataTableViewgetDataTableView ()
 
- Public Member Functions inherited from chart::VAxisOrGridBase
 VAxisOrGridBase (sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount)
 
virtual ~VAxisOrGridBase () override
 
virtual void setTransformationSceneToScreen (const css::drawing::HomogenMatrix &rMatrix) override
 
virtual void setExplicitScaleAndIncrement (const ExplicitScaleData &rScale, const ExplicitIncrementData &rIncrement)
 
void set3DWallPositions (CuboidPlanePosition eLeftWallPos, CuboidPlanePosition eBackWallPos, CuboidPlanePosition eBottomPos)
 
virtual TickFactorycreateTickFactory ()
 
- Public Member Functions inherited from chart::PlotterBase
 PlotterBase (sal_Int32 nDimension)
 
virtual ~PlotterBase ()
 
virtual void initPlotter (const rtl::Reference< SvxShapeGroupAnyD > &xLogicTarget, const rtl::Reference< SvxShapeGroupAnyD > &xFinalTarget, const OUString &rCID)
 
virtual void setScales (std::vector< ExplicitScaleData > &&rScales, bool bSwapXAndYAxis)
 
virtual void setTransformationSceneToScreen (const css::drawing::HomogenMatrix &rMatrix)
 
virtual void createShapes ()=0
 

Private Member Functions

bool createTextShapes (const rtl::Reference< SvxShapeGroupAnyD > &xTarget, TickIter &rTickIter, AxisLabelProperties &rAxisLabelProperties, TickFactory2D const *pTickFactory, sal_Int32 nScreenDistanceBetweenTicks)
 Go through all tick label positions and decide which labels to display based on the text shape geometry, overlap setting, tick interval, auto-stagger setting etc. More...
 
bool createTextShapesSimple (const rtl::Reference< SvxShapeGroupAnyD > &xTarget, TickIter &rTickIter, AxisLabelProperties &rAxisLabelProperties, TickFactory2D const *pTickFactory)
 Variant of createTextShapes where none of auto-staggering and link-breaking are allowed in case of overlaps. More...
 
void createTickMarkLineShapes (TickInfoArrayType &rTickInfos, const TickmarkProperties &rTickmarkProperties, TickFactory2D const &rTickFactory2D, bool bOnlyAtLabels)
 
TickFactory2DcreateTickFactory2D ()
 
void hideIdenticalScreenValues (TickInfoArraysType &rTickInfos) const
 
void doStaggeringOfLabels (const AxisLabelProperties &rAxisLabelProperties, TickFactory2D const *pTickFactory2D)
 Shift the screen positions of the tick labels according to the stagger settings. More...
 
bool isBreakOfLabelsAllowed (const AxisLabelProperties &rAxisLabelProperties, bool bIsHorizontalAxis, bool bIsVerticalAxis) const
 
::basegfx::B2DVector getScreenPosition (double fLogicX, double fLogicY, double fLogicZ) const
 
ScreenPosAndLogicPos getScreenPosAndLogicPos (double fLogicX, double fLogicY, double fLogicZ) const
 
void createDataTableShape (std::unique_ptr< TickFactory2D > const &rTickFactory2D)
 

Additional Inherited Members

- Static Public Member Functions inherited from chart::PlotterBase
static bool isValidPosition (const css::drawing::Position3D &rPos)
 
- Protected Member Functions inherited from chart::VAxisBase
void removeTextShapesFromTicks ()
 
void updateUnscaledValuesAtTicks (TickIter &rIter)
 
virtual bool prepareShapeCreation ()
 
void recordMaximumTextSize (SvxShape &xShape, double fRotationAngleDegree)
 
bool isDateAxis () const
 
bool isComplexCategoryAxis () const
 
- Protected Member Functions inherited from chart::PlotterBase
rtl::Reference< SvxShapeGroupAnyDcreateGroupShape (const rtl::Reference< SvxShapeGroupAnyD > &xTarget, const OUString &rName=OUString())
 
- Static Protected Member Functions inherited from chart::VAxisBase
static size_t getIndexOfLongestLabel (const css::uno::Sequence< OUString > &rLabels)
 
- Protected Attributes inherited from chart::VAxisBase
css::uno::Reference< css::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier
 
AxisProperties m_aAxisProperties
 
AxisLabelProperties m_aAxisLabelProperties
 
css::uno::Sequence< OUString > m_aTextLabels
 
bool m_bUseTextLabels
 
rtl::Reference< SvxShapeGroupAnyDm_xGroupShape_Shapes
 
rtl::Reference< SvxShapeGroupAnyDm_xTextTarget
 
rtl::Reference< SvxShapeGroupAnyDm_xDataTableTarget
 
std::shared_ptr< DataTableViewm_pDataTableView
 
TickInfoArraysType m_aAllTickInfos
 This typically consists of 2 TickInfo vectors (i.e. More...
 
bool m_bReCreateAllTickInfos
 
bool m_bRecordMaximumTextSize
 
sal_Int32 m_nMaximumTextWidthSoFar
 
sal_Int32 m_nMaximumTextHeightSoFar
 
- Protected Attributes inherited from chart::VAxisOrGridBase
ExplicitScaleData m_aScale
 
ExplicitIncrementData m_aIncrement
 
sal_Int32 m_nDimensionIndex
 
::basegfx::B3DHomMatrix m_aMatrixScreenToScene
 
CuboidPlanePosition m_eLeftWallPos
 
CuboidPlanePosition m_eBackWallPos
 
CuboidPlanePosition m_eBottomPos
 
- Protected Attributes inherited from chart::PlotterBase
rtl::Reference< SvxShapeGroupAnyDm_xLogicTarget
 
rtl::Reference< SvxShapeGroupAnyDm_xFinalTarget
 
OUString m_aCID
 
const sal_Int32 m_nDimension
 
PlottingPositionHelperm_pPosHelper
 

Detailed Description

Definition at line 26 of file VCartesianAxis.hxx.

Constructor & Destructor Documentation

◆ VCartesianAxis()

chart::VCartesianAxis::VCartesianAxis ( const AxisProperties rAxisProperties,
const css::uno::Reference< css::util::XNumberFormatsSupplier > &  xNumberFormatsSupplier,
sal_Int32  nDimensionIndex,
sal_Int32  nDimensionCount,
PlottingPositionHelper pPosHelper = nullptr 
)

Definition at line 63 of file VCartesianAxis.cxx.

References chart::PlotterBase::m_pPosHelper.

◆ ~VCartesianAxis()

chart::VCartesianAxis::~VCartesianAxis ( )
overridevirtual

Definition at line 75 of file VCartesianAxis.cxx.

References chart::PlotterBase::m_pPosHelper.

Member Function Documentation

◆ createAllTickInfos()

void chart::VCartesianAxis::createAllTickInfos ( TickInfoArraysType rAllTickInfos)
overridevirtual

Reimplemented from chart::VAxisBase.

Definition at line 659 of file VCartesianAxis.cxx.

◆ createAllTickInfosFromComplexCategories()

void chart::VCartesianAxis::createAllTickInfosFromComplexCategories ( TickInfoArraysType rAllTickInfos,
bool  bShiftedPosition 
)

◆ createDataTableShape()

void chart::VCartesianAxis::createDataTableShape ( std::unique_ptr< TickFactory2D > const &  rTickFactory2D)
private

Definition at line 1667 of file VCartesianAxis.cxx.

◆ createDataTableView()

void chart::VCartesianAxis::createDataTableView ( std::vector< std::unique_ptr< VSeriesPlotter > > &  rSeriesPlotterList,
css::uno::Reference< css::util::XNumberFormatsSupplier > const &  xNumberFormatsSupplier,
rtl::Reference<::chart::ChartModel > const &  xChartDoc,
css::uno::Reference< css::uno::XComponentContext > const &  rComponentContext 
)
overridevirtual

Reimplemented from chart::VAxisBase.

Definition at line 2012 of file VCartesianAxis.cxx.

◆ createLabels()

void chart::VCartesianAxis::createLabels ( )
overridevirtual

◆ createLabelTickIterator()

TickIter * chart::VCartesianAxis::createLabelTickIterator ( sal_Int32  nTextLevel)

Definition at line 667 of file VCartesianAxis.cxx.

References o3tl::make_unsigned().

◆ createMaximumLabels()

void chart::VCartesianAxis::createMaximumLabels ( )
overridevirtual

◆ createMaximumLabelTickIterator()

TickIter * chart::VCartesianAxis::createMaximumLabelTickIterator ( sal_Int32  nTextLevel)

Definition at line 674 of file VCartesianAxis.cxx.

References size.

◆ createShapes()

void chart::VCartesianAxis::createShapes ( )
overridevirtual

◆ createTextShapes()

bool chart::VCartesianAxis::createTextShapes ( const rtl::Reference< SvxShapeGroupAnyD > &  xTarget,
TickIter rTickIter,
AxisLabelProperties rAxisLabelProperties,
TickFactory2D const *  pTickFactory,
sal_Int32  nScreenDistanceBetweenTicks 
)
private

Go through all tick label positions and decide which labels to display based on the text shape geometry, overlap setting, tick interval, auto-stagger setting etc.

When the auto-stagger setting is on, try to avoid overlaps by staggering labels or set the labels at an angle. This method may change the axis label properties especially when the auto staggering is performed. But the screen label positions will not be shifted in this method; it will be done in the doStaggeringOfLabels method.

Returns
true if the text shapes have been successfully created, otherwise false. Returning false means the AxisLabelProperties have changed during the call, and the caller needs to call this method once again to get the text shapes created.

Definition at line 705 of file VCartesianAxis.cxx.

References aLabel, aPropNames, chart::AxisLabelProperties::autoRotate45(), COL_AUTO(), chart::createSingleLabel(), chart::doesOverlap(), chart::TickIter::firstInfo(), chart::getAxisLabelProperties(), chart::TickFactory2D::getDistanceAxisTickToText(), chart::getTextLabelString(), basegfx::Tuple2D< typename TYPE >::getX(), chart::TickFactory2D::getXaxisEndPos(), chart::TickFactory2D::getXaxisStartPos(), basegfx::Tuple2D< typename TYPE >::getY(), chart::TickFactory2D::isHorizontalAxis(), chart::AxisLabelProperties::isStaggered(), chart::TickFactory2D::isVerticalAxis(), chart::lcl_doesShapeOverlapWithTickmark(), chart::lcl_hasWordBreak(), chart::AxisLabelProperties::m_aFontReferenceSize, chart::AxisLabelProperties::m_aMaximumSpaceForLabels, chart::AxisLabelProperties::m_bLineBreakAllowed, chart::AxisLabelProperties::m_bOverlapAllowed, chart::AxisLabelProperties::m_eStaggering, chart::AxisLabelProperties::m_fRotationAngleDegree, chart::AxisLabelProperties::m_nNumberFormatKey, chart::AxisLabelProperties::m_nRhythm, chart::TickIter::nextInfo(), chart::removeShapesAtWrongRhythm(), u, xTarget, and chart::TickInfo::xTextShape.

◆ createTextShapesSimple()

bool chart::VCartesianAxis::createTextShapesSimple ( const rtl::Reference< SvxShapeGroupAnyD > &  xTarget,
TickIter rTickIter,
AxisLabelProperties rAxisLabelProperties,
TickFactory2D const *  pTickFactory 
)
private

◆ createTickFactory()

TickFactory * chart::VCartesianAxis::createTickFactory ( )
overridevirtual

Reimplemented from chart::VAxisOrGridBase.

Definition at line 1510 of file VCartesianAxis.cxx.

◆ createTickFactory2D()

TickFactory2D * chart::VCartesianAxis::createTickFactory2D ( )
private

Definition at line 1515 of file VCartesianAxis.cxx.

◆ createTickMarkLineShapes()

void chart::VCartesianAxis::createTickMarkLineShapes ( TickInfoArrayType rTickInfos,
const TickmarkProperties rTickmarkProperties,
TickFactory2D const &  rTickFactory2D,
bool  bOnlyAtLabels 
)
private

◆ doStaggeringOfLabels()

void chart::VCartesianAxis::doStaggeringOfLabels ( const AxisLabelProperties rAxisLabelProperties,
TickFactory2D const *  pTickFactory2D 
)
private

Shift the screen positions of the tick labels according to the stagger settings.

Final stagger setting is decided during the createTextShapes call, but this method does the physical shifting of the label positions based on the final stagger setting.

Definition at line 1623 of file VCartesianAxis.cxx.

References chart::TickFactory2D::getDistanceAxisTickToText(), chart::AxisLabelProperties::isStaggered(), chart::lcl_getLabelsDistance(), chart::lcl_shiftLabels(), and chart::AxisLabelProperties::m_eStaggering.

◆ estimateMaximumAutoMainIncrementCount()

sal_Int32 chart::VCartesianAxis::estimateMaximumAutoMainIncrementCount ( )
overridevirtual

◆ get2DAxisMainLine()

void chart::VCartesianAxis::get2DAxisMainLine ( basegfx::B2DVector rStart,
basegfx::B2DVector rEnd,
AxisLabelAlignment rLabelAlignment,
double  fCrossesOtherAxis 
) const

◆ getAxisIntersectionValue()

double chart::VCartesianAxis::getAxisIntersectionValue ( ) const

Get the value at which the other axis crosses.

Definition at line 1094 of file VCartesianAxis.cxx.

References m_nDimensionIndex.

◆ getExtraLineIntersectionValue()

double chart::VCartesianAxis::getExtraLineIntersectionValue ( ) const

Get the value at which extra line crosses the other axis.

Returns
a NaN if the line doesn't cross the other axis, a non-NaN value otherwise.

Definition at line 1116 of file VCartesianAxis.cxx.

References m_nDimensionIndex.

◆ getLabelLineIntersectionValue()

double chart::VCartesianAxis::getLabelLineIntersectionValue ( ) const

Get the value at which label line crosses the other axis.

Definition at line 1105 of file VCartesianAxis.cxx.

References m_nDimensionIndex.

◆ getScreenPosAndLogicPos()

VCartesianAxis::ScreenPosAndLogicPos chart::VCartesianAxis::getScreenPosAndLogicPos ( double  fLogicX,
double  fLogicY,
double  fLogicZ 
) const
private

◆ getScreenPosition()

B2DVector chart::VCartesianAxis::getScreenPosition ( double  fLogicX,
double  fLogicY,
double  fLogicZ 
) const
private

Definition at line 1131 of file VCartesianAxis.cxx.

◆ getTextLevelCount()

sal_Int32 chart::VCartesianAxis::getTextLevelCount ( ) const

Definition at line 697 of file VCartesianAxis.cxx.

◆ hideIdenticalScreenValues()

void chart::VCartesianAxis::hideIdenticalScreenValues ( TickInfoArraysType rTickInfos) const
private

Definition at line 1543 of file VCartesianAxis.cxx.

References chart::lcl_hideIdenticalScreenValues(), and nCount.

◆ isBreakOfLabelsAllowed()

bool chart::VCartesianAxis::isBreakOfLabelsAllowed ( const AxisLabelProperties rAxisLabelProperties,
bool  bIsHorizontalAxis,
bool  bIsVerticalAxis 
) const
private
Returns
true if we can break a single line label text into multiple lines for better fitting, otherwise false.

Definition at line 515 of file VCartesianAxis.cxx.

References chart::AxisLabelProperties::m_bLineBreakAllowed, chart::AxisLabelProperties::m_bStackCharacters, and chart::AxisLabelProperties::m_fRotationAngleDegree.

◆ updatePositions()

void chart::VCartesianAxis::updatePositions ( )
overridevirtual

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