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

Related: tdf#48041 Chart: vertical value axis labels

Do not duplicate vertical axis labels and gridlines
if same value labels follow each other, because of
the number format and rounding.
Supplement of commit: 7f373a4c

Change-Id: I7a5d8196d4f16024c279fa4417a0c8809fb8aec7
Reviewed-on: https://gerrit.libreoffice.org/73432
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
üst d160bca0
......@@ -1554,33 +1554,32 @@ sal_Int32 VCartesianAxis::estimateMaximumAutoMainIncrementCount()
sal_Int32 nSingleNeeded = m_nMaximumTextHeightSoFar;
sal_Int32 nMaxSameLabel = 0;
//for horizontal axis:
if( (m_nDimensionIndex == 0 && !m_aAxisProperties.m_bSwapXAndY)
|| (m_nDimensionIndex == 1 && m_aAxisProperties.m_bSwapXAndY) )
// tdf#48041: do not duplicate the value labels because of rounding
if (m_aAxisProperties.m_nAxisType != css::chart2::AxisType::DATE)
{
if (m_aAxisProperties.m_nAxisType != css::chart2::AxisType::DATE)
FixedNumberFormatter aFixedNumberFormatterTest(m_xNumberFormatsSupplier, m_aAxisLabelProperties.nNumberFormatKey);
OUString sPreviousValueLabel;
sal_Int32 nSameLabel = 0;
for (sal_Int32 nLabel = 0; nLabel < static_cast<sal_Int32>(m_aAllTickInfos[0].size()); ++nLabel)
{
// tdf#48041: do not duplicate the value labels because of rounding
FixedNumberFormatter aFixedNumberFormatterTest(m_xNumberFormatsSupplier, m_aAxisLabelProperties.nNumberFormatKey);
OUString sPreviousValueLabel;
sal_Int32 nSameLabel = 0;
for (sal_Int32 nLabel = 0; nLabel < static_cast<sal_Int32>(m_aAllTickInfos[0].size()); ++nLabel)
Color nColor = COL_AUTO;
bool bHasColor = false;
OUString sValueLabel = aFixedNumberFormatterTest.getFormattedString(m_aAllTickInfos[0][nLabel].fScaledTickValue, nColor, bHasColor);
if (sValueLabel == sPreviousValueLabel)
{
Color nColor = COL_AUTO;
bool bHasColor = false;
OUString sValueLabel = aFixedNumberFormatterTest.getFormattedString(m_aAllTickInfos[0][nLabel].fScaledTickValue, nColor, bHasColor);
if (sValueLabel == sPreviousValueLabel)
{
nSameLabel++;
if (nSameLabel > nMaxSameLabel)
nMaxSameLabel = nSameLabel;
}
else
nSameLabel = 0;
sPreviousValueLabel = sValueLabel;
nSameLabel++;
if (nSameLabel > nMaxSameLabel)
nMaxSameLabel = nSameLabel;
}
else
nSameLabel = 0;
sPreviousValueLabel = sValueLabel;
}
}
//for horizontal axis:
if( (m_nDimensionIndex == 0 && !m_aAxisProperties.m_bSwapXAndY)
|| (m_nDimensionIndex == 1 && m_aAxisProperties.m_bSwapXAndY) )
{
nTotalAvailable = nMaxWidth;
nSingleNeeded = m_nMaximumTextWidthSoFar;
}
......
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