29#include "KDChartBarPainter.h"
63bool KDChartBarPainter::isNormalMode()
const
69int KDChartBarPainter::clipShiftUp(
bool normalMode,
double areaWidthP1000 )
const
73 return ( normalMode && !bThreeDBars )
74 ?
static_cast < int > ( areaWidthP1000 * 16.0 )
79void KDChartBarPainter::initMyPainter( TQPainter* painter )
86void KDChartBarPainter::shiftMyPainter(
double dx,
double dy )
88 if( dx != 0.0 || dy != 0.0 ){
89 _myPainter->translate(dx, dy);
95void KDChartBarPainter::shiftMyPainterBack()
97 if( _painterDX != 0.0 || _painterDY != 0.0 ){
98 _myPainter->translate(-_painterDX, -_painterDY);
105void KDChartBarPainter::calculateXFront1_2(
bool bNormalMode,
bool bIsVeryFirstBar,
bool bIsFirstDataset,
bool _bThreeDBars,
106 double xpos,
double valueBlockGap,
double datasetGap,
double frontBarWidth,
107 int& frontX1,
int& frontX2,
int& prevFrontX2 ){
109 if( _bThreeDBars || bIsVeryFirstBar || !bNormalMode )
110 frontX1 =
static_cast<int>( xpos );
111 else if( bIsFirstDataset )
112 frontX1 = prevFrontX2 +
static_cast <int> ( valueBlockGap ) + 1;
114 frontX1 = prevFrontX2 +
static_cast < int > ( datasetGap ) + 1;
121 frontX2 =
static_cast < int > ( xpos + frontBarWidth );
122 prevFrontX2 = frontX2;
126TQPointArray rectToPointArray(
const TQRect& r )
129 a.putPoints( 0, 4, r.left(),r.top(), r.right(),r.top(), r.right(),r.bottom(), r.left(),r.bottom() );
134void KDChartBarPainter::specificPaintData( TQPainter* painter,
135 const TQRect& ourClipRect,
142 double areaWidthP1000,
145 double minColumnValue,
146 double maxColumnValue,
147 double columnValueDistance,
148 uint chartDatasetStart,
149 uint chartDatasetEnd,
159 TQRect frontRectPositive,frontRectNegative,
160 rightRectPositive, rightRectNegative,
161 excessRectPositive,excessRectNegative;
163 _areaP1000 = areaWidthP1000;
169 const TQPen defaultOutlinePen( params()->outlineDataColor(),
170 params()->outlineDataLineWidth(),
171 params()->outlineDataLineStyle() );
173 ai.bCenterThePoints =
true;
174 calculateAbscissaInfos( *params(), *data,
175 datasetStart, datasetEnd,
179 const TQRect devRect( painter->window() );
181 initMyPainter( painter );
183 const bool ordinateIsLogarithmic
184 = KDChartAxisParams::AxisCalcLogarithmic == ordinatePara->
axisCalcMode();
186 const bool bMultiRows = KDChartParams::BarMultiRows == params()->
barChartSubType();
187 _bThreeDBars = params()->
threeDBars() || bMultiRows;
188 int numChartDataEntryDatasets = 0;
189 uint myLastDataEntryDataset = 0;
190 for( uint iD = chartDatasetStart; iD <= chartDatasetEnd; ++iD ){
191 if( params()->chartSourceMode( iD ) == KDChartParams::DataEntry ){
192 ++numChartDataEntryDatasets;
193 myLastDataEntryDataset = iD;
197 const bool bHadClipping = painter->hasClipping();
201 painter->setClipping(
false );
206 if ( params()->numValues() != -1 )
211 double datasetGap = bMultiRows
217 double valueBlockGap = bMultiRows
225 double spaceBetweenValueBlocks = bMultiRows
227 :
static_cast<int>( valueBlockGap ) * numValues;
230 double totalNumberOfBars = 0.0;
231 double spaceBetweenDatasets = 0.0;
233 case KDChartParams::BarNormal: {
234 totalNumberOfBars = numChartDataEntryDatasets * numValues;
235 spaceBetweenDatasets = datasetGap
236 * ( totalNumberOfBars - numValues );
239 case KDChartParams::BarStacked:
240 case KDChartParams::BarPercent:
241 case KDChartParams::BarMultiRows:
242 totalNumberOfBars = numValues;
243 spaceBetweenDatasets = 0;
246 tqFatal(
"Unsupported bar chart type" );
249 double barWidth = 0.0;
250 if( params()->barWidth() == KDCHART_AUTO_SIZE ) {
254 barWidth = logWidth / totalNumberOfBars;
258 : spaceBetweenValueBlocks = ( barWidth/2 ) * numValues;
259 if ( spaceBetweenDatasets != 0 )
260 params()->
datasetGap()!= 6 ? spaceBetweenDatasets = params()->
datasetGap() * ( totalNumberOfBars - numValues )
261 : spaceBetweenDatasets = ( barWidth/4 ) * ( totalNumberOfBars - numValues );
263 while ( barWidth*totalNumberOfBars + spaceBetweenValueBlocks + spaceBetweenDatasets > logWidth );
265 valueBlockGap = ( spaceBetweenValueBlocks )/ numValues;
266 if ( spaceBetweenDatasets != 0 )
267 datasetGap = spaceBetweenDatasets / ( totalNumberOfBars - numValues );
269 barWidth = (logWidth - ( valueBlockGap * numValues ) - ( datasetGap * ( totalNumberOfBars - numValues ) ) ) / totalNumberOfBars;
276 }
else if( 0 > params()->
barWidth() )
277 barWidth = params()->
barWidth() * -areaWidthP1000;
285 double sideBarWidth = _bThreeDBars
290 const double frontBarWidth = _bThreeDBars && !bMultiRows
291 ? barWidth - sideBarWidth
295 double totalThreeDBarWidth = totalNumberOfBars*barWidth + sideBarWidth;
296 double totalSpaceOccupied = totalThreeDBarWidth + spaceBetweenDatasets + spaceBetweenValueBlocks;
297 if ( logWidth < totalSpaceOccupied) {
298 sideBarWidth -= (totalSpaceOccupied - logWidth)/totalNumberOfBars;
304 const double sideBarHeight = sideBarWidth;
307 double pixelsPerUnit = 0.0;
310 pixelsPerUnit = logHeight / ( columnValueDistance ? columnValueDistance : 10 );
318 if ( params()->barChartSubType() == KDChartParams::BarPercent ) {
319 if ( minColumnValue == 0.0 )
321 else if ( maxColumnValue == 0.0 )
322 zeroXAxisI = logHeight - sideBarHeight;
324 zeroXAxisI = ( logHeight - sideBarHeight ) / 2.0;
327 zeroXAxisI = logHeight
332 double shiftUpperBars = (params()->
barChartSubType() != KDChartParams::BarPercent)
338 double yposPositivesStart = logHeight;
339 double yposNegativesStart = logHeight;
340 if( params()->barChartSubType() == KDChartParams::BarPercent ){
341 yposPositivesStart += axisYOffset;
342 yposNegativesStart += axisYOffset;
345 for (
int iPaintExtraLinesOrTheData = 0;
346 iPaintExtraLinesOrTheData < 3;
347 ++iPaintExtraLinesOrTheData )
350 const bool bDrawExtraLines = (1 != iPaintExtraLinesOrTheData);
351 const bool bDrawExtraLinesInFront = (2 == iPaintExtraLinesOrTheData);
355 if ( _bThreeDBars && !bMultiRows )
356 xpos = 0.0 + (barWidth/2) + (valueBlockGap/2) - (frontBarWidth/2);
358 xpos = 0.0 + (valueBlockGap / 2.0);
360 double yposPositives = yposPositivesStart;
361 double yposNegatives = yposNegativesStart;
368 double nShiftX = bMultiRows
371 double nShiftY = bMultiRows
375 double valueTotal = 0.0;
379 bool bIsVeryFirstBar =
true;
380 for (
int value = 0; value < numValues; ++value ) {
382 bool bFirstValidValueUnknown =
true;
383 uint firstValidValue = 0;
384 uint lastValidPositiveValue = 0;
385 double maxValueInThisColumn = 0.0, minValueInThisColumn = 0.0;
390 for ( uint dataset = datasetStart;
391 dataset <= datasetEnd;
395 if( data->
cellCoord( dataset, value, vVal, 1 )
397 && TQVariant::Double == vVal.type() ){
399 const double cellValue
400 = ordinateIsLogarithmic
401 ? log10( vVal.toDouble() )
405 if( bFirstValidValueUnknown ){
406 firstValidValue = dataset;
407 bFirstValidValueUnknown =
false;
409 if( 0.0 <= cellValue )
410 lastValidPositiveValue = dataset;
412 maxValueInThisColumn = TQMAX( maxValueInThisColumn, cellValue );
413 minValueInThisColumn = TQMIN( minValueInThisColumn, cellValue );
414 if( params()->barChartSubType() == KDChartParams::BarPercent
416 valueTotal += cellValue;
422 shiftMyPainter( (numChartDataEntryDatasets-1)*nShiftX, (numChartDataEntryDatasets-1)*-nShiftY );
426 bool bIsFirstDataset =
true;
427 for ( uint dataset = bMultiRows
430 dataset >= chartDatasetStart && dataset <= chartDatasetEnd;
436 const bool bDataEntrySourceMode
443 if( data->
cellContent( dataset, value, coord1, coord2, propID )
444 && TQVariant::Double == coord1.type() ){
446 const double cellValue
447 = ordinateIsLogarithmic
448 ? log10( coord1.toDouble() )
455 if ( params()->barChartSubType() == KDChartParams::BarPercent )
456 barHeight = ( cellValue / valueTotal ) * fabs(zeroXAxisI - logHeight );
458 barHeight = pixelsPerUnit * cellValue;
460 if( 0.0 <= barHeight )
462 barHeight = barHeight - sideBarHeight;
464 barHeight -= sideBarHeight;
469 if( 0 == barHeight || 0.0 == barHeight ) {
476 if( dataset >= datasetStart && dataset <= datasetEnd ) {
482 if( ai.bCellsHaveSeveralCoordinates ){
483 skipMe = !calculateAbscissaAxisValue( coord2,
486 if( ai.bAbscissaHasTrueAxisDtValues &&
487 TQVariant::DateTime == coord2.type() )
488 xpos -= frontBarWidth / 2.0;
493 TQColor myBarColor( params()->dataColor( dataset ) );
494 TQColor myShadow1Color( params()->dataShadow1Color( dataset ) );
495 TQColor myShadow2Color( params()->dataShadow2Color( dataset ) );
500 const TQPen defaultPen( params()->lineColor().isValid()
501 ? params()->lineColor()
502 : params()->dataColor( dataset ),
503 params()->lineWidth(),
504 params()->lineStyle( dataset ) );
511 bool bCellPropertiesFound =
514 bool bShowThisBar = bDataEntrySourceMode;
515 if( bCellPropertiesFound ){
516 if( bShowThisBar && !bDrawExtraLines ){
523 params()->calculateShadowColors( myBarColor,
530 if( !bDrawExtraLines || bCellPropertiesFound ){
533 KDChartDataRegion::PointArrayList * pointArrayList = 0;
534 if( bDataEntrySourceMode && !bDrawExtraLines ){
535 painter->setPen( defaultOutlinePen );
536 if ( myBarColor.isValid() )
537 painter->setBrush( myBarColor );
539 painter->setBrush( NoBrush );
544 pointArrayList =
new KDChartDataRegion::PointArrayList();
551 bool tooHigh =
false;
553 if ( cellValue < 0 || cellValue < minColumnValue ) {
554 double maxValueYPos = maxColumnValue * pixelsPerUnit;
555 double yZero = yposNegatives - zeroXAxisI - sideBarHeight;
557 tooLow = (barHeight - yZero + logHeight + axisYOffset) < 0;
560 if ( cellValue <= 0 && cellValue > maxColumnValue && minColumnValue < 0 && maxColumnValue < 0 )
563 if ( tooLow && ( bNormalMode || bMultiRows) ) {
564 double delta = 0.0125 * logHeight;
565 double height = -1*(-1.0 * (yZero + sideBarHeight) - 2 * delta);
566 double height1 = height - 3.0 * delta;
568 int yArrowGap =
static_cast < int > ( 2.5 * delta );
569 calculateXFront1_2( bNormalMode, bIsVeryFirstBar, bIsFirstDataset, _bThreeDBars,
570 xpos, valueBlockGap, datasetGap, frontBarWidth,
571 frontX1, frontX2, prevFrontX2 );
573 const int xm =
static_cast < int > ( (frontX1 + frontX2) / 2.0 );
574 TQRect rect( ourClipRect );
576 rect.setHeight(
static_cast<int>( rect.height() + 3.0 * delta ) );
577 painter->setClipRect( rect );
582 TQPoint arrowTop( xm,
static_cast<int>( yZero + height1 + 2 * yArrowGap) );
584 if ( arrowTop.y()== yposNegatives )
587 arrowXAxisGap =
static_cast <int> (yposNegatives - arrowTop.y() - 2);
589 if( bDrawExtraLines ){
590 drawExtraLinesAndMarkers(
594 xm,
static_cast<int>( yZero + height1 ),
600 bDrawExtraLinesInFront );
601 }
else if( bShowThisBar ){
602 if( params()->drawSolidExcessArrows() ) {
611 TQPointArray points( 5 );
613 points.setPoint( 0, frontX1, cellValue < 0 ?
614 static_cast<int>(yZero+height1 - 3.0*delta)+(2*yArrowGap)+ arrowXAxisGap:
615 static_cast<int>( yZero + height1)+(2*yArrowGap)+ arrowXAxisGap);
616 points.setPoint( 1, frontX2, cellValue < 0 ?
617 static_cast<int>(yZero+height1 - 3.0*delta)+(2*yArrowGap)+ arrowXAxisGap:
618 static_cast<int>( yZero + height1)+(2*yArrowGap)+ arrowXAxisGap );
619 points.setPoint( 2, frontX2, cellValue < 0 ?
620 static_cast<int>(yZero+height1 - 3.0*delta)+(2*yArrowGap)+ arrowXAxisGap:
621 static_cast<int>( yZero + height1)+(2*yArrowGap)+ arrowXAxisGap);
622 points.setPoint( 3, xm, cellValue < 0 ?
623 static_cast<int>( yZero + height1)+(2*yArrowGap)+ arrowXAxisGap:
624 static_cast<int>(yZero+height1 - 3.0*delta)+(2*yArrowGap)+ arrowXAxisGap);
625 points.setPoint( 4, frontX1, cellValue < 0 ?
626 static_cast<int>(yZero+height1 - 3.0*delta)+(2*yArrowGap)+ arrowXAxisGap:
627 static_cast<int>( yZero + height1)+(2*yArrowGap)+ arrowXAxisGap);
630 if ( minColumnValue < 0 && maxColumnValue > 0 ) {
631 points.setPoint(0, points.point(0).x(),
static_cast <int> (yposNegatives - zeroXAxisI) );
632 points.setPoint(1, points.point(1).x(),
static_cast <int> (yposNegatives - zeroXAxisI) );
636 if ( minColumnValue < 0 && maxColumnValue < 0 ) {
638 if ( cellValue > maxColumnValue ) {
643 int diffArrowBase = points.point(2).y() - points.point(3).y();
644 double maxValueYPos = maxColumnValue * pixelsPerUnit;
645 double minValueYPos = minColumnValue * pixelsPerUnit;
646 double adjustedArrow = (cellValue == 0 ? minValueYPos - maxValueYPos + diffArrowBase + 2:
647 minValueYPos - maxValueYPos - diffArrowBase + 1);
648 points.setPoint( 0, frontX1, points.point(0).y() +
static_cast <int> (adjustedArrow));
649 points.setPoint( 1, frontX2, points.point(1).y() +
static_cast <int> (adjustedArrow ));
650 points.setPoint( 2, frontX2, points.point(2).y() +
static_cast <int> (adjustedArrow));
651 points.setPoint( 3, xm, points.point(3).y() +
static_cast <int> (adjustedArrow));
652 points.setPoint( 4, frontX1, points.point(4).y() +
static_cast <int> (adjustedArrow));
655 if ( cellValue < minColumnValue ) {
656 points.setPoint( 0, frontX1,
static_cast <int> ( yZero - maxValueYPos ) );
657 points.setPoint( 1, frontX2,
static_cast <int> ( yZero - maxValueYPos ) );
666 if ( params()->userWidth() != 0 ) {
668 if ( params()->userWidth() < 0 )
669 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
671 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
673 TQRect tmpRect ( points.point(0), points.point(2));
674 points.setPoint(0,
static_cast <int>(tmpRect.center().x() - userwidth/2),
675 points.point(0).y());
676 points.setPoint(1,
static_cast <int>(tmpRect.center().x() + userwidth/2),
677 points.point(1).y());
678 points.setPoint(2,
static_cast <int>(tmpRect.center().x() + userwidth/2),
679 points.point(2).y());
680 points.setPoint(4,
static_cast <int>(tmpRect.center().x() - userwidth/2),
681 points.point(4).y());
684 if ( bMultiRows )painter->setClipping(
false );
685 painter->drawPolygon( points );
688 TQPoint tpLeft (points.point(4).x(), points.point(4).y() - 2 * yArrowGap );
689 TQPoint tpRight(points.point(2).x(), points.point(2).y() - 2 * yArrowGap );
692 excessRectNegative.setTopLeft(tpLeft);
693 excessRectNegative.setTopRight(tpRight);
694 excessRectNegative.setBottomRight(points.point(1));
695 excessRectNegative.setBottomLeft(points.point(0));
698 if ( pointArrayList ) {
699 if ( cellValue < 0 ) {
701 int size =
static_cast <int> ( ( points.point( 3 ).y() - tpRight.y() + excessRectNegative.width() )/2 );
702 points.setPoint( 4 ,tpLeft );
703 points.setPoint( 2, tpRight );
704 if ( cellValue < maxColumnValue )
705 points.translate( _dataRect.x(), -_dataRect.y() - size );
707 points.translate( _dataRect.x(), _dataRect.y() );
709 points.translate( _dataRect.x(), _dataRect.y() );
711 pointArrayList->append( points );
722 TQPointArray points( 5 );
724 points.setPoint( 0, frontX1, cellValue < 0 ?
725 static_cast<int>(yZero+height1 - 3.0*delta) + arrowXAxisGap:
726 static_cast<int>( yZero + height1)+(2 * yArrowGap)+ arrowXAxisGap);
727 points.setPoint( 1, frontX2, cellValue < 0 ?
728 static_cast<int>(yZero+height1 - 3.0*delta) + arrowXAxisGap:
729 static_cast<int>( yZero + height1)+(2 * yArrowGap)+ arrowXAxisGap);
730 points.setPoint( 2, frontX2, cellValue < 0 ?
731 static_cast<int>(yZero+height1 - 3.0*delta) + arrowXAxisGap:
732 static_cast<int>( yZero + height1)+(2 * yArrowGap)+ arrowXAxisGap);
733 points.setPoint( 3, xm, cellValue < 0 ?
734 static_cast<int>( yZero + height1) + arrowXAxisGap:
735 static_cast<int>(yZero+height1 - 3.0*delta)+(2 * yArrowGap)+ arrowXAxisGap);
736 points.setPoint( 4, frontX1, cellValue < 0 ?
737 static_cast<int>(yZero+height1 - 3.0*delta) + arrowXAxisGap:
738 static_cast<int>( yZero + height1)+(2 * yArrowGap)+ arrowXAxisGap);
741 if ( minColumnValue < 0 && maxColumnValue > 0 ) {
742 points.setPoint(0, points.point(0).x(),
static_cast <int> (yposNegatives - zeroXAxisI) );
743 points.setPoint(1, points.point(1).x(),
static_cast <int> (yposNegatives - zeroXAxisI) );
747 if ( minColumnValue < 0 && maxColumnValue < 0 ) {
749 if ( cellValue > maxColumnValue ) {
754 int diffArrowBase = points.point(2).y() - points.point(3).y();
755 double maxValueYPos = maxColumnValue * pixelsPerUnit;
757 points.setPoint( 0, frontX1,
static_cast <int> ( yZero - maxValueYPos) );
758 points.setPoint( 1, frontX2,
static_cast <int> ( yZero - maxValueYPos) );
759 points.setPoint( 2, frontX2,
static_cast <int> ( yZero - maxValueYPos) );
760 points.setPoint( 3, xm,
static_cast <int> ( yZero - maxValueYPos - diffArrowBase ) );
761 points.setPoint( 4, frontX1,
static_cast <int> ( yZero - maxValueYPos) );
764 if ( cellValue < minColumnValue ) {
765 points.setPoint( 0, frontX1,
static_cast <int> ( yZero - maxValueYPos) );
766 points.setPoint( 1, frontX2,
static_cast <int> ( yZero - maxValueYPos) );
773 if ( params()->userWidth() != 0 ) {
775 if ( params()->userWidth() < 0 )
776 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
778 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
780 TQRect tmpRect ( points.point(0), points.point(2));
781 points.setPoint(0,
static_cast <int>(tmpRect.center().x() - userwidth/2),
782 points.point(0).y());
783 points.setPoint(1,
static_cast <int>(tmpRect.center().x() + userwidth/2),
784 points.point(1).y());
785 points.setPoint(2,
static_cast <int>(tmpRect.center().x() + userwidth/2),
786 points.point(2).y());
787 points.setPoint(4,
static_cast <int>(tmpRect.center().x() - userwidth/2),
788 points.point(4).y());
790 if ( bMultiRows )painter->setClipping(
false );
791 painter->drawPolygon( points );
794 TQPoint tpLeft (points.point(4).x(), points.point(4).y() - 2 * yArrowGap );
795 TQPoint tpRight(points.point(2).x(), points.point(2).y() - 2 * yArrowGap );
798 excessRectNegative.setTopLeft(tpLeft);
799 excessRectNegative.setTopRight(tpRight);
800 excessRectNegative.setBottomRight(points.point(1));
801 excessRectNegative.setBottomLeft(points.point(0));
804 if ( pointArrayList ) {
805 if ( cellValue < 0 ) {
807 int size =
static_cast <int> ( ( points.point( 3 ).y() - tpRight.y() + excessRectNegative.width() )/2 );
808 if ( cellValue < maxColumnValue )
809 points.translate( _dataRect.x(), -_dataRect.y() - size );
811 points.translate( _dataRect.x(), _dataRect.y() + ( 2 * yArrowGap ) );
813 points.translate( _dataRect.x(), -_dataRect.y() );
815 pointArrayList->append( points );
818 TQPointArray points2( 6 );
819 points2.setPoint( 0, frontX1, cellValue < 0 ?
820 static_cast<int>( yZero + height1 - 3.0 * delta ) + arrowXAxisGap:
821 static_cast<int>(yZero + height1) + arrowXAxisGap);
822 points2.setPoint( 1, xm, cellValue < 0 ?
823 static_cast<int>(yZero + height1) + arrowXAxisGap:
824 static_cast<int>( yZero + height1 - 3.0 * delta ) + arrowXAxisGap);
825 points2.setPoint( 2, frontX2, cellValue < 0 ?
826 static_cast<int>(yZero + height1 - 3.0 * delta) + arrowXAxisGap:
827 static_cast<int>(yZero + height1) + arrowXAxisGap);
828 points2.setPoint( 3, frontX2, cellValue < 0 ?
829 static_cast<int>(yZero + height1 - 3.75 * delta) + arrowXAxisGap :
830 static_cast<int>(yZero + height1 - 0.75 * delta) + arrowXAxisGap);
831 points2.setPoint( 4, xm, cellValue < 0 ?
832 static_cast<int>(yZero + height1 - 0.75 * delta) + arrowXAxisGap:
833 static_cast<int>(yZero + height1 - 3.75 * delta) + arrowXAxisGap);
834 points2.setPoint( 5, frontX1, cellValue < 0 ?
835 static_cast<int>(yZero + height1 - 3.75 * delta) + arrowXAxisGap:
836 static_cast<int>(yZero + height1 - 0.75 * delta) + arrowXAxisGap);
837 points2.translate( 0, yArrowGap );
839 if ( minColumnValue < 0 && maxColumnValue < 0 && cellValue > maxColumnValue ) {
844 int diffArrowBase = points.point(2).y() - points.point(3).y();
845 double maxValueYPos = maxColumnValue * pixelsPerUnit;
846 double minValueYPos = minColumnValue * pixelsPerUnit;
847 double adjustedArrow = cellValue == 0 ? minValueYPos - maxValueYPos + diffArrowBase:
848 minValueYPos - maxValueYPos - diffArrowBase + 1;
850 points2.setPoint( 0, frontX1, points2.point(0).y()
851 +
static_cast <int> (adjustedArrow - diffArrowBase + yArrowGap) );
852 points2.setPoint( 1, xm, points2.point(1).y()
853 +
static_cast <int> (adjustedArrow - diffArrowBase + yArrowGap) );
854 points2.setPoint( 2, frontX2, points2.point(2).y()
855 +
static_cast <int> (adjustedArrow - diffArrowBase + yArrowGap) );
856 points2.setPoint( 3, frontX2, points2.point(3).y()
857 +
static_cast <int> (adjustedArrow - diffArrowBase + yArrowGap) );
858 points2.setPoint( 4, xm, points2.point(4).y()
859 +
static_cast <int> (adjustedArrow - diffArrowBase + yArrowGap) );
860 points2.setPoint( 5, frontX1, points2.point(5).y()
861 +
static_cast <int> (adjustedArrow - diffArrowBase + yArrowGap) );
867 if ( params()->userWidth() != 0 ) {
869 if ( params()->userWidth() < 0 )
870 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
872 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
875 points2.setPoint(0, excessRectNegative.topLeft().x(),points2.point(0).y());
876 points2.setPoint(2, excessRectNegative.topRight().x(),points2.point(2).y());
877 points2.setPoint(3, excessRectNegative.topRight().x(),points2.point(3).y());
878 points2.setPoint(5, excessRectNegative.topLeft().x(),points2.point(5).y());
881 painter->drawPolygon( points2 );
895 points2.translate( 0, yArrowGap );
897 points2.translate( 0, -yArrowGap );
899 painter->drawPolygon( points2 );
908 painter->setClipRect( ourClipRect );
917 int pt1Y =
static_cast < int > ( yZero - barHeight );
928 calculateXFront1_2( bNormalMode, bIsVeryFirstBar, bIsFirstDataset, _bThreeDBars,
929 xpos, valueBlockGap, datasetGap, frontBarWidth,
930 frontX1, frontX2, prevFrontX2 );
932 TQPoint pt1( frontX1, pt1Y );
933 TQPoint pt2( frontX2,
934 static_cast < int > ( yZero + sideBarHeight) );
936 if( 0.0 > maxColumnValue ){
937 pt2.setY(pt2.y() -
static_cast < int > (pixelsPerUnit * maxColumnValue));
939 if( pt2.y() < pt1Y ) {
943 if( pt2.x() < frontX1 ) {
947 if( bDrawExtraLines ){
950 y -=
static_cast < int > ( sideBarHeight );
951 drawExtraLinesAndMarkers(
955 (frontX1+frontX2)/2, y,
961 bDrawExtraLinesInFront );
962 }
else if( bShowThisBar ){
964 TQSize siz( pt2.x() - pt1.x(),
966 TQRect rect( pt1, siz );
968 if( 1.5 > frontBarWidth ){
969 TQPen oldPen( painter->pen() );
970 painter->setPen( TQPen(painter->brush().color(), 0) );
971 painter->drawLine(pt1, TQPoint(pt1.x(),pt2.y()));
972 painter->setPen( oldPen );
975 if ( tooLow || cellValue < minColumnValue) {
976 frontRectNegative.setTopLeft(excessRectNegative.bottomLeft());
977 frontRectNegative.setTopRight(excessRectNegative.bottomRight());
978 frontRectNegative.setBottomRight(excessRectNegative.topRight());
979 frontRectNegative.setBottomLeft(excessRectNegative.topLeft());
982 frontRectNegative.setTopLeft(rect.topLeft());
983 frontRectNegative.setTopRight(rect.topRight());
984 frontRectNegative.setBottomRight(rect.bottomRight());
985 frontRectNegative.setBottomLeft(rect.bottomLeft());
987 if ( cellValue == 0 && params()->barChartSubType() == KDChartParams::BarPercent)
988 rect.setTop( rect.bottom());
1007 if ( params()->userWidth() != 0 ) {
1009 if ( params()->userWidth() < 0 )
1010 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
1012 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
1014 rect.setLeft(
static_cast <int> (rect.center().x() - (userwidth/2)));
1015 rect.setRight(
static_cast <int> (rect.center().x() + (userwidth/2)));
1016 rect.setWidth(
static_cast <int> (userwidth) );
1017 frontRectNegative.setLeft( tooLow || cellValue < minColumnValue ?
1018 static_cast <int> (excessRectNegative.center().x() - (userwidth/2)):rect.left());
1019 frontRectNegative.setRight( tooHigh ?
static_cast <int> (excessRectNegative.center().x() + (userwidth/2)):rect.right());
1022 if ( cellValue != 0 && params()->
barChartSubType() != KDChartParams::BarPercent) {
1023 painter->setClipping(
false );
1024 painter->drawRect( rect );
1028 if ( pointArrayList ) {
1029 rect.moveBy( _dataRect.x(), _dataRect.y() );
1030 pointArrayList->append( rectToPointArray( rect ) );
1040 double maxValueYPos = maxColumnValue * pixelsPerUnit;
1041 double minValueYPos = minColumnValue * pixelsPerUnit;
1042 double minDataValueYPos = maxValueYPos - minValueYPos;
1043 double yZero = yposPositives - zeroXAxisI;
1052 tooHigh = ( barHeight > maxValueYPos*1.001 ) || ( cellValue < minColumnValue );
1057 int dataValueYPos =
static_cast <int>( ( cellValue * pixelsPerUnit ) );
1058 tooHigh = dataValueYPos > maxValueYPos;
1060 tooHigh = maxValueInThisColumn > maxColumnValue;
1064 if ( tooHigh && bNormalMode ||
1066 || tooHigh && bMultiRows ) {
1068 double delta = -0.0125 * logHeight;
1069 double height = -1.0 * yZero
1071 double height1 = height + -3.0 * delta;
1073 int yArrowGap =
static_cast < int > ( 2.5 * delta );
1074 calculateXFront1_2( bNormalMode, bIsVeryFirstBar, bIsFirstDataset, _bThreeDBars,
1075 xpos, valueBlockGap, datasetGap, frontBarWidth,
1076 frontX1, frontX2, prevFrontX2 );
1078 const int xm =
static_cast < int > ( ( frontX1 + frontX2 ) / 2.0 );
1079 TQRect rect( ourClipRect );
1081 rect.setTop(
static_cast<int>( rect.top() + 3 * delta ) );
1082 rect.setHeight(
static_cast<int>( rect.height() - 3 * delta ) );
1083 painter->setClipRect( rect );
1085 if( bDrawExtraLines ){
1086 drawExtraLinesAndMarkers(
1090 xm,
static_cast<int>( yZero + height1 ),
1096 bDrawExtraLinesInFront );
1097 }
else if( bShowThisBar ){
1098 if( params()->drawSolidExcessArrows() ) {
1100 TQPointArray points( 5 );
1102 points.setPoint( 0, frontX1,
1103 (minDataValueYPos <
static_cast <int> (yZero))?
1104 static_cast <int> (minDataValueYPos-1):static_cast <int>(yZero));
1105 points.setPoint( 1, frontX2,
1106 (minDataValueYPos <
static_cast <int> (yZero))?
1107 static_cast <int> (minDataValueYPos-1):static_cast <int>(yZero));
1108 points.setPoint( 2, frontX2,
static_cast<int>( yZero + height1 - 3.0 * delta )
1110 points.setPoint( 3, xm,
static_cast<int>( yZero + height1 )
1112 points.setPoint( 4, frontX1,
static_cast<int>( yZero + height1 - 3.0 * delta )
1116 if ( cellValue > maxColumnValue && 0 >= maxColumnValue ) {
1117 points.setPoint( 0, frontX1,
static_cast<int>( yZero + height1 - 3.0 * delta ) + 2 * yArrowGap);
1118 points.setPoint( 1, frontX2,
static_cast<int>( yZero + height1 - 3.0 * delta ) + 2 * yArrowGap);
1124 if ( params()->userWidth() != 0 ) {
1126 if ( params()->userWidth() < 0 )
1127 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
1129 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
1131 TQRect tmpRect ( points.point(0), points.point(2));
1132 points.setPoint(0,
static_cast <int>(tmpRect.center().x() - userwidth/2),
1133 points.point(0).y());
1134 points.setPoint(1,
static_cast <int>(tmpRect.center().x() + userwidth/2),
1135 points.point(1).y());
1136 points.setPoint(2,
static_cast <int>(tmpRect.center().x() + userwidth/2),
1137 points.point(2).y());
1138 points.setPoint(4,
static_cast <int>(tmpRect.center().x() - userwidth/2),
1139 points.point(4).y());
1142 if ( params()->barChartSubType() != KDChartParams::BarStacked ||
1143 params()->barChartSubType() == KDChartParams::BarStacked && dataset != datasetEnd ) {
1145 painter->setClipping(
false );
1146 painter->drawPolygon( points );
1149 TQPoint tpLeft (points.point(4).x(),
static_cast <int> (points.point(4).y() - yArrowGap));
1150 TQPoint tpRight(points.point(2).x(),
static_cast <int> (points.point(2).y() - yArrowGap));
1160 excessRectPositive.setTopLeft(tpLeft);
1161 excessRectPositive.setTopRight(tpRight);
1162 excessRectPositive.setBottomRight(points.point(1));
1163 excessRectPositive.setBottomLeft(points.point(0));
1166 if ( pointArrayList && params()->barChartSubType() != KDChartParams::BarStacked ) {
1167 points.translate( _dataRect.x(), _dataRect.y() + excessRectPositive.top() - yArrowGap );
1168 pointArrayList->append( points );
1169 }
else if ( params()->barChartSubType() == KDChartParams::BarStacked ) {
1170 if ( dataset != datasetEnd ) {
1171 points.translate( _dataRect.x(), _dataRect.y() + excessRectPositive.top() );
1172 pointArrayList->append( points );
1175 points.translate( _dataRect.x(), _dataRect.y() - excessRectPositive.bottom() - yArrowGap);
1176 pointArrayList->append( points );
1187 TQPointArray points( 5 );
1189 points.setPoint( 0, frontX1,
1190 (minDataValueYPos <
static_cast <int> (yZero))?
1191 static_cast <int> (minDataValueYPos - 1) : static_cast <int>(yZero));
1192 points.setPoint( 1, frontX2,
1193 (minDataValueYPos <
static_cast <int> (yZero))?
1194 static_cast<int> ( minDataValueYPos - 1) : static_cast <int>(yZero));
1195 points.setPoint( 2, frontX2,
static_cast<int>( yZero + height1 - 3.0 * delta ) );
1196 points.setPoint( 3, xm,
static_cast<int>( yZero + height1 ) );
1197 points.setPoint( 4, frontX1,
static_cast<int>( yZero + height1 - 3.0 * delta ) );
1200 if ( cellValue > maxColumnValue && 0 >= maxColumnValue || cellValue == 0) {
1201 points.setPoint( 0, frontX1,
static_cast<int>( yZero + height1 - 3.0 * delta ));
1202 points.setPoint( 1, frontX2,
static_cast<int>( yZero + height1 - 3.0 * delta ));
1208 if ( params()->userWidth() != 0 ) {
1210 if ( params()->userWidth() < 0 )
1211 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
1213 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
1215 TQRect tmpRect ( points.point(0), points.point(2));
1216 points.setPoint(0,
static_cast <int>(tmpRect.center().x() - userwidth/2),
1217 points.point(0).y());
1218 points.setPoint(1,
static_cast <int>(tmpRect.center().x() + userwidth/2),
1219 points.point(1).y());
1220 points.setPoint(2,
static_cast <int>(tmpRect.center().x() + userwidth/2),
1221 points.point(2).y());
1222 points.setPoint(4,
static_cast <int>(tmpRect.center().x() - userwidth/2),
1223 points.point(4).y());
1226 if ( params()->barChartSubType() != KDChartParams::BarStacked ||
1227 params()->barChartSubType() == KDChartParams::BarStacked && dataset != datasetEnd ) {
1228 painter->setClipping(
false );
1229 painter->drawPolygon( points );
1233 excessRectPositive.setTopLeft(points.point(4));
1234 excessRectPositive.setTopRight(points.point(2));
1235 excessRectPositive.setBottomRight(points.point(1));
1236 excessRectPositive.setBottomLeft(points.point(0));
1239 if ( pointArrayList && params()->barChartSubType() != KDChartParams::BarStacked ) {
1240 points.translate( _dataRect.x(), _dataRect.y() + excessRectPositive.top() );
1241 pointArrayList->append( points );
1242 }
else if ( params()->barChartSubType() == KDChartParams::BarStacked ) {
1243 if ( dataset != datasetEnd ) {
1244 points.translate( _dataRect.x(), _dataRect.y() + excessRectPositive.top() );
1245 pointArrayList->append( points );
1248 points.translate( _dataRect.x(), _dataRect.y() - excessRectPositive.bottom() - yArrowGap);
1249 pointArrayList->append( points );
1253 TQPointArray points2( 6 );
1254 points2.setPoint( 0, frontX1,
static_cast<int>( yZero + height1 - 3.0 * delta ) );
1255 points2.setPoint( 1, xm,
static_cast<int>( yZero + height1 ) );
1256 points2.setPoint( 2, frontX2,
static_cast<int>( yZero + height1 - 3.0 * delta ) );
1257 points2.setPoint( 3, frontX2,
static_cast<int>( yZero + height1 - 3.75 * delta ) );
1258 points2.setPoint( 4, xm,
static_cast<int>( yZero + height1 - 0.75 * delta ) );
1259 points2.setPoint( 5, frontX1,
static_cast<int>( yZero + height1 - 3.75 * delta ) );
1260 points2.translate( 0, yArrowGap );
1265 if ( params()->userWidth() != 0 ) {
1267 if ( params()->userWidth() < 0 )
1268 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
1270 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
1272 points2.setPoint(0, excessRectPositive.topLeft().x(),points2.point(0).y());
1273 points2.setPoint(2, excessRectPositive.topRight().x(),points2.point(2).y());
1274 points2.setPoint(3, excessRectPositive.topRight().x(),points2.point(3).y());
1275 points2.setPoint(5, excessRectPositive.topLeft().x(),points2.point(5).y());
1279 painter->drawPolygon( points2 );
1290 points2.translate( 0, yArrowGap );
1291 painter->drawPolygon( points2 );
1299 painter->setClipRect( ourClipRect );
1303 double y0 = yposPositives - zeroXAxisI;
1305 int pt1Y =
static_cast < int > ( y0 - barHeight - sideBarHeight);
1307 calculateXFront1_2( bNormalMode, bIsVeryFirstBar, bIsFirstDataset, _bThreeDBars,
1308 xpos, valueBlockGap, datasetGap, frontBarWidth,
1309 frontX1, frontX2, prevFrontX2 );
1311 TQPoint pt1( frontX1, pt1Y );
1312 TQPoint pt2( frontX2,
1313 static_cast < int > ( y0 + shiftUpperBars ) );
1315 if( 0.0 < minColumnValue )
1316 pt2.setY(pt2.y() -
static_cast < int > ( pixelsPerUnit * minColumnValue ));
1318 if( pt2.y() < pt1Y ) {
1319 pt1.setY( pt2.y() );
1322 if( pt2.x() < frontX1 ) {
1323 pt1.setX( frontX2 );
1324 pt2.setX( frontX1 );
1326 if( bDrawExtraLines ){
1329 y -=
static_cast < int > ( sideBarHeight );
1331 drawExtraLinesAndMarkers(
1335 (frontX1+frontX2)/2, y,
1341 bDrawExtraLinesInFront );
1342 }
else if( bShowThisBar ){
1344 TQSize siz( pt2.x() - pt1.x(),
1347 TQRect rect( pt1, siz );
1350 if ( params()->barChartSubType() == KDChartParams::BarPercent && cellValue != 0)
1351 rect.setTop( rect.top() +
static_cast <int> (sideBarHeight) - 1);
1355 frontRectPositive.setTopLeft(excessRectPositive.topLeft());
1356 frontRectPositive.setTopRight(excessRectPositive.topRight());
1357 frontRectPositive.setBottomRight(excessRectPositive.bottomRight());
1358 frontRectPositive.setBottomLeft(excessRectPositive.bottomLeft());
1360 frontRectPositive.setTopLeft(rect.topLeft());
1361 frontRectPositive.setTopRight(rect.topRight());
1362 frontRectPositive.setBottomRight(rect.bottomRight());
1363 frontRectPositive.setBottomLeft(rect.bottomLeft());
1364 if( _bThreeDBars && cellValue == 0 )
1365 frontRectNegative = frontRectPositive;
1368 if( 1.5 > frontBarWidth ){
1370 TQPen oldPen( painter->pen() );
1371 painter->setPen( TQPen(painter->brush().color(), 0) );
1372 painter->drawLine(pt1, TQPoint(pt1.x(),pt2.y()));
1373 painter->setPen( oldPen );
1390 if ( params()->userWidth() != 0 ) {
1392 if ( params()->userWidth() < 0 )
1393 userwidth =
static_cast <int> (params()->userWidth() * -areaWidthP1000);
1395 userwidth =
static_cast <int> (params()->userWidth() * areaWidthP1000);
1397 rect.setLeft(
static_cast <int> (rect.center().x() - (userwidth/2)));
1398 rect.setRight(
static_cast <int> (rect.center().x() + (userwidth/2)));
1399 rect.setWidth(
static_cast <int> (userwidth) );
1401 frontRectPositive.setLeft( tooHigh ?
static_cast <int> (excessRectPositive.center().x() - (userwidth/2)):rect.left());
1402 frontRectPositive.setRight( tooHigh ?
static_cast <int> (excessRectPositive.center().x() + (userwidth/2)):rect.right());
1406 if (!tooHigh && !tooLow || params()->
barChartSubType() == KDChartParams::BarPercent ) {
1408 painter->setClipping(
false );
1410 painter->setClipping(
true );
1411 painter->drawRect( rect );
1414 if ( pointArrayList ) {
1415 rect.moveBy( _dataRect.x(), _dataRect.y());
1416 pointArrayList->append( rectToPointArray( rect ) );
1422 if ( bShowThisBar && _bThreeDBars && !bDrawExtraLines ) {
1425 TQPointArray points( 4 );
1426 if (cellValue <= 0 || cellValue < minColumnValue) {
1427 if ( tooLow || cellValue < minColumnValue ) {
1428 points.setPoint(0, excessRectNegative.topRight());
1429 points.setPoint(1, excessRectNegative.topRight().x() +
static_cast<int>(sideBarHeight),
1430 excessRectNegative.top() -
static_cast<int>(sideBarHeight));
1431 points.setPoint(2, excessRectNegative.bottomRight().x() +
static_cast<int>(sideBarHeight),
1432 excessRectNegative.bottom() -
static_cast<int>(sideBarHeight));
1433 points.setPoint(3, excessRectNegative.bottomRight());
1435 points.setPoint( 0, frontRectNegative.bottomRight());
1436 points.setPoint( 1, frontRectNegative.bottomRight().x() +
static_cast<int>(sideBarHeight),
1437 frontRectNegative.bottom() -
static_cast<int>(sideBarHeight) );
1438 points.setPoint(2, frontRectNegative.bottomRight().x() +
static_cast<int>(sideBarHeight),
1439 frontRectNegative.top() -
static_cast<int>(sideBarHeight));
1440 points.setPoint(3, frontRectNegative.topRight() );
1443 rightRectNegative.setTopLeft( points.point(0));
1444 rightRectNegative.setTopRight( points.point(2));
1445 rightRectNegative.setBottomRight(points.point(1));
1446 rightRectNegative.setBottomLeft(points.point(3));
1453 points.setPoint(0, excessRectPositive.topRight());
1454 points.setPoint(1, excessRectPositive.topRight().x() +
static_cast <int> (sideBarHeight),
1455 excessRectPositive.top() -
static_cast <int> (sideBarHeight) );
1456 points.setPoint(2, excessRectPositive.bottomRight().x() +
static_cast <int> (sideBarHeight),
1457 excessRectPositive.bottom() -
static_cast <int> (sideBarHeight));
1458 points.setPoint(3, excessRectPositive.bottomRight());
1460 points.setPoint(0, frontRectPositive.topRight());
1461 points.setPoint(1, frontRectPositive.topRight().x() +
static_cast <int> (sideBarHeight),
1462 frontRectPositive.top() -
static_cast<int>(sideBarHeight));
1463 points.setPoint(2, frontRectPositive.bottomRight().x() +
static_cast <int> (sideBarHeight),
1464 frontRectPositive.bottom() -
static_cast<int>(sideBarHeight));
1465 points.setPoint(3, frontRectPositive.bottomRight());
1468 rightRectPositive.setTopLeft( points.point(0));
1469 rightRectPositive.setTopRight( points.point(1));
1470 rightRectPositive.setBottomLeft( points.point(3));
1471 rightRectPositive.setBottomRight(points.point(2));
1474 if ( myShadow2Color.isValid() )
1475 painter->setBrush( TQBrush( myShadow2Color, params()->shadowPattern() ) );
1477 painter->setBrush( NoBrush );
1493 if( (!tooHigh && !tooLow) || (tooHigh && cellValue <= 0 ) ) {
1494 if (( cellValue != 0 && params()->barChartSubType() == KDChartParams::BarPercent ) ||
1495 ( cellValue != 0 && params()->barChartSubType() == KDChartParams::BarStacked ) ||
1496 ( cellValue != 0 && bNormalMode ||
1497 cellValue != 0 && bMultiRows)) {
1498 painter->setClipping(
false );
1499 painter->drawPolygon( points );
1505 if ( pointArrayList && !tooHigh && !tooLow && params()->barChartSubType() != KDChartParams::BarPercent ) {
1506 TQPointArray points2cpy( points.copy() );
1508 points2cpy.translate( _dataRect.x(), _dataRect.y());
1510 pointArrayList->append( points2cpy );
1515 if ( bNormalMode || bMultiRows ||
1519 ( maxValueInThisColumn <= 0.0 && dataset == firstValidValue ) ||
1521 ( minValueInThisColumn >= 0.0 && dataset == lastValidPositiveValue ) ||
1525 ( dataset == lastValidPositiveValue ) ) {
1526 if (cellValue <= 0 || cellValue < minColumnValue) {
1528 points.setPoint(0,excessRectNegative.bottomLeft());
1529 points.setPoint(1,excessRectNegative.topLeft().x() +
static_cast <int> (sideBarHeight),
1530 excessRectNegative.bottom() -
static_cast <int> (sideBarHeight));
1531 points.setPoint(2,excessRectNegative.bottomRight().x() +
static_cast <int> (sideBarHeight),
1532 excessRectNegative.bottom() -
static_cast <int> (sideBarHeight));
1533 points.setPoint(3,excessRectNegative.bottomRight());
1536 points.setPoint(0,frontRectNegative.topLeft() );
1537 points.setPoint(1,frontRectNegative.topLeft().x() +
static_cast <int> (sideBarHeight), rightRectNegative.top());
1538 points.setPoint(2,rightRectNegative.topRight() );
1539 points.setPoint(3,rightRectNegative.topRight().x() -
static_cast <int> (sideBarHeight),
1540 frontRectNegative.topRight().y() );
1542 if ( (params()->barChartSubType() == KDChartParams::BarStacked && cellValue == 0 && maxValueInThisColumn != 0 ) )
1543 points.translate(0, maxValueInThisColumn <= 0?-(
static_cast <int> (1*pixelsPerUnit) + 1):
1544 -static_cast<int>(maxValueInThisColumn*pixelsPerUnit));
1546 if ( params()->barChartSubType() == KDChartParams::BarPercent && cellValue == 0 ) {
1547 if ( dataset == datasetEnd && maxValueInThisColumn != 0)
1548 points.translate(0, -
static_cast<int>( logHeight - sideBarHeight ));
1549 else if ( maxValueInThisColumn == 0)
1550 points.translate(0,
static_cast <int> (logHeight + (sideBarHeight - sideBarWidth)));
1555 points.setPoint(0, excessRectPositive.topLeft());
1556 points.setPoint(1, excessRectPositive.topLeft().x() +
static_cast <int> (sideBarHeight),
1557 excessRectPositive.top() -
static_cast <int> (sideBarHeight) );
1558 points.setPoint(2, excessRectPositive.topRight().x() +
static_cast <int> (sideBarHeight),
1559 excessRectPositive.top() -
static_cast <int> (sideBarHeight));
1560 points.setPoint(3, excessRectPositive.topRight());
1564 points.setPoint(0, frontRectPositive.topLeft());
1565 points.setPoint(1, frontRectPositive.topLeft().x() +
static_cast <int> (sideBarHeight),
1566 rightRectPositive.top() );
1567 points.setPoint(2, rightRectPositive.topRight());
1568 points.setPoint(3, rightRectPositive.topRight().x() -
static_cast <int> (sideBarHeight),
1569 frontRectPositive.topRight().y());
1573 if (cellValue < 0.0 && maxValueInThisColumn < 0)
1574 painter->setBrush( bMultiRows ? myBarColor : black );
1576 painter->setBrush( TQBrush( myShadow1Color, params()->shadowPattern() ) );
1578 if ( !myShadow1Color.isValid() )
1579 painter->setBrush( NoBrush );
1594 if (!tooHigh && !tooLow || (tooHigh && cellValue <= 0) )
1595 painter->drawPolygon( points );
1598 if (pointArrayList && !tooHigh && !tooLow
1599 && params()->barChartSubType() != KDChartParams::BarPercent
1600 && params()->barChartSubType() != KDChartParams::BarStacked) {
1601 points.translate( _dataRect.x(), _dataRect.y());
1602 pointArrayList->append( points );
1607 if( regions && pointArrayList && ! pointArrayList->empty() ) {
1608 if( bShowThisBar && !bDrawExtraLines ){
1609 KDChartDataRegion * region;
1611 region =
new KDChartDataRegion( dataset, value, chart,
1612 pointArrayList,
true );
1615 region =
new KDChartDataRegion( dataset, value, chart,
1616 pointArrayList->first().boundingRect() );
1617 delete pointArrayList;
1622 regions->append( region );
1624 delete pointArrayList;
1633 int iDummy1, iDummy2;
1634 calculateXFront1_2( bNormalMode, bIsVeryFirstBar, bIsFirstDataset, _bThreeDBars,
1635 xpos, valueBlockGap, datasetGap, frontBarWidth,
1636 iDummy1, iDummy2, prevFrontX2 );
1642 if ( params()->barChartSubType() == KDChartParams::BarStacked ||
1643 params()->barChartSubType() == KDChartParams::BarPercent )
1644 if ( cellValue < 0 )
1645 (_bThreeDBars && params()->
barChartSubType() != KDChartParams::BarPercent)?yposNegatives -= sideBarHeight + barHeight:
1646 yposNegatives -= barHeight;
1648 (_bThreeDBars && params()->barChartSubType() != KDChartParams::BarPercent)?yposPositives -= sideBarHeight + barHeight:
1649 yposPositives -= barHeight;
1655 int iDummy1, iDummy2;
1656 calculateXFront1_2( bNormalMode, bIsVeryFirstBar, bIsFirstDataset, _bThreeDBars,
1657 xpos, valueBlockGap, datasetGap, frontBarWidth,
1658 iDummy1, iDummy2, prevFrontX2 );
1663 bool bAdvanceToNextValue =
1664 ( bMultiRows ? (dataset == chartDatasetStart) : (dataset == chartDatasetEnd)
1665 || ( params()->chartSourceMode( bMultiRows ? dataset-1 : dataset+1 )
1668 if ( bNormalMode ) {
1669 if( bAdvanceToNextValue )
1672 if ( dataset < myLastDataEntryDataset )
1675 if( bAdvanceToNextValue || bMultiRows ){
1677 shiftMyPainter( -nShiftX, nShiftY );
1679 bIsVeryFirstBar =
false;
1680 bIsFirstDataset =
false;
1687 xpos += valueBlockGap;
1691 xpos += valueBlockGap + barWidth;
1695 yposPositives = yposPositivesStart;
1696 yposNegatives = yposNegativesStart;
1699 shiftMyPainterBack();
1706 painter->setClipping( bHadClipping );
Header for all common chart parameters.
A common base class for classes that implement chart painters for chart types ith axes.
access the chart axis parameters.
int axisTrueLineWidth() const
Returns the axis true line width, as calculated and drawn.
double axisZeroLineStartY() const
Returns the not-rounded y-position where drawing of this axis zero line started.
AxisCalcMode axisCalcMode() const
Returns the axis calculation mode configured in this params object.
virtual ~KDChartBarPainter()
Destructor.
KDChartBarPainter(KDChartParams *params)
Constructor.
The collection class used by KD Chart to store data region information.
Bundles the display parameters of a chart.
int datasetGap() const
Returns the number of pixels between two dataset values.
double threeDBarDepth() const
Returns the depth of the 3D Effect used for 3D bars.
bool valueBlockGapIsRelative() const
Returns if the value set by setValueBlockGap is a per mille value of the chart data area width.
int barWidth() const
Returns the width of one bar as set by setBarWidth or KDCHART_AUTO_SIZE if setBarWidth was never call...
LineMarkerStyle lineMarkerStyle(uint dataset) const
Returns the marker to be used for a dataset.
LineMarkerStyle
The available line marker styles.
int numValues() const
Returns how many of the values should be shown.
bool calculateProperties(int startId, KDChartPropertySet &rSet) const
Retrieves the values that correspond to a property set by reading this set's properties and obtaining...
int valueBlockGap() const
Returns the number of pixels between each value block.
SourceMode chartSourceMode(uint dataset, uint dataset2=KDCHART_NO_DATASET, uint *chart=0) const
Retrieves usage information of a given dataset or a range of datasets.
bool datasetGapIsRelative() const
Returns if the value set by setDatasetGap is a per mille value of the chart data area width.
double cosThreeDBarAngle() const
Returns the cosine in rad of the angle used for 3D bars.
bool threeDBars() const
Returns whether the engine should draw any bars in 3D.
BarChartSubType barChartSubType() const
Returns the bar chart subtype.
Property settings of a single KDChart data cell.
bool hasOwnBarColor(int &idBarColor, TQColor &barColor)
Returns whether this property set is specifying it's own bar color settings.
bool hasOwnShowBar(int &idShowBar, bool &showBar)
Returns whether this property set is specifying it's own flag indicating whether this cell's bar is t...
KD Chart's build-in table data for an easy way of storing data values.
virtual uint usedCols() const
Returns the number of cols in the table that actually contain data.
virtual bool cellContent(uint _row, uint _col, TQVariant &_value1, TQVariant &_value2, int &_prop) const
virtual bool cellCoord(uint _row, uint _col, TQVariant &_value, int coordinate=1) const =0
Returns one of the coordinate data value(s) stored in a cell.