summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-12-07 21:14:50 -0500
committerAndras Timar <atimar@suse.com>2013-01-13 21:59:21 +0100
commit7e136d117b1e856350f44f6622223ff6d2aecb39 (patch)
treeeaea93f7e33bf8f74c716bc4e84ed284099e8c5b
parentf86c0ec7485a2f48e3e1901d7f5c99735344d956 (diff)
bnc#791952: Use "center" label placement for "Best fit" in pie charts.
It works better this way for Excel interoperability. In Excel, Best fit is slightly different than the center placement, but the two are pretty close in pie charts. Change-Id: I7f04a1babb04fd488d8cf90df247c294fa9d7b67
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 8d558f110fe7..e1ecf5b762c9 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -460,9 +460,15 @@ void PieChart::createShapes()
}
sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nPointIndex, m_xChartTypeModel, m_nDimension, m_pPosHelper->isSwapXAndY() );
+
+ // AVOID_OVERLAP is in fact "Best fit" in the UI.
bool bMovementAllowed = ( nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::AVOID_OVERLAP );
if( bMovementAllowed )
- nLabelPlacement = ::com::sun::star::chart::DataLabelPlacement::OUTSIDE;
+ // Use center for "Best fit" for now. In the future we
+ // may want to implement a real best fit algorithm.
+ // But center is good enough, and close to what Excel
+ // does.
+ nLabelPlacement = ::com::sun::star::chart::DataLabelPlacement::CENTER;
LabelAlignment eAlignment(LABEL_ALIGN_CENTER);
sal_Int32 nScreenValueOffsetInRadiusDirection = 0 ;