Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "AreaChart.hxx"
21 : #include "PlottingPositionHelper.hxx"
22 : #include "ShapeFactory.hxx"
23 : #include "CommonConverters.hxx"
24 : #include "macros.hxx"
25 : #include "ViewDefines.hxx"
26 : #include "ObjectIdentifier.hxx"
27 : #include "Splines.hxx"
28 : #include "ChartTypeHelper.hxx"
29 : #include "LabelPositionHelper.hxx"
30 : #include "Clipping.hxx"
31 : #include "Stripe.hxx"
32 : #include "PolarLabelPositionHelper.hxx"
33 : #include "DateHelper.hxx"
34 :
35 : #include <com/sun/star/chart2/Symbol.hpp>
36 : #include <com/sun/star/chart/DataLabelPlacement.hpp>
37 : #include <com/sun/star/chart/MissingValueTreatment.hpp>
38 :
39 : #include <editeng/unoprnms.hxx>
40 : #include <rtl/math.hxx>
41 :
42 : #include <com/sun/star/drawing/DoubleSequence.hpp>
43 : #include <com/sun/star/drawing/NormalsKind.hpp>
44 : #include <com/sun/star/lang/XServiceName.hpp>
45 :
46 : //.............................................................................
47 : namespace chart
48 : {
49 : //.............................................................................
50 : using namespace ::com::sun::star;
51 : using namespace ::rtl::math;
52 : using namespace ::com::sun::star::chart2;
53 :
54 : //-----------------------------------------------------------------------------
55 : //-----------------------------------------------------------------------------
56 : //-----------------------------------------------------------------------------
57 :
58 0 : AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
59 : , sal_Int32 nDimensionCount
60 : , bool bCategoryXAxis
61 : , bool bNoArea
62 : , PlottingPositionHelper* pPlottingPositionHelper
63 : , bool bConnectLastToFirstPoint
64 : , bool bExpandIfValuesCloseToBorder
65 : , sal_Int32 nKeepAspectRatio
66 : , const drawing::Direction3D& rAspectRatio
67 : )
68 : : VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
69 : , m_pMainPosHelper(pPlottingPositionHelper)
70 0 : , m_bArea(!bNoArea)
71 : , m_bLine(bNoArea)
72 0 : , m_bSymbol( ChartTypeHelper::isSupportingSymbolProperties(xChartTypeModel,nDimensionCount) )
73 : , m_bIsPolarCooSys( bConnectLastToFirstPoint )
74 : , m_bConnectLastToFirstPoint( bConnectLastToFirstPoint )
75 : , m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder )
76 : , m_nKeepAspectRatio(nKeepAspectRatio)
77 : , m_aGivenAspectRatio(rAspectRatio)
78 : , m_eCurveStyle(CurveStyle_LINES)
79 : , m_nCurveResolution(20)
80 : , m_nSplineOrder(3)
81 : , m_xSeriesTarget(0)
82 : , m_xErrorBarTarget(0)
83 : , m_xTextTarget(0)
84 0 : , m_xRegressionCurveEquationTarget(0)
85 : {
86 0 : if( !m_pMainPosHelper )
87 0 : m_pMainPosHelper = new PlottingPositionHelper();
88 0 : if( m_pMainPosHelper )
89 : {
90 0 : m_pMainPosHelper->AllowShiftXAxisPos(true);
91 0 : m_pMainPosHelper->AllowShiftZAxisPos(true);
92 : }
93 0 : PlotterBase::m_pPosHelper = m_pMainPosHelper;
94 0 : VSeriesPlotter::m_pMainPosHelper = m_pMainPosHelper;
95 :
96 : try
97 : {
98 0 : if( m_xChartTypeModelProps.is() )
99 : {
100 0 : m_xChartTypeModelProps->getPropertyValue( C2U( "CurveStyle" ) ) >>= m_eCurveStyle;
101 0 : m_xChartTypeModelProps->getPropertyValue( C2U( "CurveResolution" ) ) >>= m_nCurveResolution;
102 0 : m_xChartTypeModelProps->getPropertyValue( C2U( "SplineOrder" ) ) >>= m_nSplineOrder;
103 : }
104 : }
105 0 : catch( uno::Exception& e )
106 : {
107 : //the above properties are not supported by all charttypes supported by this class (e.g. area or net chart)
108 : //in that cases this exception is ok
109 0 : e.Context.is();//to have debug information without compilation warnings
110 : }
111 0 : }
112 :
113 0 : AreaChart::~AreaChart()
114 : {
115 0 : delete m_pMainPosHelper;
116 0 : }
117 :
118 0 : double AreaChart::getMaximumX()
119 : {
120 0 : double fMax = VSeriesPlotter::getMaximumX();
121 0 : if( m_bCategoryXAxis && m_bIsPolarCooSys )//the angle axis in net charts needs a different autoscaling
122 0 : fMax += 1.0;
123 0 : return fMax;
124 : }
125 :
126 0 : bool AreaChart::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
127 : {
128 : return m_bExpandIfValuesCloseToBorder &&
129 0 : VSeriesPlotter::isExpandIfValuesCloseToBorder( nDimensionIndex );
130 : }
131 :
132 0 : bool AreaChart::isSeperateStackingForDifferentSigns( sal_Int32 /*nDimensionIndex*/ )
133 : {
134 : // no separate stacking in all types of line/area charts
135 0 : return false;
136 : }
137 :
138 : //-----------------------------------------------------------------
139 :
140 0 : LegendSymbolStyle AreaChart::getLegendSymbolStyle()
141 : {
142 0 : if( m_bArea || m_nDimension == 3 )
143 0 : return LegendSymbolStyle_BOX;
144 0 : return LegendSymbolStyle_LINE;
145 : }
146 :
147 0 : uno::Any AreaChart::getExplicitSymbol( const VDataSeries& rSeries, sal_Int32 nPointIndex )
148 : {
149 0 : uno::Any aRet;
150 :
151 0 : Symbol* pSymbolProperties = rSeries.getSymbolProperties( nPointIndex );
152 0 : if( pSymbolProperties )
153 : {
154 0 : aRet = uno::makeAny(*pSymbolProperties);
155 : }
156 :
157 0 : return aRet;
158 : }
159 :
160 0 : drawing::Direction3D AreaChart::getPreferredDiagramAspectRatio() const
161 : {
162 0 : if( m_nKeepAspectRatio == 1 )
163 0 : return m_aGivenAspectRatio;
164 0 : drawing::Direction3D aRet(1,-1,1);
165 0 : if( m_nDimension == 2 )
166 0 : aRet = drawing::Direction3D(-1,-1,-1);
167 : else
168 : {
169 0 : drawing::Direction3D aScale( m_pPosHelper->getScaledLogicWidth() );
170 0 : aRet.DirectionZ = aScale.DirectionZ*0.2;
171 0 : if(aRet.DirectionZ>1.0)
172 0 : aRet.DirectionZ=1.0;
173 0 : if(aRet.DirectionZ>10)
174 0 : aRet.DirectionZ=10;
175 : }
176 0 : return aRet;
177 : }
178 :
179 0 : bool AreaChart::keepAspectRatio() const
180 : {
181 0 : if( m_nKeepAspectRatio == 0 )
182 0 : return false;
183 0 : if( m_nKeepAspectRatio == 1 )
184 0 : return true;
185 0 : if( m_nDimension == 2 )
186 : {
187 0 : if( !m_bSymbol )
188 0 : return false;
189 : }
190 0 : return true;
191 : }
192 :
193 0 : void AreaChart::addSeries( VDataSeries* pSeries, sal_Int32 zSlot, sal_Int32 xSlot, sal_Int32 ySlot )
194 : {
195 0 : if( m_bArea && !m_bIsPolarCooSys && pSeries )
196 : {
197 0 : sal_Int32 nMissingValueTreatment = pSeries->getMissingValueTreatment();
198 0 : if( nMissingValueTreatment == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
199 0 : pSeries->setMissingValueTreatment( ::com::sun::star::chart::MissingValueTreatment::USE_ZERO );
200 : }
201 0 : if( m_nDimension == 3 && !m_bCategoryXAxis )
202 : {
203 : //3D xy always deep
204 : OSL_ENSURE( zSlot==-1,"3D xy charts should be deep stacked in model also" );
205 0 : zSlot=-1;
206 0 : xSlot=0;
207 0 : ySlot=0;
208 : }
209 0 : VSeriesPlotter::addSeries( pSeries, zSlot, xSlot, ySlot );
210 0 : }
211 :
212 0 : void lcl_removeDuplicatePoints( drawing::PolyPolygonShape3D& rPolyPoly, PlottingPositionHelper& rPosHelper )
213 : {
214 0 : sal_Int32 nPolyCount = rPolyPoly.SequenceX.getLength();
215 0 : if(!nPolyCount)
216 0 : return;
217 :
218 0 : drawing::PolyPolygonShape3D aTmp;
219 0 : aTmp.SequenceX.realloc(nPolyCount);
220 0 : aTmp.SequenceY.realloc(nPolyCount);
221 0 : aTmp.SequenceZ.realloc(nPolyCount);
222 :
223 0 : for( sal_Int32 nPolygonIndex = 0; nPolygonIndex<nPolyCount; nPolygonIndex++ )
224 : {
225 0 : drawing::DoubleSequence* pOuterSourceX = &rPolyPoly.SequenceX.getArray()[nPolygonIndex];
226 0 : drawing::DoubleSequence* pOuterSourceY = &rPolyPoly.SequenceY.getArray()[nPolygonIndex];
227 0 : drawing::DoubleSequence* pOuterSourceZ = &rPolyPoly.SequenceZ.getArray()[nPolygonIndex];
228 :
229 0 : drawing::DoubleSequence* pOuterTargetX = &aTmp.SequenceX.getArray()[nPolygonIndex];
230 0 : drawing::DoubleSequence* pOuterTargetY = &aTmp.SequenceY.getArray()[nPolygonIndex];
231 0 : drawing::DoubleSequence* pOuterTargetZ = &aTmp.SequenceZ.getArray()[nPolygonIndex];
232 :
233 0 : sal_Int32 nPointCount = pOuterSourceX->getLength();
234 0 : if( !nPointCount )
235 0 : continue;
236 :
237 0 : pOuterTargetX->realloc(nPointCount);
238 0 : pOuterTargetY->realloc(nPointCount);
239 0 : pOuterTargetZ->realloc(nPointCount);
240 :
241 0 : double* pSourceX = pOuterSourceX->getArray();
242 0 : double* pSourceY = pOuterSourceY->getArray();
243 0 : double* pSourceZ = pOuterSourceZ->getArray();
244 :
245 0 : double* pTargetX = pOuterTargetX->getArray();
246 0 : double* pTargetY = pOuterTargetY->getArray();
247 0 : double* pTargetZ = pOuterTargetZ->getArray();
248 :
249 : //copy first point
250 0 : *pTargetX=*pSourceX++;
251 0 : *pTargetY=*pSourceY++;
252 0 : *pTargetZ=*pSourceZ++;
253 0 : sal_Int32 nTargetPointCount=1;
254 :
255 0 : for( sal_Int32 nSource=1; nSource<nPointCount; nSource++ )
256 : {
257 0 : if( !rPosHelper.isSameForGivenResolution( *pTargetX, *pTargetY, *pTargetZ
258 0 : , *pSourceX, *pSourceY, *pSourceZ ) )
259 : {
260 0 : pTargetX++; pTargetY++; pTargetZ++;
261 0 : *pTargetX=*pSourceX;
262 0 : *pTargetY=*pSourceY;
263 0 : *pTargetZ=*pSourceZ;
264 0 : nTargetPointCount++;
265 : }
266 0 : pSourceX++; pSourceY++; pSourceZ++;
267 : }
268 :
269 : //free unused space
270 0 : if( nTargetPointCount<nPointCount )
271 : {
272 0 : pOuterTargetX->realloc(nTargetPointCount);
273 0 : pOuterTargetY->realloc(nTargetPointCount);
274 0 : pOuterTargetZ->realloc(nTargetPointCount);
275 : }
276 :
277 0 : pOuterSourceX->realloc(0);
278 0 : pOuterSourceY->realloc(0);
279 0 : pOuterSourceZ->realloc(0);
280 : }
281 :
282 : //free space
283 0 : rPolyPoly.SequenceX.realloc(nPolyCount);
284 0 : rPolyPoly.SequenceY.realloc(nPolyCount);
285 0 : rPolyPoly.SequenceZ.realloc(nPolyCount);
286 :
287 0 : rPolyPoly=aTmp;
288 : }
289 :
290 0 : bool AreaChart::impl_createLine( VDataSeries* pSeries
291 : , drawing::PolyPolygonShape3D* pSeriesPoly
292 : , PlottingPositionHelper* pPosHelper )
293 : {
294 : //return true if a line was created successfully
295 0 : uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
296 :
297 0 : drawing::PolyPolygonShape3D aPoly;
298 0 : if(CurveStyle_CUBIC_SPLINES==m_eCurveStyle)
299 : {
300 0 : drawing::PolyPolygonShape3D aSplinePoly;
301 0 : SplineCalculater::CalculateCubicSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution );
302 0 : lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
303 0 : Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
304 : }
305 0 : else if(CurveStyle_B_SPLINES==m_eCurveStyle)
306 : {
307 0 : drawing::PolyPolygonShape3D aSplinePoly;
308 0 : SplineCalculater::CalculateBSplines( *pSeriesPoly, aSplinePoly, m_nCurveResolution, m_nSplineOrder );
309 0 : lcl_removeDuplicatePoints( aSplinePoly, *pPosHelper );
310 0 : Clipping::clipPolygonAtRectangle( aSplinePoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
311 : }
312 : else
313 : {
314 0 : bool bIsClipped = false;
315 0 : if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
316 : {
317 : // do NOT connect last and first point, if one is NAN, and NAN handling is NAN_AS_GAP
318 0 : double fFirstY = pSeries->getYValue( 0 );
319 0 : double fLastY = pSeries->getYValue( VSeriesPlotter::getPointCount() - 1 );
320 0 : if( (pSeries->getMissingValueTreatment() != ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP)
321 0 : || (::rtl::math::isFinite( fFirstY ) && ::rtl::math::isFinite( fLastY )) )
322 : {
323 : // connect last point in last polygon with first point in first polygon
324 0 : ::basegfx::B2DRectangle aScaledLogicClipDoubleRect( pPosHelper->getScaledLogicClipDoubleRect() );
325 0 : drawing::PolyPolygonShape3D aTmpPoly(*pSeriesPoly);
326 0 : drawing::Position3D aLast(aScaledLogicClipDoubleRect.getMaxX(),aTmpPoly.SequenceY[0][0],aTmpPoly.SequenceZ[0][0]);
327 : // add connector line to last polygon
328 0 : AddPointToPoly( aTmpPoly, aLast, pSeriesPoly->SequenceX.getLength() - 1 );
329 0 : Clipping::clipPolygonAtRectangle( aTmpPoly, aScaledLogicClipDoubleRect, aPoly );
330 0 : bIsClipped = true;
331 : }
332 : }
333 :
334 0 : if( !bIsClipped )
335 0 : Clipping::clipPolygonAtRectangle( *pSeriesPoly, pPosHelper->getScaledLogicClipDoubleRect(), aPoly );
336 : }
337 :
338 0 : if(!ShapeFactory::hasPolygonAnyLines(aPoly))
339 0 : return false;
340 :
341 : //transformation 3) -> 4)
342 0 : pPosHelper->transformScaledLogicToScene( aPoly );
343 :
344 : //create line:
345 0 : uno::Reference< drawing::XShape > xShape(NULL);
346 0 : if(m_nDimension==3)
347 : {
348 0 : double fDepth = this->getTransformedDepth();
349 0 : sal_Int32 nPolyCount = aPoly.SequenceX.getLength();
350 0 : for(sal_Int32 nPoly=0;nPoly<nPolyCount;nPoly++)
351 : {
352 0 : sal_Int32 nPointCount = aPoly.SequenceX[nPoly].getLength();
353 0 : for(sal_Int32 nPoint=0;nPoint<nPointCount-1;nPoint++)
354 : {
355 0 : drawing::Position3D aPoint1, aPoint2;
356 0 : aPoint1.PositionX = aPoly.SequenceX[nPoly][nPoint+1];
357 0 : aPoint1.PositionY = aPoly.SequenceY[nPoly][nPoint+1];
358 0 : aPoint1.PositionZ = aPoly.SequenceZ[nPoly][nPoint+1];
359 :
360 0 : aPoint2.PositionX = aPoly.SequenceX[nPoly][nPoint];
361 0 : aPoint2.PositionY = aPoly.SequenceY[nPoly][nPoint];
362 0 : aPoint2.PositionZ = aPoly.SequenceZ[nPoly][nPoint];
363 :
364 0 : Stripe aStripe( aPoint1, aPoint2, fDepth );
365 :
366 : m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
367 : , Stripe( aPoint1, aPoint2, fDepth )
368 0 : , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
369 : }
370 : }
371 : }
372 : else //m_nDimension!=3
373 : {
374 : xShape = m_pShapeFactory->createLine2D( xSeriesGroupShape_Shapes
375 0 : , PolyToPointSequence( aPoly ) );
376 : this->setMappedProperties( xShape
377 : , pSeries->getPropertiesOfSeries()
378 0 : , PropertyMapper::getPropertyNameMapForLineSeriesProperties() );
379 : //because of this name this line will be used for marking
380 0 : m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
381 : }
382 0 : return true;
383 : }
384 :
385 0 : bool AreaChart::impl_createArea( VDataSeries* pSeries
386 : , drawing::PolyPolygonShape3D* pSeriesPoly
387 : , drawing::PolyPolygonShape3D* pPreviousSeriesPoly
388 : , PlottingPositionHelper* pPosHelper )
389 : {
390 : //return true if an area was created successfully
391 :
392 0 : uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeBackChild(pSeries, m_xSeriesTarget);
393 0 : double zValue = pSeries->m_fLogicZPos;
394 :
395 0 : drawing::PolyPolygonShape3D aPoly( *pSeriesPoly );
396 : //add second part to the polygon (grounding points or previous series points)
397 0 : if( m_bConnectLastToFirstPoint && !ShapeFactory::isPolygonEmptyOrSinglePoint(*pSeriesPoly) )
398 : {
399 0 : if( pPreviousSeriesPoly )
400 0 : addPolygon( aPoly, *pPreviousSeriesPoly );
401 : }
402 0 : else if(!pPreviousSeriesPoly)
403 : {
404 0 : double fMinX = pSeries->m_fLogicMinX;
405 0 : double fMaxX = pSeries->m_fLogicMaxX;
406 0 : double fY = pPosHelper->getBaseValueY();//logic grounding
407 0 : if( m_nDimension==3 )
408 0 : fY = pPosHelper->getLogicMinY();
409 :
410 : //clip to scale
411 0 : if(fMaxX<pPosHelper->getLogicMinX() || fMinX>pPosHelper->getLogicMaxX())
412 0 : return false;//no visible shape needed
413 0 : pPosHelper->clipLogicValues( &fMinX, &fY, 0 );
414 0 : pPosHelper->clipLogicValues( &fMaxX, 0, 0 );
415 :
416 : //apply scaling
417 : {
418 0 : pPosHelper->doLogicScaling( &fMinX, &fY, &zValue );
419 0 : pPosHelper->doLogicScaling( &fMaxX, 0, 0 );
420 : }
421 :
422 0 : AddPointToPoly( aPoly, drawing::Position3D( fMaxX,fY,zValue) );
423 0 : AddPointToPoly( aPoly, drawing::Position3D( fMinX,fY,zValue) );
424 : }
425 : else
426 : {
427 0 : appendPoly( aPoly, *pPreviousSeriesPoly );
428 : }
429 0 : ShapeFactory::closePolygon(aPoly);
430 :
431 : //apply clipping
432 : {
433 0 : drawing::PolyPolygonShape3D aClippedPoly;
434 0 : Clipping::clipPolygonAtRectangle( aPoly, pPosHelper->getScaledLogicClipDoubleRect(), aClippedPoly, false );
435 0 : ShapeFactory::closePolygon(aClippedPoly); //again necessary after clipping
436 0 : aPoly = aClippedPoly;
437 : }
438 :
439 0 : if(!ShapeFactory::hasPolygonAnyLines(aPoly))
440 0 : return false;
441 :
442 : //transformation 3) -> 4)
443 0 : pPosHelper->transformScaledLogicToScene( aPoly );
444 :
445 : //create area:
446 0 : uno::Reference< drawing::XShape > xShape(NULL);
447 0 : if(m_nDimension==3)
448 : {
449 : xShape = m_pShapeFactory->createArea3D( xSeriesGroupShape_Shapes
450 0 : , aPoly, this->getTransformedDepth() );
451 : }
452 : else //m_nDimension!=3
453 : {
454 : xShape = m_pShapeFactory->createArea2D( xSeriesGroupShape_Shapes
455 0 : , aPoly );
456 : }
457 : this->setMappedProperties( xShape
458 : , pSeries->getPropertiesOfSeries()
459 0 : , PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
460 : //because of this name this line will be used for marking
461 0 : m_pShapeFactory->setShapeName( xShape, C2U("MarkHandles") );
462 0 : return true;
463 : }
464 :
465 0 : void AreaChart::impl_createSeriesShapes()
466 : {
467 : //the polygon shapes for each series need to be created before
468 :
469 : //iterate through all series again to create the series shapes
470 0 : ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
471 0 : const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
472 : //=============================================================================
473 0 : for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
474 : {
475 0 : ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
476 0 : const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
477 :
478 : //=============================================================================
479 0 : for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
480 : {
481 0 : ::std::vector< VDataSeries* >* pSeriesList = &(aXSlotIter->m_aSeriesVector);
482 :
483 0 : ::std::vector< VDataSeries* >::const_iterator aSeriesIter = pSeriesList->begin();
484 0 : const ::std::vector< VDataSeries* >::const_iterator aSeriesEnd = pSeriesList->end();
485 : //=============================================================================
486 :
487 0 : std::map< sal_Int32, drawing::PolyPolygonShape3D* > aPreviousSeriesPolyMap;//a PreviousSeriesPoly for each different nAttachedAxisIndex
488 0 : drawing::PolyPolygonShape3D* pSeriesPoly = NULL;
489 :
490 : //iterate through all series
491 0 : for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
492 : {
493 0 : sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
494 0 : PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
495 0 : if(!pPosHelper)
496 0 : pPosHelper = m_pMainPosHelper;
497 0 : PlotterBase::m_pPosHelper = pPosHelper;
498 :
499 0 : createRegressionCurvesShapes( **aSeriesIter, m_xErrorBarTarget, m_xRegressionCurveEquationTarget,
500 0 : m_pPosHelper->maySkipPointsInRegressionCalculation());
501 :
502 0 : pSeriesPoly = &(*aSeriesIter)->m_aPolyPolygonShape3D;
503 0 : if( m_bArea )
504 : {
505 0 : if( !impl_createArea( *aSeriesIter, pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) )
506 0 : continue;
507 : }
508 0 : if( m_bLine )
509 : {
510 0 : if( !impl_createLine( *aSeriesIter, pSeriesPoly, pPosHelper ) )
511 0 : continue;
512 : }
513 0 : aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly;
514 : }//next series in x slot (next y slot)
515 0 : }//next x slot
516 : }//next z slot
517 0 : }
518 :
519 : namespace
520 : {
521 :
522 0 : void lcl_reorderSeries( ::std::vector< ::std::vector< VDataSeriesGroup > >& rZSlots )
523 : {
524 0 : ::std::vector< ::std::vector< VDataSeriesGroup > > aRet( rZSlots.size() );
525 :
526 0 : ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZIt( rZSlots.rbegin() );
527 0 : ::std::vector< ::std::vector< VDataSeriesGroup > >::reverse_iterator aZEnd( rZSlots.rend() );
528 0 : for( ; aZIt != aZEnd; ++aZIt )
529 : {
530 0 : ::std::vector< VDataSeriesGroup > aXSlot( aZIt->size() );
531 :
532 0 : ::std::vector< VDataSeriesGroup >::reverse_iterator aXIt( aZIt->rbegin() );
533 0 : ::std::vector< VDataSeriesGroup >::reverse_iterator aXEnd( aZIt->rend() );
534 0 : for( ; aXIt != aXEnd; ++aXIt )
535 0 : aXSlot.push_back(*aXIt);
536 :
537 0 : aRet.push_back(aXSlot);
538 0 : }
539 :
540 0 : rZSlots.clear();
541 0 : rZSlots = aRet;
542 0 : }
543 :
544 : }//anonymous namespace
545 :
546 : //better performance for big data
547 : struct FormerPoint
548 : {
549 0 : FormerPoint( double fX, double fY, double fZ )
550 0 : : m_fX(fX), m_fY(fY), m_fZ(fZ)
551 0 : {}
552 0 : FormerPoint()
553 : {
554 0 : ::rtl::math::setNan( &m_fX );
555 0 : ::rtl::math::setNan( &m_fY );
556 0 : ::rtl::math::setNan( &m_fZ );
557 0 : }
558 :
559 : double m_fX;
560 : double m_fY;
561 : double m_fZ;
562 : };
563 :
564 0 : void AreaChart::createShapes()
565 : {
566 0 : if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
567 : return;
568 :
569 0 : if( m_nDimension == 2 && ( m_bArea || !m_bCategoryXAxis ) )
570 0 : lcl_reorderSeries( m_aZSlots );
571 :
572 : OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"AreaChart is not proper initialized");
573 0 : if(!(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is()))
574 : return;
575 :
576 : //the text labels should be always on top of the other series shapes
577 : //for area chart the error bars should be always on top of the other series shapes
578 :
579 : //therefore create an own group for the texts and the error bars to move them to front
580 : //(because the text group is created after the series group the texts are displayed on top)
581 0 : m_xSeriesTarget = createGroupShape( m_xLogicTarget,rtl::OUString() );
582 0 : if( m_bArea )
583 0 : m_xErrorBarTarget = createGroupShape( m_xLogicTarget,rtl::OUString() );
584 : else
585 0 : m_xErrorBarTarget = m_xSeriesTarget;
586 0 : m_xTextTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() );
587 0 : m_xRegressionCurveEquationTarget = m_pShapeFactory->createGroup2D( m_xFinalTarget,rtl::OUString() );
588 :
589 : //---------------------------------------------
590 : //check necessary here that different Y axis can not be stacked in the same group? ... hm?
591 :
592 : //update/create information for current group
593 0 : double fLogicZ = 1.0;//as defined
594 :
595 0 : sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
596 0 : sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
597 0 : if(nEndIndex<=0)
598 0 : nEndIndex=1;
599 :
600 : //better performance for big data
601 0 : std::map< VDataSeries*, FormerPoint > aSeriesFormerPointMap;
602 0 : m_bPointsWereSkipped = false;
603 0 : sal_Int32 nSkippedPoints = 0;
604 0 : sal_Int32 nCreatedPoints = 0;
605 : //
606 :
607 0 : bool bDateCategory = (m_pExplicitCategoriesProvider && m_pExplicitCategoriesProvider->isDateAxis());
608 :
609 : //=============================================================================
610 : //iterate through all x values per indices
611 0 : for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
612 : {
613 0 : ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
614 0 : const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
615 :
616 0 : std::map< sal_Int32, double > aLogicYSumMap;//one for each different nAttachedAxisIndex
617 0 : for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
618 : {
619 0 : ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
620 0 : const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
621 :
622 : //iterate through all x slots in this category to get 100percent sum
623 0 : for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
624 : {
625 0 : std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
626 0 : std::vector<VDataSeries*>::iterator aSeriesIter = rSeriesList.begin();
627 0 : const std::vector<VDataSeries*>::iterator aSeriesEnd = rSeriesList.end();
628 :
629 0 : for( ; aSeriesIter != aSeriesEnd; ++aSeriesIter )
630 : {
631 0 : VDataSeries* pSeries( *aSeriesIter );
632 0 : if(!pSeries)
633 0 : continue;
634 :
635 0 : if (bDateCategory)
636 0 : pSeries->doSortByXValues();
637 :
638 0 : sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
639 0 : if( aLogicYSumMap.find(nAttachedAxisIndex)==aLogicYSumMap.end() )
640 0 : aLogicYSumMap[nAttachedAxisIndex]=0.0;
641 :
642 0 : PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
643 0 : if(!pPosHelper)
644 0 : pPosHelper = m_pMainPosHelper;
645 0 : PlotterBase::m_pPosHelper = pPosHelper;
646 :
647 0 : double fAdd = pSeries->getYValue( nIndex );
648 0 : if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
649 0 : aLogicYSumMap[nAttachedAxisIndex] += fabs( fAdd );
650 : }
651 : }
652 : }
653 :
654 : //=============================================================================
655 0 : aZSlotIter = m_aZSlots.begin();
656 0 : for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, ++nZ )
657 : {
658 0 : ::std::vector< VDataSeriesGroup >::iterator aXSlotIter = aZSlotIter->begin();
659 0 : const ::std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
660 :
661 : //for the area chart there should be at most one x slot (no side by side stacking available)
662 : //attention different: xSlots are always interpreted as independent areas one behind the other: @todo this doesn't work why not???
663 0 : for( sal_Int32 nX=0; aXSlotIter != aXSlotEnd; ++aXSlotIter, ++nX )
664 : {
665 0 : std::vector<VDataSeries*>& rSeriesList = aXSlotIter->m_aSeriesVector;
666 0 : std::vector<VDataSeries*>::const_iterator aSeriesIter = rSeriesList.begin();
667 0 : const std::vector<VDataSeries*>::const_iterator aSeriesEnd = rSeriesList.end();
668 :
669 0 : std::map< sal_Int32, double > aLogicYForNextSeriesMap;//one for each different nAttachedAxisIndex
670 : //=============================================================================
671 : //iterate through all series
672 0 : for( sal_Int32 nSeriesIndex = 0; aSeriesIter != aSeriesEnd; ++aSeriesIter, ++nSeriesIndex )
673 : {
674 0 : VDataSeries* pSeries( *aSeriesIter );
675 0 : if(!pSeries)
676 0 : continue;
677 :
678 : /* #i70133# ignore points outside of series length in standard area
679 : charts. Stacked area charts will use missing points as zeros. In
680 : standard charts, pSeriesList contains only one series. */
681 0 : if( m_bArea && (rSeriesList.size() == 1) && (nIndex >= (*aSeriesIter)->getTotalPointCount()) )
682 0 : continue;
683 :
684 0 : uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(*aSeriesIter, m_xSeriesTarget);
685 :
686 0 : sal_Int32 nAttachedAxisIndex = (*aSeriesIter)->getAttachedAxisIndex();
687 0 : PlottingPositionHelper* pPosHelper = &(this->getPlottingPositionHelper( nAttachedAxisIndex ));
688 0 : if(!pPosHelper)
689 0 : pPosHelper = m_pMainPosHelper;
690 0 : PlotterBase::m_pPosHelper = pPosHelper;
691 :
692 0 : if(m_nDimension==3)
693 0 : fLogicZ = nZ+0.5;
694 0 : (*aSeriesIter)->m_fLogicZPos = fLogicZ;
695 :
696 : //collect data point information (logic coordinates, style ):
697 0 : double fLogicX = (*aSeriesIter)->getXValue(nIndex);
698 0 : if (bDateCategory)
699 0 : fLogicX = DateHelper::RasterizeDateValue( fLogicX, m_aNullDate, m_nTimeResolution );
700 0 : double fLogicY = (*aSeriesIter)->getYValue(nIndex);
701 :
702 0 : if( m_bIsPolarCooSys && m_bArea &&
703 0 : ( ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) ) )
704 : {
705 0 : if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
706 : {
707 0 : if( rSeriesList.size() == 1 || nSeriesIndex == 0 )
708 : {
709 0 : fLogicY = pPosHelper->getLogicMinY();
710 0 : if( !pPosHelper->isMathematicalOrientationY() )
711 0 : fLogicY = pPosHelper->getLogicMaxY();
712 : }
713 : else
714 0 : fLogicY = 0.0;
715 : }
716 : }
717 :
718 0 : if( m_nDimension==3 && m_bArea && rSeriesList.size()!=1 )
719 0 : fLogicY = fabs( fLogicY );
720 :
721 0 : if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) )
722 : {
723 0 : fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex];
724 : }
725 :
726 0 : if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX)
727 0 : || ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY)
728 0 : || ::rtl::math::isNan(fLogicZ) || ::rtl::math::isInf(fLogicZ) )
729 : {
730 0 : if( (*aSeriesIter)->getMissingValueTreatment() == ::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP )
731 : {
732 0 : drawing::PolyPolygonShape3D& rPolygon = (*aSeriesIter)->m_aPolyPolygonShape3D;
733 0 : sal_Int32& rIndex = (*aSeriesIter)->m_nPolygonIndex;
734 0 : if( 0<= rIndex && rIndex < rPolygon.SequenceX.getLength() )
735 : {
736 0 : if( rPolygon.SequenceX[ rIndex ].getLength() )
737 0 : rIndex++; //start a new polygon for the next point if the current poly is not empty
738 : }
739 : }
740 0 : continue;
741 : }
742 :
743 0 : if( aLogicYForNextSeriesMap.find(nAttachedAxisIndex) == aLogicYForNextSeriesMap.end() )
744 0 : aLogicYForNextSeriesMap[nAttachedAxisIndex] = 0.0;
745 :
746 0 : double fLogicValueForLabeDisplay = fLogicY;
747 :
748 0 : fLogicY += aLogicYForNextSeriesMap[nAttachedAxisIndex];
749 0 : aLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY;
750 :
751 0 : bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
752 :
753 : //remind minimal and maximal x values for area 'grounding' points
754 : //only for filled area
755 : {
756 0 : double& rfMinX = (*aSeriesIter)->m_fLogicMinX;
757 0 : if(!nIndex||fLogicX<rfMinX)
758 0 : rfMinX=fLogicX;
759 0 : double& rfMaxX = (*aSeriesIter)->m_fLogicMaxX;
760 0 : if(!nIndex||fLogicX>rfMaxX)
761 0 : rfMaxX=fLogicX;
762 : }
763 :
764 0 : drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
765 0 : drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
766 0 : pPosHelper->doLogicScaling( aScaledLogicPosition );
767 :
768 : //transformation 3) -> 4)
769 0 : drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
770 :
771 : //better performance for big data
772 0 : FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
773 0 : pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
774 0 : if( !pSeries->isAttributedDataPoint(nIndex)
775 : &&
776 : pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
777 0 : , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
778 : {
779 0 : ++nSkippedPoints;
780 0 : m_bPointsWereSkipped = true;
781 0 : continue;
782 : }
783 0 : aSeriesFormerPointMap[pSeries] = FormerPoint(aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ);
784 : //
785 :
786 : //store point information for series polygon
787 : //for area and/or line (symbols only do not need this)
788 0 : if( isValidPosition(aScaledLogicPosition) )
789 : {
790 0 : AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
791 :
792 : //prepare clipping for filled net charts
793 0 : if( !bIsVisible && m_bIsPolarCooSys && m_bArea )
794 : {
795 0 : drawing::Position3D aClippedPos(aScaledLogicPosition);
796 0 : pPosHelper->clipScaledLogicValues( 0, &aClippedPos.PositionY, 0 );
797 0 : if( pPosHelper->isLogicVisible( aClippedPos.PositionX, aClippedPos.PositionY, aClippedPos.PositionZ ) )
798 : {
799 0 : AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aClippedPos, (*aSeriesIter)->m_nPolygonIndex );
800 0 : AddPointToPoly( (*aSeriesIter)->m_aPolyPolygonShape3D, aScaledLogicPosition, (*aSeriesIter)->m_nPolygonIndex );
801 : }
802 : }
803 : }
804 :
805 : //create a single datapoint if point is visible
806 : //apply clipping:
807 0 : if( !bIsVisible )
808 0 : continue;
809 :
810 0 : bool bCreateYErrorBar = false, bCreateXErrorBar = false;
811 : {
812 0 : uno::Reference< beans::XPropertySet > xErrorBarProp(pSeries->getYErrorBarProperties(nIndex));
813 0 : if( xErrorBarProp.is() )
814 : {
815 0 : bool bShowPositive = false;
816 0 : bool bShowNegative = false;
817 0 : xErrorBarProp->getPropertyValue( C2U( "ShowPositiveError" )) >>= bShowPositive;
818 0 : xErrorBarProp->getPropertyValue( C2U( "ShowNegativeError" )) >>= bShowNegative;
819 0 : bCreateYErrorBar = bShowPositive || bShowNegative;
820 : }
821 :
822 0 : xErrorBarProp = pSeries->getXErrorBarProperties(nIndex);
823 0 : if ( xErrorBarProp.is() )
824 : {
825 0 : bool bShowPositive = false;
826 0 : bool bShowNegative = false;
827 0 : xErrorBarProp->getPropertyValue( C2U( "ShowPositiveError" )) >>= bShowPositive;
828 0 : xErrorBarProp->getPropertyValue( C2U( "ShowNegativeError" )) >>= bShowNegative;
829 0 : bCreateXErrorBar = bShowPositive || bShowNegative;
830 0 : }
831 : }
832 :
833 0 : Symbol* pSymbolProperties = m_bSymbol ? (*aSeriesIter)->getSymbolProperties( nIndex ) : 0;
834 0 : bool bCreateSymbol = pSymbolProperties && (pSymbolProperties->Style != SymbolStyle_NONE);
835 :
836 0 : if( !bCreateSymbol && !bCreateYErrorBar &&
837 0 : !bCreateXErrorBar && !pSeries->getDataPointLabelIfLabel(nIndex) )
838 0 : continue;
839 :
840 : //create a group shape for this point and add to the series shape:
841 : rtl::OUString aPointCID = ObjectIdentifier::createPointCID(
842 0 : (*aSeriesIter)->getPointCID_Stub(), nIndex );
843 : uno::Reference< drawing::XShapes > xPointGroupShape_Shapes(
844 0 : createGroupShape(xSeriesGroupShape_Shapes,aPointCID) );
845 : uno::Reference<drawing::XShape> xPointGroupShape_Shape =
846 0 : uno::Reference<drawing::XShape>( xPointGroupShape_Shapes, uno::UNO_QUERY );
847 :
848 : {
849 0 : nCreatedPoints++;
850 :
851 : //create data point
852 0 : drawing::Direction3D aSymbolSize(0,0,0);
853 0 : if( bCreateSymbol )
854 : {
855 0 : if(m_nDimension!=3)
856 : {
857 0 : if( pSymbolProperties )
858 : {
859 0 : if( pSymbolProperties->Style != SymbolStyle_NONE )
860 : {
861 0 : aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
862 0 : aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
863 : }
864 :
865 0 : if( pSymbolProperties->Style == SymbolStyle_STANDARD )
866 : {
867 0 : sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
868 : m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
869 : , aScenePosition, aSymbolSize
870 : , nSymbol
871 : , pSymbolProperties->BorderColor
872 0 : , pSymbolProperties->FillColor );
873 : }
874 0 : else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC )
875 : {
876 : m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes
877 : , aScenePosition , aSymbolSize
878 0 : , pSymbolProperties->Graphic );
879 : }
880 : //@todo other symbol styles
881 : }
882 : }
883 : }
884 : //create error bars
885 0 : if (bCreateXErrorBar)
886 0 : createErrorBar_X( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
887 :
888 0 : if (bCreateYErrorBar)
889 0 : createErrorBar_Y( aUnscaledLogicPosition, **aSeriesIter, nIndex, m_xErrorBarTarget );
890 :
891 : //create data point label
892 0 : if( (**aSeriesIter).getDataPointLabelIfLabel(nIndex) )
893 : {
894 0 : LabelAlignment eAlignment = LABEL_ALIGN_TOP;
895 : drawing::Position3D aScenePosition3D( aScenePosition.PositionX
896 : , aScenePosition.PositionY
897 0 : , aScenePosition.PositionZ+this->getTransformedDepth() );
898 :
899 0 : sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() );
900 :
901 0 : switch(nLabelPlacement)
902 : {
903 : case ::com::sun::star::chart::DataLabelPlacement::TOP:
904 0 : aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
905 0 : eAlignment = LABEL_ALIGN_TOP;
906 0 : break;
907 : case ::com::sun::star::chart::DataLabelPlacement::BOTTOM:
908 0 : aScenePosition3D.PositionY += (aSymbolSize.DirectionY/2+1);
909 0 : eAlignment = LABEL_ALIGN_BOTTOM;
910 0 : break;
911 : case ::com::sun::star::chart::DataLabelPlacement::LEFT:
912 0 : aScenePosition3D.PositionX -= (aSymbolSize.DirectionX/2+1);
913 0 : eAlignment = LABEL_ALIGN_LEFT;
914 0 : break;
915 : case ::com::sun::star::chart::DataLabelPlacement::RIGHT:
916 0 : aScenePosition3D.PositionX += (aSymbolSize.DirectionX/2+1);
917 0 : eAlignment = LABEL_ALIGN_RIGHT;
918 0 : break;
919 : case ::com::sun::star::chart::DataLabelPlacement::CENTER:
920 0 : eAlignment = LABEL_ALIGN_CENTER;
921 : //todo implement this different for area charts
922 0 : break;
923 : default:
924 : OSL_FAIL("this label alignment is not implemented yet");
925 0 : aScenePosition3D.PositionY -= (aSymbolSize.DirectionY/2+1);
926 0 : eAlignment = LABEL_ALIGN_TOP;
927 0 : break;
928 : }
929 :
930 0 : awt::Point aScreenPosition2D;//get the screen position for the labels
931 0 : sal_Int32 nOffset = 100; //todo maybe calculate this font height dependent
932 0 : if( m_bIsPolarCooSys && nLabelPlacement == ::com::sun::star::chart::DataLabelPlacement::OUTSIDE )
933 : {
934 0 : PolarPlottingPositionHelper* pPolarPosHelper = dynamic_cast<PolarPlottingPositionHelper*>(pPosHelper);
935 0 : if( pPolarPosHelper )
936 : {
937 0 : PolarLabelPositionHelper aPolarLabelPositionHelper(pPolarPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory);
938 : aScreenPosition2D = awt::Point( aPolarLabelPositionHelper.getLabelScreenPositionAndAlignmentForLogicValues(
939 0 : eAlignment, fLogicX, fLogicY, fLogicZ, nOffset ));
940 0 : }
941 : }
942 : else
943 : {
944 0 : if(LABEL_ALIGN_CENTER==eAlignment || m_nDimension == 3 )
945 0 : nOffset = 0;
946 : aScreenPosition2D = awt::Point( LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory)
947 0 : .transformSceneToScreenPosition( aScenePosition3D ) );
948 : }
949 :
950 0 : this->createDataLabel( m_xTextTarget, **aSeriesIter, nIndex
951 : , fLogicValueForLabeDisplay
952 0 : , aLogicYSumMap[nAttachedAxisIndex], aScreenPosition2D, eAlignment, nOffset );
953 : }
954 : }
955 :
956 : //remove PointGroupShape if empty
957 0 : if(!xPointGroupShape_Shapes->getCount())
958 0 : xSeriesGroupShape_Shapes->remove(xPointGroupShape_Shape);
959 :
960 0 : }//next series in x slot (next y slot)
961 0 : }//next x slot
962 : }//next z slot
963 0 : }//next category
964 : //=============================================================================
965 : //=============================================================================
966 : //=============================================================================
967 :
968 0 : impl_createSeriesShapes();
969 :
970 : /* @todo remove series shapes if empty
971 : //remove and delete point-group-shape if empty
972 : if(!xSeriesGroupShape_Shapes->getCount())
973 : {
974 : (*aSeriesIter)->m_xShape.set(NULL);
975 : m_xLogicTarget->remove(xSeriesGroupShape_Shape);
976 : }
977 : */
978 :
979 : //remove and delete series-group-shape if empty
980 :
981 : //... todo
982 :
983 0 : OSL_TRACE( "\nPPPPPPPPP<<<<<<<<<<<< area chart :: createShapes():: skipped points: %d created points: %d", nSkippedPoints, nCreatedPoints );
984 : }
985 :
986 : //.............................................................................
987 : } //namespace chart
988 : //.............................................................................
989 :
990 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|