Kaydet (Commit) abd9272e authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) László Németh

Related: tdf#118705 Fix Column/Bar Chart data label placement

Modify the chart data label rendering in case of Column/Bar chart
only if the datapoint value is 0. This patch fix in case of NEAR_ORIGIN
and CENTER DataLabelPlacement.

Change-Id: Ia9857b5ac0cc5feaf2e1fd08e98c9f8534e5af04
Reviewed-on: https://gerrit.libreoffice.org/65082
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
Tested-by: 's avatarLászló Németh <nemeth@numbertext.org>
üst 13998b05
......@@ -244,11 +244,13 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment(
{
fY = (fBaseValue < fScaledUpperYValue) ? fScaledUpperYValue : fScaledLowerYValue;
if( pPosHelper->isSwapXAndY() )
// if datapoint value is 0 the label will appear RIGHT in case of Bar Chart
if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
rAlignment = LABEL_ALIGN_RIGHT;
else
rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
else
// if datapoint value is 0 the label will appear TOP in case of Column Chart
if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
rAlignment = LABEL_ALIGN_TOP;
else
......@@ -272,16 +274,31 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment(
{
fY = (fBaseValue < fScaledUpperYValue) ? fScaledLowerYValue : fScaledUpperYValue;
if( pPosHelper->isSwapXAndY() )
rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
// if datapoint value is 0 the label will appear RIGHT in case of Bar Chart
if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
rAlignment = LABEL_ALIGN_RIGHT;
else
rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT;
else
rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
// if datapoint value is 0 the label will appear TOP in case of Column Chart
if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
rAlignment = LABEL_ALIGN_TOP;
else
rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM;
if(m_nDimension==3)
fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth);
}
break;
case css::chart::DataLabelPlacement::CENTER:
fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0;
rAlignment = LABEL_ALIGN_CENTER;
// if datapoint value is 0 the label will appear TOP/RIGHT in case of Column/Bar Charts
if( fBaseValue == fScaledUpperYValue && fBaseValue == fScaledLowerYValue )
if( pPosHelper->isSwapXAndY() )
rAlignment = LABEL_ALIGN_RIGHT;
else
rAlignment = LABEL_ALIGN_TOP;
else
rAlignment = LABEL_ALIGN_CENTER;
if(m_nDimension==3)
fDepth = fabs(fScaledUpperBarDepth-fScaledLowerBarDepth)/2.0;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment