View | Details | Raw Unified | Return to issue 95934
Collapse All | Expand All

(-)chart2/source/model/template/ColumnChartType.cxx (-1 / +16 lines)
Lines 49-55 namespace Link Here
49
enum
49
enum
50
{
50
{
51
    PROP_BARCHARTTYPE_OVERLAP_SEQUENCE,
51
    PROP_BARCHARTTYPE_OVERLAP_SEQUENCE,
52
    PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE
52
    PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE,
53
    PROP_BARCHARTTYPE_STACKED,
54
    PROP_BARCHARTTYPE_PERCENT
53
};
55
};
54
56
55
void lcl_AddPropertiesToVector(
57
void lcl_AddPropertiesToVector(
Lines 68-73 void lcl_AddPropertiesToVector( Link Here
68
                  ::getCppuType( reinterpret_cast< const Sequence< sal_Int32 > * >(0)),
70
                  ::getCppuType( reinterpret_cast< const Sequence< sal_Int32 > * >(0)),
69
                  beans::PropertyAttribute::BOUND
71
                  beans::PropertyAttribute::BOUND
70
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
72
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
73
74
    rOutProperties.push_back(
75
        Property( C2U( "Stacked" ),
76
                  PROP_BARCHARTTYPE_STACKED,
77
                  ::getBooleanCppuType(),
78
                  beans::PropertyAttribute::BOUND
79
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
80
    rOutProperties.push_back(
81
        Property( C2U( "Percent" ),
82
                  PROP_BARCHARTTYPE_PERCENT,
83
                  ::getBooleanCppuType(),
84
                  beans::PropertyAttribute::BOUND
85
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
71
}
86
}
72
87
73
void lcl_AddDefaultsToMap(
88
void lcl_AddDefaultsToMap(
(-)chart2/source/model/template/LineChartType.cxx (-1 / +16 lines)
Lines 54-60 enum Link Here
54
{
54
{
55
    PROP_LINECHARTTYPE_CURVE_STYLE,
55
    PROP_LINECHARTTYPE_CURVE_STYLE,
56
    PROP_LINECHARTTYPE_CURVE_RESOLUTION,
56
    PROP_LINECHARTTYPE_CURVE_RESOLUTION,
57
    PROP_LINECHARTTYPE_SPLINE_ORDER
57
    PROP_LINECHARTTYPE_SPLINE_ORDER,
58
    PROP_LINECHARTTYPE_STACKED,
59
    PROP_LINECHARTTYPE_PERCENT
58
};
60
};
59
61
60
void lcl_AddPropertiesToVector(
62
void lcl_AddPropertiesToVector(
Lines 79-84 void lcl_AddPropertiesToVector( Link Here
79
                  ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
81
                  ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
80
                  beans::PropertyAttribute::BOUND
82
                  beans::PropertyAttribute::BOUND
81
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
83
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
84
85
    rOutProperties.push_back(
86
        Property( C2U( "Stacked" ),
87
                  PROP_LINECHARTTYPE_STACKED,
88
                  ::getBooleanCppuType(),
89
                  beans::PropertyAttribute::BOUND
90
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
91
    rOutProperties.push_back(
92
        Property( C2U( "Percent" ),
93
                  PROP_LINECHARTTYPE_PERCENT,
94
                  ::getBooleanCppuType(),
95
                  beans::PropertyAttribute::BOUND
96
                  | beans::PropertyAttribute::MAYBEDEFAULT ));
82
}
97
}
83
98
84
void lcl_AddDefaultsToMap(
99
void lcl_AddDefaultsToMap(
(-)chart2/source/view/axes/ScaleAutomatism.cxx (+16 lines)
Lines 132-138 void ScaleAutomatism::calculateExplicitScaleAndIncrement( Link Here
132
    if( bAutoMinimum )
132
    if( bAutoMinimum )
133
    {
133
    {
134
        if( m_aSourceScale.AxisType==AxisType::PERCENT )
134
        if( m_aSourceScale.AxisType==AxisType::PERCENT )
135
        {
135
            rExplicitScale.Minimum = 0.0;
136
            rExplicitScale.Minimum = 0.0;
137
            if (!::rtl::math::isNan(m_fValueMinimum))
138
            {
139
                double fMin = m_fValueMinimum / 100.0;
140
                if (rExplicitScale.Minimum > fMin)
141
                    rExplicitScale.Minimum = fMin;
142
            }
143
        }
136
        else if( ::rtl::math::isNan( m_fValueMinimum ) )
144
        else if( ::rtl::math::isNan( m_fValueMinimum ) )
137
            rExplicitScale.Minimum = 0.0;   //@todo get Minimum from scaling or from plotter????
145
            rExplicitScale.Minimum = 0.0;   //@todo get Minimum from scaling or from plotter????
138
        else
146
        else
Lines 143-149 void ScaleAutomatism::calculateExplicitScaleAndIncrement( Link Here
143
    if( bAutoMaximum )
151
    if( bAutoMaximum )
144
    {
152
    {
145
        if( m_aSourceScale.AxisType==AxisType::PERCENT )
153
        if( m_aSourceScale.AxisType==AxisType::PERCENT )
154
        {
146
            rExplicitScale.Maximum = 1.0;
155
            rExplicitScale.Maximum = 1.0;
156
            if (!::rtl::math::isNan(m_fValueMaximum))
157
            {
158
                double fMax = m_fValueMaximum / 100.0;
159
                if (rExplicitScale.Maximum < fMax)
160
                    rExplicitScale.Maximum = fMax;
161
            }
162
        }
147
        else if( ::rtl::math::isNan( m_fValueMaximum ) )
163
        else if( ::rtl::math::isNan( m_fValueMaximum ) )
148
            rExplicitScale.Maximum = 10.0;  //@todo get Maximum from scaling or from plotter????
164
            rExplicitScale.Maximum = 10.0;  //@todo get Maximum from scaling or from plotter????
149
        else
165
        else
(-)chart2/source/view/charttypes/AreaChart.cxx (-2 / +28 lines)
Lines 598-603 struct FormerPoint Link Here
598
598
599
void AreaChart::createShapes()
599
void AreaChart::createShapes()
600
{
600
{
601
    sal_Bool bPercent = sal_False;
602
    uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
603
    if (xPropSet.is())
604
        xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
605
601
    if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
606
    if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
602
        return;
607
        return;
603
608
Lines 734-742 void AreaChart::createShapes() Link Here
734
                    if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
739
                    if( m_nDimension==3 && m_bArea && pSeriesList->size()!=1 )
735
                        fLogicY = fabs( fLogicY );
740
                        fLogicY = fabs( fLogicY );
736
741
737
                    if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
742
                    if (bPercent)
743
                    {     
744
                        // This data series is percent-stacked.
745
746
                        if (::rtl::math::approxEqual(aLogicYSumMap[nAttachedAxisIndex], 0.0))
747
                            fLogicY = 0.0;
748
                        else
749
                            fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
750
751
                        if (!pPosHelper->isPercentY())
752
                        {    
753
                            // When the axis itself is not percent-stacked,
754
                            // their internal range value is 0 - 100.  So we
755
                            // need to adjust the data point values
756
                            // accordingly.
757
                            fLogicY *= 100.0;
758
                        }
759
                    }
760
                    else if (pPosHelper->isPercentY())
738
                    {
761
                    {
739
                        fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
762
                        // The data series is not percent-stacked, but the
763
                        // axis itself is.  In this case, the axis' internal
764
                        // range is 0 to 1.  Adjust the data point values.
765
                        fLogicY /= 100.0;
740
                    }
766
                    }
741
767
742
                    if(    ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
768
                    if(    ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
(-)chart2/source/view/charttypes/BarChart.cxx (+5 lines)
Lines 454-459 void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis() Link Here
454
454
455
void BarChart::createShapes()
455
void BarChart::createShapes()
456
{
456
{
457
    uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
458
    sal_Bool bPercent = sal_False;
459
    if (xPropSet.is())
460
        xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
461
457
    if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
462
    if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
458
        return;
463
        return;
459
464
(-)chart2/source/view/charttypes/VSeriesPlotter.cxx (+18 lines)
Lines 1154-1159 double VSeriesPlotter::getMaximumX() Link Here
1154
1154
1155
double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
1155
double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
1156
{
1156
{
1157
    sal_Bool bPercent = sal_False;
1158
    uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
1159
    if (xPropSet.is())
1160
        xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
1161
1162
    if (bPercent)
1163
        // This plotter is percent-stacked.
1164
        return 0.0;
1165
1157
    if( !m_bCategoryXAxis )
1166
    if( !m_bCategoryXAxis )
1158
    {
1167
    {
1159
        double fMinY, fMaxY;
1168
        double fMinY, fMaxY;
Lines 1188-1193 double VSeriesPlotter::getMinimumYInRange( double fMinimumX, double fMaximumX, s Link Here
1188
1197
1189
double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
1198
double VSeriesPlotter::getMaximumYInRange( double fMinimumX, double fMaximumX, sal_Int32 nAxisIndex )
1190
{
1199
{
1200
    sal_Bool bPercent = sal_False;
1201
    uno::Reference< beans::XPropertySet > xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
1202
    if (xPropSet.is())
1203
        xPropSet->getPropertyValue(C2U("Percent")) >>= bPercent;
1204
1205
    if (bPercent)
1206
        // This plotter is percent-stacked.
1207
        return 100.0;
1208
1191
    if( !m_bCategoryXAxis )
1209
    if( !m_bCategoryXAxis )
1192
    {
1210
    {
1193
        double fMinY, fMaxY;
1211
        double fMinY, fMaxY;
(-)chart2/source/view/main/ChartView.cxx (-1 / +9 lines)
Lines 1448-1454 sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( Link Here
1448
                    if( nDimensionIndex == 0 )
1448
                    if( nDimensionIndex == 0 )
1449
                        aRoleToMatch = C2U("values-x");
1449
                        aRoleToMatch = C2U("values-x");
1450
                    Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
1450
                    Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
1451
                    for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
1451
                    sal_Int32 nCTCount = aChartTypes.getLength();
1452
                    if (nCTCount > 0)
1453
                        // When multiple chart types share the same axis, always 
1454
                        // use the first chart type for automatic detection of
1455
                        // desired number format.  This is in line with the
1456
                        // fact that the axis type is also determined from the
1457
                        // first chart type alone.
1458
                        nCTCount = 1;
1459
                    for( sal_Int32 nCTIdx=0; nCTIdx<nCTCount; ++nCTIdx )
1452
                    {
1460
                    {
1453
                        if( nDimensionIndex != 0 )
1461
                        if( nDimensionIndex != 0 )
1454
                            aRoleToMatch = aChartTypes[nCTIdx]->getRoleOfSequenceForSeriesLabel();
1462
                            aRoleToMatch = aChartTypes[nCTIdx]->getRoleOfSequenceForSeriesLabel();

Return to issue 95934