diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-17 04:53:22 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-05-17 06:48:24 +0200 |
commit | 8ad59d194491af8317b3770e83d93d2e32508947 (patch) | |
tree | 131e835c4834544a1698b355007081dddf0e3f69 /sc/source/core/data | |
parent | a5f65a5c2836b000bc0b6f92d5a2a3d13133de71 (diff) |
more databar length bugs fixed
Change-Id: I921e6dbbf62c3bd5c3c8552161ba6f5d25a0185b
Diffstat (limited to 'sc/source/core/data')
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 4652587a1641..cf55990a2a6e 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -912,13 +912,15 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const else pInfo->mnZero = 0; + double nMinNonNegative = std::max(0.0, nMin); + double nMaxNonPositive = std::min(0.0, nMax); //calculate the length if(nValue < 0 && nMin < 0) { if (nValue < nMin) pInfo->mnLength = -100; else - pInfo->mnLength = -100 * (nValue-nMax)/(nMin-nMax); + pInfo->mnLength = -100 * (nValue-nMaxNonPositive)/(nMin-nMaxNonPositive); } else { @@ -927,7 +929,7 @@ ScDataBarInfo* ScDataBarFormat::GetDataBarInfo(const ScAddress& rAddr) const else if (nValue <= nMin) pInfo->mnLength = 0; else - pInfo->mnLength = 100 * (nValue-nMin)/(nMax-nMin); + pInfo->mnLength = 100 * (nValue-nMinNonNegative)/(nMax-nMinNonNegative); } } else if( mpFormatData->meAxisPosition == databar::MIDDLE) |