kchart

KDChartParams.cpp
1/*
2 KDChart - a multi-platform charting engine
3 */
4
5/****************************************************************************
6 ** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB. All rights reserved.
7 **
8 ** This file is part of the KDChart library.
9 **
10 ** This file may be distributed and/or modified under the terms of the
11 ** GNU General Public License version 2 as published by the Free Software
12 ** Foundation and appearing in the file LICENSE.GPL included in the
13 ** packaging of this file.
14 **
15 ** Licensees holding valid commercial KDChart licenses may use this file in
16 ** accordance with the KDChart Commercial License Agreement provided with
17 ** the Software.
18 **
19 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21 **
22 ** See http://www.klaralvdalens-datakonsult.se/?page=products for
23 ** information about KDChart Commercial License Agreements.
24 **
25 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
26 ** licensing are not clear to you.
27 **
28 **********************************************************************/
29#include <KDChartParams.h>
30#include <KDChartAxisParams.h>
31#include <KDChartEnums.h>
32#include <KDFrame.h>
33#include <KDChartCustomBox.h>
34#include <KDChartTextPiece.h>
35#include <KDXMLTools.h>
36#ifndef KDCHART_MASTER_CVS
37#include "KDChartParams.moc"
38#endif
39
40class KDChartData;
41
42//#include <tqdom.h>
43
52
53
54
55//TQColor KDChartParams::_internalPointer_DataValueAutoColor = TQColor( 0,1,0 );
56
57KDChartAutoColor* KDChartAutoColor::mInstance = NULL;
58
59KDChartAutoColor::KDChartAutoColor()
60{
61}
62
63KDChartAutoColor::KDChartAutoColor( KDChartAutoColor const& )
64{
65}
66
67KDChartAutoColor::~KDChartAutoColor()
68{
69}
70
71const KDChartAutoColor* KDChartAutoColor::instance()
72{
73 if( mInstance == 0 )
74 mInstance = new KDChartAutoColor();
75 return mInstance;
76}
77
78void KDChartAutoColor::freeInstance()
79{
80 if( mInstance )
81 delete mInstance;
82 mInstance = 0;
83}
84
85
86/*
87static TQColor defaultColor;
88const TQColor & KDChartParams_AutoColor = defaultColor;
89*/
90
95{
96 tempPropSetA = new KDChartPropertySet();
97 tempPropSetB = new KDChartPropertySet();
98
99 // GENERAL
100
101 // Avoid Purify UMR
102 _maxDatasetColor = 1;
103 _maxDatasetSourceMode = 0;
104 _setChartSourceModeWasUsed = false;
105
106 _customBoxDictMayContainHoles = false;
107
108 // Set the default font params flag for data value texts
109 // but do *not* call setPrintDataValues() there since
110 // this will be called internally by setChartType() below.
111 setPrintDataValuesWithDefaultFontParams( KDCHART_ALL_CHARTS, false );
112 _printDataValuesSettings._dataValuesShowInfinite = true;
113 _printDataValuesSettings2._dataValuesShowInfinite = true;
114
117 setGlobalLeading( 0,0,0,0 );
118
119
120 // Default type is bar charts
121 setChartType( Bar );
122
123 // By default, there is no additional chart type
124 setAdditionalChartType( NoType );
125
126 // Default is to show all values.
127 setNumValues( static_cast<unsigned int>( -1 ) );
128
129 _defaultFont = TQFont( "helvetica", 8, TQFont::Normal, false );
130
131 // The default frame settings: no border, no corners, no background
132 _noFrame.clearAll();
133
134 // The default frame settings: no inner gap, no outer gap and use the _noFrame
135 // *** no need to initialize _noFrameSettings: it is initialized by a default c'tor!
136
137 // The default brightness of shadow colors (needs to be set
138 // before the data colors to avoid an UMR).
140
141 // The default shadow fill style.
142 setShadowPattern( TQt::SolidPattern );
143
144 // Some default colors for the data.
146
147 // Default color for data display outlines.
148 setOutlineDataColor( black );
149
150 // Default line width for data display outlines.
152
153 // Default line style for data display outlines.
154 setOutlineDataLineStyle( TQt::SolidLine );
155
156 // END GENERAL
157
158
159 setDataArea( TQRect( TQPoint(0,0), TQSize(0,0)) );
160 setLegendArea(TQRect( TQPoint(0,0), TQSize(0,0)) );
161
162
163 // BAR CHART-SPECIFIC
164
165 // Default bar subtype is normal
166 setBarChartSubType( BarNormal );
167
168 // Default is not to draw 3D bars
169 setThreeDBars( false );
170
171 // Default is to used shadowed colors for 3D bar effects
173
174 // Default angle for 3D bars is 45 degrees.
175 setThreeDBarAngle( 45 );
176
177 // Default depth of 3D bars is 1.0
178 setThreeDBarDepth( 1.0 );
179
180 // Default gap between datasets is 6 per mille of chart data area.
181 setDatasetGap( 6 );
183
184 // Default gap between value blocks is 24 per mille of chart data area.
185 setValueBlockGap( 24 );
187
188 // Default is to have the bar width's calculated indiidually
189 setBarWidth( KDCHART_AUTO_SIZE );
190 // reset the special indicator members storing the number
191 // of bars that were drawn last time / could not be drawn
192 // due to too less horizontal space
193 setBarsDisplayed( 0 );
194 setBarsLeft( 0 );
195
196 // By default, excess arrows are drawn in a split fashion
198
199 // END BAR CHART-SPECIFIC
200
201
202 // LINE/AREA CHART-SPECIFIC
203 // Normal lines by default
204 setLineChartSubType( LineNormal );
205
206 // No markers by default
207 setLineMarker( false );
208
209 // Lines have a width of 1 pixel by default
210 setLineWidth( 1 );
211
212 // Lines are solid by default
213 setLineStyle( TQt::SolidLine );
214
215 // Lines have the same color as their
216 // respective data points by default
217 setLineColor();
218
219
220 // Default line marker styles and size
221 _maxDatasetLineMarkerStyle = 0; // avoid UMR
222 setLineMarkerStyle( 0, LineMarkerCircle );
223 setLineMarkerStyle( 1, LineMarkerSquare );
224 setLineMarkerStyle( 2, LineMarkerDiamond );
225 setLineMarkerSize( TQSize( 6, 6 ) );
226
227 // 3D line settings
228 setThreeDLines( false );
229 setThreeDLineDepth( 10 );
230 /* temporary disabled:
231 setThreeDLineXRotation( 30 );
232 setThreeDLineYRotation( 30 );
233 */
236
237 // Normal areas by default
238 setAreaChartSubType( AreaNormal );
239
240 // Areas are filled below the value points by default.
241 setAreaLocation( AreaBelow );
242
243 // END LINE/AREA CHART-SPECIFIC
244
245 // POLAR CHART-SPECIFIC
246 // Normal polar charts by default
247 setPolarChartSubType( PolarNormal );
248
249 // Have markers by default
250 setPolarMarker( true );
251
252 // Polar charts show the zero point at the right side of the circle
254
255 // Lines have a width of 3/1000 of the chart's min size
256 // (either width or height) by default
257 setPolarLineWidth( -3 );
258
259 // Default polar marker styles and size
260 _maxDatasetPolarMarkerStyle = 0; // avoid UMR
261 setPolarMarkerStyle( 0, PolarMarkerCircle );
262 setPolarMarkerStyle( 1, PolarMarkerSquare );
263 setPolarMarkerStyle( 2, PolarMarkerDiamond );
264 setPolarMarkerSize( TQSize( -40,-40 ) );
265
266 // default circular axes delimiters
268 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosTopLeft, false, false );
269 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosTopCenter, true, true );
270 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosTopRight, false, false );
271
272 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosCenterLeft, false, false );
273 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosCenterRight, false, false );
274
275 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosBottomLeft, false, false );
276 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosBottomCenter, true, true );
277 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosBottomRight, false, false );
278
279
280 /* for test:
281 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosTopLeft, true, true );
282 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosTopCenter, true, true );
283 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosTopRight, true, true );
284 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosCenterRight, true, true );
285 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosBottomRight, true, true );
286 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosBottomCenter, true, true );
287 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosBottomLeft, true, true );
288 setPolarDelimsAndLabelsAtPos( KDChartEnums::PosCenterLeft, true, true );
289 */
290
291
292 // END POLAR CHART-SPECIFIC
293
294 // PIE/RING CHART-SPECIFIC
295 // Pie/ring charts do not explode by default.
296 setExplode( false );
297 // But if they do, the explode factor is 10%
298 setExplodeFactor( 0.1 );
299 // setExplodeValues() is not called for initialization, the default
300 // empty list is the default.
301 // Flat pies by default
302 setThreeDPies( false );
303 // Height of 3D effect
304 setThreeDPieHeight( 20 );
305 // Start of pie circle
306 setPieStart( 0 );
307 // Start of ring circle
308 setRingStart( 0 );
309 // Ring thickness is constant by default
311 // END PIE/RING CHART-SPECIFIC
312
313
314 // HILO CHART-SPECIFIC
315 // Simple HiLo charts by default
316 setHiLoChartSubType( KDChartParams::HiLoSimple );
321
322
323 // BOX+WHISKER CHART-SPECIFIC
324 // Simple Box-and-Whisker charts by default
325 setBWChartSubType( KDChartParams::BWSimple );
326 setBWChartFences(1.5, 1.5, 3.0, 3.0);
328 setBWChartPrintStatistics( BWStatValALL, false );
329 setBWChartBrush( TQt::white );
330
331 // LEGEND
332 // Distance between legend and data.
333 setLegendSpacing( 20 );
334 // Position of the legend
335 setLegendPosition( LegendRight );
336 // Orientation of the legend
337 setLegendOrientation( TQt::Vertical );
338 // Whether the legend shall show lines or just
339 // show the markers (or squares, resp.)
340 setLegendShowLines( false );
341 // Where the legend labels come from
342 setLegendSource( LegendAutomatic );
343 // legend texts are drawn in black by default
344 setLegendTextColor( TQt::black );
345 // legend font size is calculated dynamically, but ignore the font size
346 setLegendFont( TQFont( "helvetica", 10, TQFont::Normal, false ), false );
347 // legend font size is calculated dynamically:
348 // 40 / 1000 of the minimal value of
349 // the printable area height and width
351 // the default legend title is "Legend"
352 setLegendTitleText( tr( "Legend" ) );
353 // legend title is drawn in black by default
354 setLegendTitleTextColor( TQt::black );
355 // legend title font size is calculated dynamically, but ignore
356 // the font size
357 setLegendTitleFont( TQFont( "helvetica", 12, TQFont::Normal, false ), false );
358 // legend title font size is calculated dynamically:
359 // 50 / 1000 of the minimal value of
360 // the printable area height and width
362 // END LEGEND
363
364
365 // AXES
366
368 // activate bottom (ordinate) and left (abcissa) axis
370
371 // END AXES
372
373
374 // HEADERS/FOOTERS
375
376 // Set a default font for all sections not taking the build-in
377 // defaults from c'tor KDChartParams::HdFtParams::HdFtParams()
378 TQFont defaultHdFtFont( "helvetica", 14, TQFont::Normal, false );
379 int relHd0Size = 15;
380 int relHdSize = 22;
381 int relHd2Size = 19;
382
383 int relFt0Size = 15;
384 int relFtSize = 19;
385 int relFt2Size = 12;
386 setHeaderFooterFont( KDChartParams::HdFtPosHeader0,
387 defaultHdFtFont, true, relHd0Size );
388 setHeaderFooterFont( KDChartParams::HdFtPosHeader0L,
389 defaultHdFtFont, true, relHd0Size );
390 setHeaderFooterFont( KDChartParams::HdFtPosHeader0R,
391 defaultHdFtFont, true, relHd0Size );
392 setHeaderFooterFont( KDChartParams::HdFtPosHeader,
393 defaultHdFtFont, true, relHdSize );
394 setHeaderFooterFont( KDChartParams::HdFtPosHeaderL,
395 defaultHdFtFont, true, relHdSize );
396 setHeaderFooterFont( KDChartParams::HdFtPosHeaderR,
397 defaultHdFtFont, true, relHdSize );
398 setHeaderFooterFont( KDChartParams::HdFtPosHeader2,
399 defaultHdFtFont, true, relHd2Size );
400 setHeaderFooterFont( KDChartParams::HdFtPosHeader2L,
401 defaultHdFtFont, true, relHd2Size );
402 setHeaderFooterFont( KDChartParams::HdFtPosHeader2R,
403 defaultHdFtFont, true, relHd2Size );
404
405 setHeaderFooterFont( KDChartParams::HdFtPosFooter0,
406 defaultHdFtFont, true, relFt0Size );
407 setHeaderFooterFont( KDChartParams::HdFtPosFooter0L,
408 defaultHdFtFont, true, relFt0Size );
409 setHeaderFooterFont( KDChartParams::HdFtPosFooter0R,
410 defaultHdFtFont, true, relFt0Size );
411 setHeaderFooterFont( KDChartParams::HdFtPosFooter,
412 defaultHdFtFont, true, relFtSize );
413 setHeaderFooterFont( KDChartParams::HdFtPosFooterL,
414 defaultHdFtFont, true, relFtSize );
415 setHeaderFooterFont( KDChartParams::HdFtPosFooterR,
416 defaultHdFtFont, true, relFtSize );
417 setHeaderFooterFont( KDChartParams::HdFtPosFooter2,
418 defaultHdFtFont, true, relFt2Size );
419 setHeaderFooterFont( KDChartParams::HdFtPosFooter2L,
420 defaultHdFtFont, true, relFt2Size );
421 setHeaderFooterFont( KDChartParams::HdFtPosFooter2R,
422 defaultHdFtFont, true, relFt2Size );
423 // END HEADERS/FOOTERS
424
425 // PROPERTY SETS
426 tempPropSetA->fullReset("normal data");
428 // don't show the line, don't show the marker
429 tempPropSetA->setName("transparent data");
430 tempPropSetA->setLineStyle( KDChartPropertySet::OwnID, TQt::NoPen );
431 tempPropSetA->setShowMarker( KDChartPropertySet::OwnID, false );
433 // don't show line nor marker, but do show the horizontal line
434 tempPropSetA->setName("horizontal line");
435 tempPropSetA->setExtraLinesAlign( KDChartPropertySet::OwnID, TQt::AlignLeft | TQt::AlignRight );
437 // don't show line nor marker, but do show the vertical line
438 tempPropSetA->setName("vertical line");
439 tempPropSetA->setExtraLinesAlign( KDChartPropertySet::OwnID, TQt::AlignTop | TQt::AlignBottom );
441 // END PROPERTY SETS
442}
443
444
449{
450 KDChartAutoColor::freeInstance();
451 delete tempPropSetA;
452 delete tempPropSetB;
453}
454
455
456// GENERAL
462
463
486{
487 _propertySetList.setAutoDelete( true );
488 rSet.mOwnID = _propertySetList.count();
489 _propertySetList.insert( rSet.mOwnID, rSet.clone() );
490 return rSet.mOwnID;
491}
492
512{
513 _propertySetList.setAutoDelete( true );
514 rSet.mOwnID = id;
515 _propertySetList.replace( rSet.mOwnID, rSet.clone() );
516}
517
533{
534 _propertySetList.setAutoDelete( true );
535 // Removing the default property set is not allowed!
537 return false;
538 return _propertySetList.remove( id );
539}
540
541
564{
565 const KDChartPropertySet* R = _propertySetList.find( id );
566 const bool bFound = (0 != R);
567 if( bFound )
568 rSet.deepCopy( R );
569 return bFound;
570}
571
572
596{
597 return _propertySetList.find( id );
598}
599
600
619{
620 KDChartPropertySet& startSet = *tempPropSetA;
621 startSet.quickReset("");
622
623 rSet.deepCopy( &startSet ); // reset all properties of rSet to the default !!
624
625//tqDebug("in KDChartParams::calculateProperties():");
626//tqDebug(" startId: %i",startId);
627//tqDebug(" startSet: %s",startSet.name().latin1());
628
629 bool bOk = properties(startId, startSet);
630 if( bOk ){
631 int lineWidth;
632 TQColor lineColor;
633 TQt::PenStyle lineStyle;
634 bool showMarker;
635 uint markerAlign;
636 TQSize markerSize;
637 TQColor markerColor;
638 int markerStyle;
639 uint extraLinesAlign;
640 bool extraLinesInFront;
641 int extraLinesLength;
642 int extraLinesWidth;
643 TQColor extraLinesColor;
644 TQt::PenStyle extraLinesStyle;
645 uint extraMarkersAlign;
646 TQSize extraMarkersSize;
647 TQColor extraMarkersColor;
648 int extraMarkersStyle;
649 bool showBar;
650 TQColor barColor;
651 TQBrush areaBrush;
652 // c'tor sets all IDs to unknown by default
653 KDChartPropertySet& propSet = *tempPropSetB;
654 propSet.quickReset("");
655 // PENDING(khz) replace the rustic depth counter i by a smart way
656 // to quickly and safely recognize forbidden circular ID dependencies
657 // *without* using this artificial maximal tree depth limitation.
658 const int maxDepth = 1000;
659 int i;
660 int id;
661 // retrieve lineWidth
662 propSet.deepCopy( &startSet ); i=0;
663 do{
664 if( propSet.hasOwnLineWidth( id, lineWidth ) ){
665 rSet.setLineWidth( KDChartPropertySet::OwnID, lineWidth );
666 break;
667 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
668 break;
669 ++i;
670 }while( properties(id, propSet) );
671 // retrieve lineColor
672 propSet.deepCopy( &startSet ); i=0;
673 do{
674 if( propSet.hasOwnLineColor( id, lineColor ) ){
675 rSet.setLineColor( KDChartPropertySet::OwnID, lineColor );
676 break;
677 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
678 break;
679 ++i;
680 }while( properties(id, propSet) );
681 // retrieve lineStyle
682 propSet.deepCopy( &startSet ); i=0;
683 do{
684 if( propSet.hasOwnLineStyle( id, lineStyle ) ){
685 rSet.setLineStyle( KDChartPropertySet::OwnID, lineStyle );
686 break;
687 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
688 break;
689 ++i;
690 }while( properties(id, propSet) );
691
692 // markers at cell value position:
693
694 // retrieve showMarker
695 propSet.deepCopy( &startSet ); i=0;
696 do{
697 if( propSet.hasOwnShowMarker( id, showMarker ) ){
698 rSet.setShowMarker( KDChartPropertySet::OwnID, showMarker );
699 break;
700 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
701 break;
702 ++i;
703 }while( properties(id, propSet) );
704 // retrieve marker alignment
705 propSet.deepCopy( &startSet ); i=0;
706 do{
707 if( propSet.hasOwnMarkerAlign( id, markerAlign ) ){
708 rSet.setMarkerAlign( KDChartPropertySet::OwnID, markerAlign );
709 break;
710 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
711 break;
712 ++i;
713 }while( properties(id, propSet) );
714 // retrieve marker size
715 propSet.deepCopy( &startSet ); i=0;
716 do{
717 if( propSet.hasOwnMarkerSize( id, markerSize ) ){
718 rSet.setMarkerSize( KDChartPropertySet::OwnID, markerSize );
719 break;
720 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
721 break;
722 ++i;
723 }while( properties(id, propSet) );
724 // retrieve marker color
725 propSet.deepCopy( &startSet ); i=0;
726 do{
727 if( propSet.hasOwnMarkerColor( id, markerColor ) ){
728 rSet.setMarkerColor( KDChartPropertySet::OwnID, markerColor );
729 break;
730 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
731 break;
732 ++i;
733 }while( properties(id, propSet) );
734 // retrieve marker style
735 propSet.deepCopy( &startSet ); i=0;
736 do{
737 if( propSet.hasOwnMarkerStyle( id, markerStyle ) ){
738 rSet.setMarkerStyle( KDChartPropertySet::OwnID, markerStyle );
739 break;
740 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
741 break;
742 ++i;
743 }while( properties(id, propSet) );
744
745 // extra lines:
746
747 // retrieve alignment of extra lines
748 propSet.deepCopy( &startSet ); i=0;
749 do{
750 if( propSet.hasOwnExtraLinesAlign( id, extraLinesAlign ) ){
751 rSet.setExtraLinesAlign( KDChartPropertySet::OwnID, extraLinesAlign );
752 break;
753 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
754 break;
755 ++i;
756 }while( properties(id, propSet) );
757 // retrieve whether the extra lines shall be printed in front of the normal lines
758 propSet.deepCopy( &startSet ); i=0;
759 do{
760 if( propSet.hasOwnExtraLinesInFront( id, extraLinesInFront ) ){
761 rSet.setExtraLinesInFront( KDChartPropertySet::OwnID, extraLinesInFront );
762 break;
763 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
764 break;
765 ++i;
766 }while( properties(id, propSet) );
767 // retrieve lineLength
768 propSet.deepCopy( &startSet ); i=0;
769 do{
770 if( propSet.hasOwnExtraLinesLength( id, extraLinesLength ) ){
771 rSet.setExtraLinesLength( KDChartPropertySet::OwnID, extraLinesLength );
772 break;
773 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
774 break;
775 ++i;
776 }while( properties(id, propSet) );
777 // retrieve lineWidth
778 propSet.deepCopy( &startSet ); i=0;
779 do{
780 if( propSet.hasOwnExtraLinesWidth( id, extraLinesWidth ) ){
781 rSet.setExtraLinesWidth( KDChartPropertySet::OwnID, extraLinesWidth );
782 break;
783 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
784 break;
785 ++i;
786 }while( properties(id, propSet) );
787 // retrieve lineColor
788 propSet.deepCopy( &startSet ); i=0;
789 do{
790 if( propSet.hasOwnExtraLinesColor( id, extraLinesColor ) ){
791 rSet.setExtraLinesColor( KDChartPropertySet::OwnID, extraLinesColor );
792 break;
793 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
794 break;
795 ++i;
796 }while( properties(id, propSet) );
797 // retrieve lineStyle
798 propSet.deepCopy( &startSet ); i=0;
799 do{
800 if( propSet.hasOwnExtraLinesStyle( id, extraLinesStyle ) ){
801 rSet.setExtraLinesStyle( KDChartPropertySet::OwnID, extraLinesStyle );
802 break;
803 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
804 break;
805 ++i;
806 }while( properties(id, propSet) );
807
808 // markers at the ends of the extra lines:
809
810 // retrieve marker alignment
811 propSet.deepCopy( &startSet ); i=0;
812 do{
813 if( propSet.hasOwnExtraMarkersAlign( id, extraMarkersAlign ) ){
814 rSet.setExtraMarkersAlign( KDChartPropertySet::OwnID, extraMarkersAlign );
815 break;
816 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
817 break;
818 ++i;
819 }while( properties(id, propSet) );
820 // retrieve marker size
821 propSet.deepCopy( &startSet ); i=0;
822 do{
823 if( propSet.hasOwnExtraMarkersSize( id, extraMarkersSize ) ){
824 rSet.setExtraMarkersSize( KDChartPropertySet::OwnID, extraMarkersSize );
825 break;
826 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
827 break;
828 ++i;
829 }while( properties(id, propSet) );
830 // retrieve marker color
831 propSet.deepCopy( &startSet ); i=0;
832 do{
833 if( propSet.hasOwnExtraMarkersColor( id, extraMarkersColor ) ){
834 rSet.setExtraMarkersColor( KDChartPropertySet::OwnID, extraMarkersColor );
835 break;
836 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
837 break;
838 ++i;
839 }while( properties(id, propSet) );
840 // retrieve marker style
841 propSet.deepCopy( &startSet ); i=0;
842 do{
843 if( propSet.hasOwnExtraMarkersStyle( id, extraMarkersStyle ) ){
844 rSet.setExtraMarkersStyle( KDChartPropertySet::OwnID, extraMarkersStyle );
845 break;
846 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
847 break;
848 ++i;
849 }while( properties(id, propSet) );
850
851 // retrieve showBar
852 propSet.deepCopy( &startSet ); i=0;
853 do{
854 if( propSet.hasOwnShowBar( id, showBar ) ){
855 rSet.setShowBar( KDChartPropertySet::OwnID, showBar );
856 break;
857 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
858 break;
859 ++i;
860 }while( properties(id, propSet) );
861 // retrieve barColor
862 propSet.deepCopy( &startSet ); i=0;
863 do{
864 if( propSet.hasOwnBarColor( id, barColor ) ){
865 rSet.setBarColor( KDChartPropertySet::OwnID, barColor );
866 break;
867 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
868 break;
869 ++i;
870 }while( properties(id, propSet) );
871
872 // retrieve areaBrush
873 propSet.deepCopy( &startSet ); i=0;
874 do{
875 if( propSet.hasOwnAreaBrush( id, areaBrush ) ){
876 rSet.setAreaBrush( KDChartPropertySet::OwnID, areaBrush );
877 break;
878 }else if( KDChartPropertySet::UndefinedID == id || maxDepth < i )
879 break;
880 ++i;
881 }while( properties(id, propSet) );
882
883 }
884 return bOk;
885}
886
887
893
894
895
1058 uint chart,
1059 int divPow10,
1060 int digitsBehindComma,
1061 TQFont* font,
1062 uint size,
1063 const TQColor* color,
1064 KDChartEnums::PositionFlag negativePosition,
1065 uint negativeAlign,
1066 int negativeDeltaX,
1067 int negativeDeltaY,
1068 int negativeRotation,
1069 KDChartEnums::PositionFlag positivePosition,
1070 uint positiveAlign,
1071 int positiveDeltaX,
1072 int positiveDeltaY,
1073 int positiveRotation,
1075{
1076 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
1077 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
1078 ? &_printDataValuesSettings
1079 : &_printDataValuesSettings2;
1080 for ( uint i = 0; i < count; ++i ) {
1081 settings->_printDataValues = active;
1082 settings->_divPow10 = divPow10;
1083 settings->_digitsBehindComma = digitsBehindComma;
1084
1085 const ChartType cType
1086 = ( ( 1 < count && i )
1087 || ( 1 == count && 0 < chart && chart < 1000 ) )
1089 : chartType();
1090
1091 bool finished( false );
1092 if ( UINT_MAX == size ) {
1093 finished = true;
1094 switch ( cType ) {
1095 case NoType:
1096 case Bar: {
1097 if ( font )
1098 settings->_dataValuesFont = *font;
1099 else
1100 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Bold );
1101 settings->_dataValuesUseFontRelSize = true;
1102 settings->_dataValuesFontRelSize = 16;
1103 settings->_dataValuesAutoColor = false; // !!!
1104 settings->_dataValuesColor = TQColor( TQt::darkBlue );
1105 settings->_dataValuesBrush = TQBrush( TQt::NoBrush );
1106 // for values below zero:
1107 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosBottomRight;
1108 settings->_dataValuesAnchorNegativeAlign = TQt::AlignBottom + TQt::AlignRight;
1109 settings->_dataValuesAnchorNegativeDeltaX = 20;
1110 settings->_dataValuesAnchorNegativeDeltaY = 55;
1111 settings->_dataValuesNegativeRotation = 300;
1112 // for values greater/equal zero:
1113 settings->_dataValuesAnchorPositivePosition = KDChartEnums::PosTopLeft;
1114 settings->_dataValuesAnchorPositiveAlign = TQt::AlignTop + TQt::AlignLeft;
1115 settings->_dataValuesAnchorPositiveDeltaX = - 20;
1116 settings->_dataValuesAnchorPositiveDeltaY = - 65;
1117 settings->_dataValuesPositiveRotation = 300;
1118
1119 settings->_dataValuesLayoutPolicy = KDChartEnums::LayoutPolicyRotate;
1120 }
1121 break;
1122 case Line: {
1123 if ( font )
1124 settings->_dataValuesFont = *font;
1125 else
1126 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Normal );
1127 settings->_dataValuesUseFontRelSize = true;
1128 settings->_dataValuesFontRelSize = 16;
1129 settings->_dataValuesAutoColor = false; // !!!
1130 settings->_dataValuesColor = TQColor( TQt::darkBlue );
1131 settings->_dataValuesBrush = TQBrush( TQt::NoBrush );
1132 // for values below zero:
1133 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosBottomCenter;
1134 settings->_dataValuesAnchorNegativeAlign = TQt::AlignTop + TQt::AlignHCenter;
1135 settings->_dataValuesAnchorNegativeDeltaX = 0;
1136 settings->_dataValuesAnchorNegativeDeltaY = 0;
1137 settings->_dataValuesNegativeRotation = 0;
1138 // for values greater/equal zero:
1139 settings->_dataValuesAnchorPositivePosition = KDChartEnums::PosTopCenter;
1140 settings->_dataValuesAnchorPositiveAlign = TQt::AlignBottom + TQt::AlignHCenter;
1141 settings->_dataValuesAnchorPositiveDeltaX = 0;
1142 settings->_dataValuesAnchorPositiveDeltaY = 0;
1143 settings->_dataValuesPositiveRotation = 0;
1144
1145 settings->_dataValuesLayoutPolicy = KDChartEnums::LayoutPolicyRotate;
1146 }
1147 break;
1148 case Area: {
1149 if ( font )
1150 settings->_dataValuesFont = *font;
1151 else
1152 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Bold );
1153 settings->_dataValuesUseFontRelSize = true;
1154 settings->_dataValuesFontRelSize = 21;
1155 settings->_dataValuesAutoColor = true; // !!!
1156 settings->_dataValuesColor = TQColor( TQt::black );
1157 settings->_dataValuesBrush = TQBrush( TQt::white );
1158
1159 bool bShowOutside = areaChartSubType() == AreaNormal;
1160 // for values below zero:
1161 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosBottomCenter;
1162 settings->_dataValuesAnchorNegativeAlign = TQt::AlignHCenter
1163 + (bShowOutside ? TQt::AlignTop : TQt::AlignBottom);
1164 settings->_dataValuesAnchorNegativeDeltaX = 0;
1165 settings->_dataValuesAnchorNegativeDeltaY = bShowOutside ? 20 : -35;
1166 settings->_dataValuesNegativeRotation = 0;
1167 // for values greater/equal zero:
1168 settings->_dataValuesAnchorPositivePosition = KDChartEnums::PosTopCenter;
1169 settings->_dataValuesAnchorPositiveAlign = TQt::AlignHCenter
1170 + (bShowOutside ? TQt::AlignBottom : TQt::AlignTop);
1171 settings->_dataValuesAnchorPositiveDeltaX = 0;
1172 settings->_dataValuesAnchorPositiveDeltaY = bShowOutside ? -20 : 35;
1173 settings->_dataValuesPositiveRotation = 0;
1174
1175 settings->_dataValuesLayoutPolicy = KDChartEnums::LayoutPolicyRotate;
1176 }
1177 break;
1178 case HiLo:
1179 case BoxWhisker:
1180 // settings are not defined here because HiLo and BW charts
1181 // are *not* set up using setPrintDataValues()
1182 // but by using their own methods
1183 break;
1184 case Pie: {
1185 if ( font )
1186 settings->_dataValuesFont = *font;
1187 else
1188 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Bold );
1189 settings->_dataValuesUseFontRelSize = true;
1190 settings->_dataValuesFontRelSize = 25;
1191 settings->_dataValuesAutoColor = true; // !!!
1192 settings->_dataValuesColor = TQColor( TQt::black );
1193 settings->_dataValuesBrush = TQBrush( TQt::NoBrush );
1194 // for values below zero:
1195 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosTopCenter;
1196 settings->_dataValuesAnchorNegativeAlign = TQt::AlignTop + TQt::AlignHCenter;
1197 settings->_dataValuesAnchorNegativeDeltaX = 0;
1198 settings->_dataValuesAnchorNegativeDeltaY = 50;
1199 settings->_dataValuesNegativeRotation = KDCHART_TANGENTIAL_ROTATION;
1200 // for values greater/equal zero:
1201 settings->_dataValuesAnchorPositivePosition = KDChartEnums::PosTopCenter;
1202 settings->_dataValuesAnchorPositiveAlign = TQt::AlignTop + TQt::AlignHCenter;
1203 settings->_dataValuesAnchorPositiveDeltaX = 0;
1204 settings->_dataValuesAnchorPositiveDeltaY = 50;
1205 settings->_dataValuesPositiveRotation = KDCHART_TANGENTIAL_ROTATION;
1206
1207 settings->_dataValuesLayoutPolicy = KDChartEnums::LayoutPolicyRotate;
1208 }
1209 break;
1210 case Ring: {
1211 if ( font )
1212 settings->_dataValuesFont = *font;
1213 else
1214 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Bold );
1215 settings->_dataValuesUseFontRelSize = true;
1216 settings->_dataValuesFontRelSize = 25;
1217 settings->_dataValuesAutoColor = true; // !!!
1218 settings->_dataValuesColor = TQColor( TQt::black );
1219 settings->_dataValuesBrush = TQBrush( TQt::NoBrush );
1220 // for values below zero:
1221 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosCenter;
1222 settings->_dataValuesAnchorNegativeAlign = TQt::AlignCenter;
1223 settings->_dataValuesAnchorNegativeDeltaX = 0;
1224 settings->_dataValuesAnchorNegativeDeltaY = 10;
1225 settings->_dataValuesNegativeRotation = KDCHART_TANGENTIAL_ROTATION;
1226 // for values greater/equal zero:
1227 settings->_dataValuesAnchorPositivePosition = KDChartEnums::PosCenter;
1228 settings->_dataValuesAnchorPositiveAlign = TQt::AlignCenter;
1229 settings->_dataValuesAnchorPositiveDeltaX = 0;
1230 settings->_dataValuesAnchorPositiveDeltaY = 10;
1231 settings->_dataValuesPositiveRotation = KDCHART_TANGENTIAL_ROTATION;
1232
1233 settings->_dataValuesLayoutPolicy = KDChartEnums::LayoutPolicyRotate;
1234 }
1235 break;
1236
1237 case Polar: {
1238 settings->_dataValuesFontRelSize = 18;
1239 if ( font )
1240 settings->_dataValuesFont = *font;
1241 else
1242 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Bold );
1243 settings->_dataValuesUseFontRelSize = true;
1244 settings->_dataValuesFontRelSize = 26;
1245 settings->_dataValuesAutoColor = polarMarker(); // !!!
1246 settings->_dataValuesColor = TQColor( TQt::black );
1247 settings->_dataValuesBrush = TQBrush( TQt::NoBrush );
1248
1249 // for values below zero:
1250 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosCenter;
1251 settings->_dataValuesAnchorNegativeAlign = TQt::AlignCenter;
1252 settings->_dataValuesAnchorNegativeDeltaX = 0;
1253 settings->_dataValuesAnchorNegativeDeltaY = 0;
1254 settings->_dataValuesNegativeRotation = 0;
1255 // for values greater/equal zero:
1256 settings->_dataValuesAnchorNegativePosition = KDChartEnums::PosCenter;
1257 settings->_dataValuesAnchorNegativeAlign = TQt::AlignCenter;
1258 settings->_dataValuesAnchorNegativeDeltaX = 0;
1259 settings->_dataValuesAnchorNegativeDeltaY = 0;
1260 settings->_dataValuesNegativeRotation = 0;
1261
1262 //settings->_dataValuesLayoutPolicy = KDChartEnums::LayoutPolicyShrinkFontSize;
1263 //settings->_dataValuesFontRelSize = 26;
1264 //setDefaultAxesTypes();
1265 //finished = false; // use build-in default params, see KDChartParams.h::setPrintDataValues()
1266 }
1267 break;
1268
1269 default: {
1270 tqDebug( "IMPLEMENTATION ERROR: Unknown chartType in setPrintDataValues()" );
1271 finished = false; // use build-in default params, see KDChartParams.h::setPrintDataValues()
1272 }
1273 }
1274 }
1275 if ( !finished ) {
1276 settings->_useDefaultFontParams = false;
1277
1278 if ( font )
1279 settings->_dataValuesFont = *font;
1280 else
1281 settings->_dataValuesFont = TQFont( "times", 1, TQFont::Bold );
1282
1283 uint theSize( UINT_MAX == size ? 14 : size );
1284 settings->_dataValuesUseFontRelSize = ( 0 < theSize );
1285 settings->_dataValuesFontRelSize = theSize;
1286 if ( KDCHART_DATA_VALUE_AUTO_COLOR == color
1287 && ( Polar != cType || polarMarker() ) ) {
1288 settings->_dataValuesAutoColor = true; // !!!
1289 settings->_dataValuesColor = TQColor( TQt::black );
1290 }
1291 else {
1292 settings->_dataValuesAutoColor = false;
1293 if ( 0 == color )
1294 settings->_dataValuesColor
1295 = TQColor( i ? TQt::darkBlue : TQt::black );
1296 else
1297 settings->_dataValuesColor = *color;
1298 }
1299 settings->_dataValuesBrush = TQBrush(TQt::NoBrush);
1300 // for values below zero:
1301 settings->_dataValuesAnchorNegativePosition = negativePosition;
1302 settings->_dataValuesAnchorNegativeAlign = negativeAlign;
1303 settings->_dataValuesAnchorNegativeDeltaX = negativeDeltaX;
1304 settings->_dataValuesAnchorNegativeDeltaY = negativeDeltaY;
1305 settings->_dataValuesNegativeRotation = negativeRotation;
1306 // for values greater/equal zero:
1307 settings->_dataValuesAnchorPositivePosition = positivePosition;
1308 settings->_dataValuesAnchorPositiveAlign = positiveAlign;
1309 settings->_dataValuesAnchorPositiveDeltaX = positiveDeltaX;
1310 settings->_dataValuesAnchorPositiveDeltaY = positiveDeltaY;
1311 settings->_dataValuesPositiveRotation = positiveRotation;
1312
1313 settings->_dataValuesLayoutPolicy = policy;
1314 }
1315 if ( 0 < chart )
1316 settings = &_printDataValuesSettings2;
1317 }
1318 emit changed();
1319}
1320
1321
1331
1332
1435 uint dataset,
1436 uint dataset2,
1437 uint chart )
1438{
1439 if ( KDCHART_NO_DATASET != dataset
1440 && KDCHART_ALL_DATASETS != dataset
1441 && KDCHART_ALL_DATASETS != dataset2 ) {
1442 uint i;
1443 uint last = ( KDCHART_NO_DATASET == dataset2 ) ? dataset : dataset2;
1444 for ( i = dataset; i <= last; ++i )
1445 _dataSourceModeAndChart[ i ] = ModeAndChart( mode, chart );
1446 _maxDatasetSourceMode = TQMAX( _maxDatasetSourceMode, --i );
1447 _setChartSourceModeWasUsed = true;
1448 } else if ( UnknownMode == mode && dataset == KDCHART_ALL_DATASETS ) {
1449 _dataSourceModeAndChart.clear();
1450 _setChartSourceModeWasUsed = false;
1451 }
1452
1453 emit changed();
1454}
1455
1456
1489 uint dataset2,
1490 uint* pChart ) const
1491{
1492 uint chart = KDCHART_UNKNOWN_CHART;
1493 SourceMode mode = UnknownMode;
1494
1495 if ( _setChartSourceModeWasUsed ) {
1496 if ( dataset <= _maxDatasetSourceMode
1497 && ( KDCHART_NO_DATASET == dataset2
1498 || dataset2 <= _maxDatasetSourceMode ) ) {
1499
1500 uint a, b;
1501 if ( KDCHART_ALL_DATASETS == dataset ) {
1502 a = 0;
1503 b = UINT_MAX;
1504 } else {
1505 a = dataset;
1506 b = KDCHART_NO_DATASET == dataset2 ? a : dataset2;
1507 }
1508
1509 bool bStart = true;
1510 ModeAndChartMap::ConstIterator it;
1511 for( it = _dataSourceModeAndChart.find( a );
1512 ( it != _dataSourceModeAndChart.end() ) && ( it.key() <= b );
1513 ++it ){
1514 if ( bStart ) {
1515 mode = it.data().mode();
1516 chart = it.data().chart();
1517 bStart = false;
1518 } else {
1519 if ( mode != it.data().mode() )
1520 mode = UnknownMode;
1521 if ( chart != it.data().chart() )
1522 chart = KDCHART_UNKNOWN_CHART;
1523 }
1524 }
1525 }
1526 } else {
1527 mode = DataEntry;
1528 chart = 0;
1529 }
1530 if ( pChart )
1531 * pChart = chart;
1532 return mode;
1533}
1534
1535
1565 uint& dataset,
1566 uint& dataset2,
1567 uint chart ) const
1568{
1569 bool res = false;
1570 dataset = KDCHART_NO_DATASET;
1571 dataset2 = KDCHART_NO_DATASET;
1572 if ( _setChartSourceModeWasUsed ) {
1573 bool bStart = true;
1574 ModeAndChartMap::ConstIterator it;
1575 for ( it = _dataSourceModeAndChart.begin();
1576 it != _dataSourceModeAndChart.end(); ++it ) {
1577 if ( ( it.data().mode() == mode )
1578 && ( ( KDCHART_ALL_CHARTS == chart )
1579 || ( it.data().chart() == chart ) ) ) {
1580 if ( bStart ) {
1581 dataset = it.key();
1582 bStart = false;
1583 }
1584 dataset2 = it.key();
1585 res = true;
1586 } else if ( !bStart )
1587 return res;
1588 }
1589 } else if ( DataEntry == mode ) {
1590 dataset = KDCHART_ALL_DATASETS;
1591 dataset2 = KDCHART_ALL_DATASETS;
1592 res = true;
1593 }
1594 return res;
1595}
1596
1597
1635 SourceMode modeB,
1636 uint& dataset,
1637 uint& dataset2,
1638 uint chart ) const
1639{
1640 bool res = false;
1641 dataset = KDCHART_NO_DATASET;
1642 dataset2 = KDCHART_NO_DATASET;
1643 uint dsA1, dsA2, dsB1, dsB2;
1644 bool foundA = findDataset( modeA, dsA1, dsA2, chart );
1645 bool foundB = findDataset( modeB, dsB1, dsB2, chart );
1646 if( foundA || foundB ){
1647 if( dsA1 == KDCHART_ALL_DATASETS || dsB1 == KDCHART_ALL_DATASETS ){
1648 dataset = KDCHART_ALL_DATASETS;
1649 dataset2 = KDCHART_ALL_DATASETS;
1650 res = true;
1651 }else{
1652 if( foundA && foundB ){
1653 if( TQMIN(dsA2, dsB2) + 1 == TQMAX(dsA1, dsB1) ){
1654 dataset = TQMIN(dsA1, dsB1);
1655 dataset2 = TQMAX(dsA2, dsB2);
1656 res = true;
1657 }else{
1658 tqDebug("ERROR in KDChartParams::findDatasets(): Datasets found are *not* a contiguous series.");
1659 }
1660 }else{
1661 dataset = foundA ? dsA1 : dsB1;
1662 dataset2 = foundA ? dsA2 : dsB2;
1663 res = true;
1664 }
1665 }
1666 }
1667 return res;
1668}
1669
1670
1688void KDChartParams::setDataColor( uint dataset, TQColor color )
1689{
1690 TQColor shadow1;
1691 TQColor shadow2;
1692 calculateShadowColors( color, shadow1, shadow2 );
1693 _dataColors[ dataset ] = color;
1694 _dataColorsShadow1[ dataset ] = shadow1;
1695 _dataColorsShadow2[ dataset ] = shadow2;
1696 _maxDatasetColor = TQMAX( _maxDatasetColor, dataset );
1697
1698 emit changed();
1699}
1700
1711{
1712 setDataColor( 0, red );
1713 setDataColor( 1, green );
1714 setDataColor( 2, blue );
1715 setDataColor( 3, cyan );
1716 setDataColor( 4, magenta );
1717 setDataColor( 5, yellow );
1718 setDataColor( 6, darkRed );
1719 setDataColor( 7, darkGreen );
1720 setDataColor( 8, darkBlue );
1721 setDataColor( 9, darkCyan );
1722 setDataColor( 10, darkMagenta );
1723 setDataColor( 11, darkYellow );
1724}
1725
1737{
1738 setDataColor( 0, TQColor(255, 0,196) );
1739 setDataColor( 1, TQColor(255, 0, 96) );
1740 setDataColor( 2, TQColor(255, 128,64) );
1741 setDataColor( 3, TQt::yellow );
1742 setDataColor( 4, TQt::green );
1743 setDataColor( 5, TQt::cyan );
1744 setDataColor( 6, TQColor( 96, 96,255) );
1745 setDataColor( 7, TQColor(160, 0,255) );
1746 for( int i=8; i<16; ++i )
1747 setDataColor( i, dataColor(i-8).light() );
1748}
1749
1767{
1768static const int NUM_SUBDUEDCOLORS = 18;
1769static const TQColor SUBDUEDCOLORS[ NUM_SUBDUEDCOLORS ] = {
1770 TQColor( 0xe0,0x7f,0x70 ),
1771 TQColor( 0xe2,0xa5,0x6f ),
1772 TQColor( 0xe0,0xc9,0x70 ),
1773 TQColor( 0xd1,0xe0,0x70 ),
1774 TQColor( 0xac,0xe0,0x70 ),
1775 TQColor( 0x86,0xe0,0x70 ),
1776 TQColor( 0x70,0xe0,0x7f ),
1777 TQColor( 0x70,0xe0,0xa4 ),
1778 TQColor( 0x70,0xe0,0xc9 ),
1779 TQColor( 0x70,0xd1,0xe0 ),
1780 TQColor( 0x70,0xac,0xe0 ),
1781 TQColor( 0x70,0x86,0xe0 ),
1782 TQColor( 0x7f,0x70,0xe0 ),
1783 TQColor( 0xa4,0x70,0xe0 ),
1784 TQColor( 0xc9,0x70,0xe0 ),
1785 TQColor( 0xe0,0x70,0xd1 ),
1786 TQColor( 0xe0,0x70,0xac ),
1787 TQColor( 0xe0,0x70,0x86 ),
1788};
1789 if( ordered )
1790 for(int i=0; i<NUM_SUBDUEDCOLORS; ++i)
1791 setDataColor( i, SUBDUEDCOLORS[i] );
1792 else{
1793 setDataColor( 0, SUBDUEDCOLORS[ 0] );
1794 setDataColor( 1, SUBDUEDCOLORS[ 5] );
1795 setDataColor( 2, SUBDUEDCOLORS[10] );
1796 setDataColor( 3, SUBDUEDCOLORS[15] );
1797 setDataColor( 4, SUBDUEDCOLORS[ 2] );
1798 setDataColor( 5, SUBDUEDCOLORS[ 7] );
1799 setDataColor( 6, SUBDUEDCOLORS[12] );
1800 setDataColor( 7, SUBDUEDCOLORS[17] );
1801 setDataColor( 8, SUBDUEDCOLORS[ 4] );
1802 setDataColor( 9, SUBDUEDCOLORS[ 9] );
1803 setDataColor(10, SUBDUEDCOLORS[14] );
1804 setDataColor(11, SUBDUEDCOLORS[ 1] );
1805 setDataColor(12, SUBDUEDCOLORS[ 6] );
1806 setDataColor(13, SUBDUEDCOLORS[11] );
1807 setDataColor(14, SUBDUEDCOLORS[16] );
1808 setDataColor(15, SUBDUEDCOLORS[ 3] );
1809 setDataColor(16, SUBDUEDCOLORS[ 8] );
1810 setDataColor(17, SUBDUEDCOLORS[13] );
1811 }
1812}
1813
1814
1815void KDChartParams::calculateShadowColors( TQColor color,
1816 TQColor& shadow1,
1817 TQColor& shadow2 ) const
1818{
1819 if ( !color.isValid() ) { // no fill color
1820 shadow1 = TQColor();
1821 shadow2 = TQColor();
1822 } else {
1823 int hue, saturation, value;
1824 color.hsv( &hue, &saturation, &value );
1825 double v = value;
1826 v = v * 2.0 / 3.0 * shadowBrightnessFactor();
1827 if ( 255.0 < v )
1828 v = 255.0;
1829 else if ( 1.0 > v )
1830 v = 0.0;
1831 shadow1.setHsv( hue, saturation, static_cast < int > ( v ) );
1832 v = value;
1833 v = v / 3.0 * shadowBrightnessFactor();
1834 if ( 255.0 < v )
1835 v = 255.0;
1836 else if ( 1.0 > v )
1837 v = 0.0;
1838 shadow2.setHsv( hue, saturation, static_cast < int > ( v ) );
1839 }
1840}
1841
1842
1854TQColor KDChartParams::dataColor( uint dataset ) const
1855{
1856 uint index = dataset % (_maxDatasetColor+1);
1857 if( _dataColors.find( index ) != _dataColors.end() )
1858 return _dataColors[ index ];
1859 else
1860 return TQColor(); // documentation says undefined
1861}
1862
1863
1864TQString KDChartParams::dataRegionFrameAreaName( uint dataRow,
1865 uint dataCol,
1866 uint data3rd )
1867{
1868 return TQString( "%1/%2/%3/%4" )
1869 .arg( KDChartEnums::AreaChartDataRegion, 5 )
1870 .arg( dataRow, 5 )
1871 .arg( dataCol, 5 )
1872 .arg( data3rd, 5 );
1873}
1874
1875
1883void KDChartParams::recomputeShadowColors()
1884{
1885 // Simply reassign the available colors; this will trigger
1886 // recomputation of the shadow colors.
1887 for( TQMap<uint,TQColor>::Iterator it = _dataColors.begin();
1888 it != _dataColors.end(); ++it ) {
1889 setDataColor( it.key(), it.data() );
1890 }
1891}
1892
1893
1894
1895
1909TQColor KDChartParams::dataShadow1Color( uint dataset ) const
1910{
1911 uint index = dataset % _maxDatasetColor;
1912 if ( _threeDShadowColors )
1913 if( _dataColorsShadow1.find( index ) != _dataColorsShadow1.end() )
1914 return _dataColorsShadow1[ index ];
1915 else
1916 return TQColor(); // documentation says undefined
1917 else
1918 if( _dataColors.find( index ) != _dataColors.end() )
1919 return _dataColors[ index ];
1920 else
1921 return TQColor(); // documentation says undefined
1922}
1923
1924
1938TQColor KDChartParams::dataShadow2Color( uint dataset ) const
1939{
1940 uint index = dataset % _maxDatasetColor;
1941 if ( _threeDShadowColors )
1942 if( _dataColorsShadow2.find( index ) != _dataColorsShadow2.end() )
1943 return _dataColorsShadow2[ index ];
1944 else
1945 return TQColor(); // documentation says undefined
1946 else
1947 if( _dataColors.find( index ) != _dataColors.end() )
1948 return _dataColors[ index ];
1949 else
1950 return TQColor(); // documentation says undefined
1951}
1952
1953
1966{
1967 // reset types of all axes
1968 uint i = 0;
1969 for ( i = 0; i < KDCHART_MAX_AXES; ++i )
1970 setAxisType( i, KDChartAxisParams::AxisTypeUnknown );
1971
1972 // Note that abscissa axes should start labeling at the very
1973 // first position and end at the last position when drawing
1974 // area charts.
1975 // Bar charts and line charts look better with their abscissa labels
1976 // in the respective middle positions below each bar (or point, resp.)
1977 for ( i = KDChartAxisParams::AxisPosSTART;
1978 i <= KDChartAxisParams::AxisPosEND; ++i )
1979 switch ( i ) {
1980 // abscissa axes:
1981 case KDChartAxisParams::AxisPosBottom:
1982 case KDChartAxisParams::AxisPosTop:
1983 case KDChartAxisParams::AxisPosBottom2:
1984 case KDChartAxisParams::AxisPosTop2:
1985 setAxisLabelsTouchEdges( i, Area == chartType() );
1986 break;
1987 // ordinate axes:
1988 case KDChartAxisParams::AxisPosLeft:
1989 case KDChartAxisParams::AxisPosRight:
1990 case KDChartAxisParams::AxisPosLeft2:
1991 case KDChartAxisParams::AxisPosRight2:
1992 setAxisLabelsTouchEdges( i, true ); //Polar != chartType() );
1993 break;
1994 // additional axes for charts representing 3-dimensional data:
1995 case KDChartAxisParams::AxisPosLowerRightEdge:
1996 case KDChartAxisParams::AxisPosLowerLeftEdge:
1997 case KDChartAxisParams::AxisPosLowerRightEdge2:
1998 case KDChartAxisParams::AxisPosLowerLeftEdge2:
1999 setAxisLabelsTouchEdges( i, false );
2000 break;
2001 default: {
2002 tqDebug( "IMPLEMENTATION ERROR: axis type missing in KDChartParams::setDefaultAxesTypes()" );
2003 Q_ASSERT( !this );
2004 }
2005 }
2006
2007 // set default axis types according to chart type
2008 switch ( chartType() ) {
2009 case NoType:
2010 break;
2011 case Bar:
2012 case Line:
2013 case Area:
2014 // default axes
2015 setAxisType( KDChartAxisParams::AxisPosBottom,
2016 KDChartAxisParams::AxisTypeEAST );
2017 setAxisShowGrid( KDChartAxisParams::AxisPosBottom,
2018 true );
2019 setAxisType( KDChartAxisParams::AxisPosLeft,
2020 KDChartAxisParams::AxisTypeNORTH );
2021 setAxisShowGrid( KDChartAxisParams::AxisPosLeft,
2022 true );
2023 // 'other side' axes
2024 setAxisType( KDChartAxisParams::AxisPosTop,
2025 KDChartAxisParams::AxisTypeEAST );
2026 setAxisType( KDChartAxisParams::AxisPosRight,
2027 KDChartAxisParams::AxisTypeNORTH );
2028 // additional, 2nd axes
2029 setAxisType( KDChartAxisParams::AxisPosBottom2,
2030 KDChartAxisParams::AxisTypeEAST );
2031 setAxisType( KDChartAxisParams::AxisPosLeft2,
2032 KDChartAxisParams::AxisTypeNORTH );
2033 // additional, 2nd axes for 'other' sides
2034 setAxisType( KDChartAxisParams::AxisPosTop2,
2035 KDChartAxisParams::AxisTypeEAST );
2036 setAxisType( KDChartAxisParams::AxisPosRight2,
2037 KDChartAxisParams::AxisTypeNORTH );
2038
2039 // Specify default numbering information
2040 // for all 'non-ordinate' axes (this are the X axes):
2041 //
2042 // axisSteadyValueCalc flag is set to false
2043 // Start value 1
2044 // End value following the number of entries
2045 // in the associated dataset(s)
2046 // Delta value 1.0
2047 // and dont show any Digits behind the comma.
2048 setAxisLabelTextParams( KDChartAxisParams::AxisPosBottom, false,
2049 1.0,
2051 1.0, 0 );
2052 setAxisLabelTextParams( KDChartAxisParams::AxisPosTop, false,
2053 1.0,
2055 1.0, 0 );
2056 setAxisLabelTextParams( KDChartAxisParams::AxisPosBottom2, false,
2057 1.0,
2059 1.0, 0 );
2060 setAxisLabelTextParams( KDChartAxisParams::AxisPosTop2, false,
2061 1.0,
2063 1.0, 0 );
2064
2065 // no need to specify numbering information for
2066 // the ordinate-axes since the default auto-calc
2067 // feature is fine for here.
2068
2069 break;
2070
2071 // Code for charts representing 3-dimensional data.
2072
2073 /*
2074
2075 // ( not active since there are no such charts yet )
2076
2077 case KDChartParams::BarMatrix:
2078 // default axes
2079 setAxisType( KDChartAxisParams::AxisPosBottom,
2080 KDChartAxisParams::AxisTypeEAST );
2081 setAxisType( KDChartAxisParams::AxisPosLowerRightEdge,
2082 KDChartAxisParams::AxisTypeNORTH );
2083 setAxisType( KDChartAxisParams::AxisPosLeft,
2084 KDChartAxisParams::AxisTypeUP );
2085 // 'other side' axes
2086 setAxisType( KDChartAxisParams::AxisPosTop,
2087 KDChartAxisParams::AxisTypeEAST );
2088 setAxisType( KDChartAxisParams::AxisPosLowerLeftEdge,
2089 KDChartAxisParams::AxisTypeNORTH );
2090 setAxisType( KDChartAxisParams::AxisPosRight,
2091 KDChartAxisParams::AxisTypeUP );
2092 // additional, 2nd axes
2093 setAxisType( KDChartAxisParams::AxisPosBottom2,
2094 KDChartAxisParams::AxisTypeEAST );
2095 setAxisType( KDChartAxisParams::AxisPosLowerRightEdge2,
2096 KDChartAxisParams::AxisTypeNORTH );
2097 setAxisType( KDChartAxisParams::AxisPosLeft2,
2098 KDChartAxisParams::AxisTypeUP );
2099 // additional, 2nd axes for 'other' sides
2100 setAxisType( KDChartAxisParams::AxisPosTop2,
2101 KDChartAxisParams::AxisTypeEAST );
2102 setAxisType( KDChartAxisParams::AxisPosLowerLeftEdge2,
2103 KDChartAxisParams::AxisTypeNORTH );
2104 setAxisType( KDChartAxisParams::AxisPosRight2,
2105 KDChartAxisParams::AxisTypeUP );
2106
2107 // Specify default numbering information
2108 // for all 'non-ordinate' axes (this are the X and the Y axes):
2109 // Start vaule 1
2110 // End value following the number of entries
2111 // in the associated dataset(s)
2112 // Delta value 1.0
2113 // and don't show any Digits behind the comma.
2114 setAxisLabelTextParams( KDChartAxisParams::AxisPosBottom, false,
2115 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2116 setAxisLabelTextParams( KDChartAxisParams::AxisPosTop, false,
2117 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2118 setAxisLabelTextParams( KDChartAxisParams::AxisPosLowerRightEdge,
2119 false,
2120 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2121 setAxisLabelTextParams( KDChartAxisParams::AxisPosLowerLeftEdge,
2122 false,
2123 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2124 setAxisLabelTextParams( KDChartAxisParams::AxisPosBottom2, false,
2125 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2126 setAxisLabelTextParams( KDChartAxisParams::AxisPosTop2, false,
2127 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2128 setAxisLabelTextParams(KDChartAxisParams::AxisPosLowerRightEdge2,
2129 false,
2130 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2131 setAxisLabelTextParams( KDChartAxisParams::AxisPosLowerLeftEdge2,
2132 false,
2133 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2134
2135 false,
2136 1.0, KDCHART_AXIS_LABELS_AUTO_LIMIT, 1.0, 0 );
2137
2138 // no need to specify numbering information for
2139 // the ordinate-axes since the default auto-calc
2140 // feature is fine for here.
2141
2142 break;
2143 */
2144
2145 case KDChartParams::Pie:
2146 case KDChartParams::Ring:
2147 // by default there are no axes defined for pie and ring charts
2148 break;
2149 case KDChartParams::Polar:
2150 setAxisType( KDChartAxisParams::AxisPosSaggital,
2151 KDChartAxisParams::AxisTypeEAST );
2152 setAxisType( KDChartAxisParams::AxisPosCircular,
2153 KDChartAxisParams::AxisTypeNORTH );
2154 setAxisLabelsVisible( KDChartAxisParams::AxisPosSaggital, true );
2155 setAxisLabelsFont( KDChartAxisParams::AxisPosSaggital,
2156 TQFont( "helvetica", 1, TQFont::Bold ),
2157 -30,
2158 TQt::darkBlue );
2159 setAxisLabelsVisible( KDChartAxisParams::AxisPosCircular, true );
2160 setAxisLabelsFont( KDChartAxisParams::AxisPosCircular,
2161 TQFont( "helvetica", 1, TQFont::Bold ),
2162 -22,
2163 TQt::darkBlue );
2165 break;
2166 default: {
2167 tqDebug( "IMPLEMENTATION ERROR: type missing in KDChartParams::setDefaultAxesTypes()" );
2168 Q_ASSERT( !this );
2169 }
2170 }
2171
2172 emit changed();
2173}
2174
2175
2183{
2184 // deactivate all axes: specifying KDCHART_NO_DATASET will
2185 // also remove their visability flag
2186 for ( uint i = 0; i < KDCHART_MAX_AXES; ++i )
2187 setAxisDatasets( i, KDCHART_NO_DATASET );
2188
2189 switch ( chartType() ) {
2190 case NoType:
2191 break;
2192 case Bar:
2193 case Line:
2194 case Area:
2195 setAxisVisible( KDChartAxisParams::AxisPosBottom, true );
2196 setAxisDatasets( KDChartAxisParams::AxisPosBottom, KDCHART_ALL_DATASETS );
2197 setAxisVisible( KDChartAxisParams::AxisPosLeft, true );
2198 setAxisDatasets( KDChartAxisParams::AxisPosLeft, KDCHART_ALL_DATASETS );
2199 /* test:
2200 setAxisVisible( KDChartAxisParams::AxisPosTop, true );
2201 setAxisDatasets(KDChartAxisParams::AxisPosTop, KDCHART_ALL_DATASETS );
2202 setAxisVisible( KDChartAxisParams::AxisPosRight, true );
2203 setAxisDatasets(KDChartAxisParams::AxisPosRight, KDCHART_ALL_DATASETS );
2204
2205 setAxisVisible( KDChartAxisParams::AxisPosBottom2, true );
2206 setAxisDatasets(KDChartAxisParams::AxisPosBottom2, KDCHART_ALL_DATASETS );
2207 setAxisVisible( KDChartAxisParams::AxisPosLeft2, true );
2208 setAxisDatasets(KDChartAxisParams::AxisPosLeft2, KDCHART_ALL_DATASETS );
2209
2210 setAxisVisible( KDChartAxisParams::AxisPosTop2, true );
2211 setAxisDatasets(KDChartAxisParams::AxisPosTop2, KDCHART_ALL_DATASETS );
2212 setAxisVisible( KDChartAxisParams::AxisPosRight2, true );
2213 setAxisDatasets(KDChartAxisParams::AxisPosRight2, KDCHART_ALL_DATASETS );
2214 */
2215 break;
2216 // Code for charts representing 3-dimensional data.
2217
2218 /*
2219
2220 // ( not active since there are no such charts yet )
2221
2222 case KDChartParams::BarMatrix:
2223 setAxisVisible( KDChartAxisParams::AxisPosBottom, true );
2224 setAxisDatasets(KDChartAxisParams::AxisPosBottom, KDCHART_ALL_DATASETS );
2225 setAxisVisible( KDChartAxisParams::AxisPosLeft, true );
2226 setAxisDatasets(KDChartAxisParams::AxisPosLeft, KDCHART_ALL_DATASETS );
2227 setAxisVisible( KDChartAxisParams::AxisPosLowerRightEdge, true );
2228 setAxisDatasets(KDChartAxisParams::AxisPosLowerRightEdge,
2229 KDCHART_ALL_DATASETS);
2230 break;
2231 */
2232 case KDChartParams::Pie:
2233 case KDChartParams::Ring:
2234 case KDChartParams::Polar:
2235 // by default there are no axes defined for pie, ring, and polar charts
2236 break;
2237 default: {
2238 tqDebug( "IMPLEMENTATION ERROR: type missing in KDChartParams::activateDefaultAxes()" );
2239 Q_ASSERT( !this );
2240 }
2241 }
2242}
2243
2244
2245
2246
2247
2248
2249
2250
2267
2268
2277
2278
2290void KDChartParams::setGlobalLeading( int left, int top, int right, int bottom )
2291{
2292 _globalLeadingLeft = left;
2293 _globalLeadingTop = top;
2294 _globalLeadingRight = right;
2295 _globalLeadingBottom = bottom;
2296 emit changed();
2297}
2298
2299
2313
2314
2328
2329
2343
2344
2358
2359
2372
2373
2386
2387
2400
2401
2414
2415
2447
2497
2498
2537
2538
2561 uint oldDataCol,
2562 uint, // important: we ignore the data3rd parameter for now!
2563 uint newDataRow,
2564 uint newDataCol,
2565 uint// important: we ignore the data3rd parameter for now!
2566 )
2567{
2568 const TQString oldKey( dataRegionFrameAreaName( oldDataRow, oldDataCol, 0 ) ); // oldData3rd ) );
2569 KDChartFrameSettings* it = _areaDict.find( oldKey );
2570 bool bFound = ( it != 0 );
2571 if( bFound ){
2572 if( KDCHART_NO_DATASET != newDataRow ){
2574 KDChartFrameSettings::deepCopy( *frame, *it );
2575 frame->setDataRow( newDataRow );
2576 frame->setDataCol( newDataCol );
2577 frame->setData3rd( 0 ); // newData3rd );
2578 _areaDict.setAutoDelete( true );
2579 _areaDict.replace(
2580 dataRegionFrameAreaName( newDataRow, newDataCol, 0 ), //data3rd 5 ),
2581 frame );
2582 }
2583 _areaDict.remove( oldKey );
2584 emit changed();
2585 }
2586 return bFound;
2587}
2588
2594
2601 bool& bFound,
2602 int* pIterIdx ) const
2603{
2604 if( pIterIdx )
2605 *pIterIdx = 0;
2606 const TQString key( TQString( "%1/-----/-----/-----" ).arg( area, 5 ) );
2607 KDChartFrameSettings* it = _areaDict.find( key );
2608 bFound = ( it != 0 );
2609 if( bFound )
2610 return it;
2611 else if( pIterIdx ){
2612 TQString keyStart( key.left(6) );
2613 TQDictIterator<KDChartFrameSettings> it2( _areaDict );
2614 for( ; it2.current(); ++it2 ){
2615 if( it2.currentKey().startsWith( keyStart ) ){
2616 bFound = true;
2617 return it2.current();
2618 }
2619 ++*pIterIdx;
2620 }
2621 }
2622 return &_noFrameSettings;
2623}
2624
2625
2639{
2640 return _areaDict.remove( TQString( "%1/-----/-----/-----" ).arg( area, 5 ) );
2641}
2642
2643
2652 int* pIterIdx ) const
2653{
2654 bFound = false;
2655 if( pIterIdx ){
2656 int i=0;
2657 TQDictIterator<KDChartFrameSettings> it( _areaDict );
2658 for( ; it.current(); ++it ){
2659 if( *pIterIdx == i )
2660 break;
2661 ++i;
2662 }
2663 if( *pIterIdx == i ){
2664 TQString keyStart( it.currentKey().left(6) );
2665 ++it;
2666 for( ; it.current(); ++it ){
2667 ++*pIterIdx;
2668 if( it.currentKey().startsWith( keyStart ) ){
2669 bFound = true;
2670 return it.current();
2671 }
2672 }
2673 }
2674 }
2675 return &_noFrameSettings;
2676}
2677
2678
2687{
2688 _customBoxDict.setAutoDelete( true );
2689 uint newIdx;
2690 if( _customBoxDictMayContainHoles ){
2691 _customBoxDictMayContainHoles = false;
2692 const uint maxIndex = maxCustomBoxIdx();
2693 newIdx = 1 + maxIndex;
2694 for( uint idx = 0; idx <= maxIndex; ++idx ) {
2695 if( ! _customBoxDict.find( idx ) ) {
2696 newIdx = idx;
2697 _customBoxDictMayContainHoles = true; // we found a hole, so there might be more of them
2698 break;
2699 }
2700 }
2701 }else{
2702 newIdx = _customBoxDict.count();
2703 }
2704 _customBoxDict.insert( newIdx, box.clone() );
2705 emit changed();
2706 return newIdx;
2707}
2708
2709
2722bool KDChartParams::removeCustomBox( const uint & idx )
2723{
2724 const bool bFound = _customBoxDict.remove( idx );
2725 if( bFound ){
2726 // also remove any frame, that was attached to this box
2727 removeFrame( KDChartEnums::AreaCustomBoxesBASE + idx );
2728 }
2729 _customBoxDictMayContainHoles = true;
2730 emit changed();
2731 return bFound;
2732}
2733
2734
2741
2742
2754{
2755 return _customBoxDict.find( box );
2756}
2757
2772{
2773 return _customBoxDict.find( box );
2774}
2775
2782{
2783 uint cnt( _customBoxDict.count() );
2784 if( cnt ) {
2785 int maxIndex = cnt-1;
2786 TQIntDictIterator<KDChartCustomBox> it( _customBoxDict );
2787 for( ; it.current(); ++it )
2788 if( it.currentKey() > maxIndex )
2789 maxIndex = it.currentKey();
2790 return maxIndex;
2791 }
2792 return 0;
2793}
2794
2804
2805
2842{
2843 _chartType = chartType;
2844
2845 // de-activate 2nd axis that might have been set automatically
2846 // by a previous call of \c setAdditionalChartType()
2847 setAxisVisible( KDChartAxisParams::AxisPosRight, false );
2848
2849 // Make sure abscissa axes start their labeling at the very
2850 // first position and end at the last position when drawing
2851 // area charts.
2852 // Bar charts and line charts look better with their abscissa labels
2853 // in the respective middle positions below each bar (or point, resp.)
2854 bool bAbscissaAxisLabelsTouchEdges = ( Area == chartType );
2855 setAxisLabelsTouchEdges( KDChartAxisParams::AxisPosBottom,
2856 bAbscissaAxisLabelsTouchEdges );
2857 setAxisLabelsTouchEdges( KDChartAxisParams::AxisPosTop,
2858 bAbscissaAxisLabelsTouchEdges );
2859 setAxisLabelsTouchEdges( KDChartAxisParams::AxisPosBottom2,
2860 bAbscissaAxisLabelsTouchEdges );
2861 setAxisLabelsTouchEdges( KDChartAxisParams::AxisPosTop2,
2862 bAbscissaAxisLabelsTouchEdges );
2863 // activate default data value text settings for this chart type
2864 if ( printDataValues( 0 )
2866 setPrintDataValues( true, 0 );
2867 emit changed();
2868}
2869
2870
2884
2885
2886
2985{
2986 _additionalChartType = chartType;
2987 if ( KDChartParams::NoType == chartType ) {
2988 setAxisDatasets( KDChartAxisParams::AxisPosRight,
2989 KDCHART_NO_DATASET );
2990 } else {
2991 setAxisDatasets( KDChartAxisParams::AxisPosRight,
2992 KDCHART_ALL_DATASETS,
2993 KDCHART_ALL_DATASETS,
2994 1 );
2995 if( printDataValues( 1 )
2997 setPrintDataValues( true, 1 );
2998 }
2999 emit changed();
3000}
3001
3002
3014
3015
3016
3022
3023
3024
3025
3036
3046
3056
3057
3073
3074
3087
3088
3101
3102
3115
3127
3128
3137
3138
3150
3151
3160
3161
3173
3174
3183
3184
3195
3196
3208
3209
3221
3222
3233
3234
3245
3246
3258 int digitsBehindComma,
3259 uint chart )
3260{
3261 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3262 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3263 ? &_printDataValuesSettings
3264 : &_printDataValuesSettings2;
3265 for ( uint i = 0; i < count; ++i ) {
3266 settings->_divPow10 = divPow10;
3267 settings->_digitsBehindComma = digitsBehindComma;
3268 if ( 0 < chart )
3269 settings = &_printDataValuesSettings2;
3270 }
3271 emit changed();
3272}
3273
3285 uint size,
3286 uint chart )
3287{
3288 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3289 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3290 ? &_printDataValuesSettings
3291 : &_printDataValuesSettings2;
3292 for ( uint i = 0; i < count; ++i ) {
3293 settings->_useDefaultFontParams = false;
3294 if( font )
3295 settings->_dataValuesFont = *font;
3296 if( UINT_MAX != size ){
3297 settings->_dataValuesUseFontRelSize = ( 0 < size );
3298 settings->_dataValuesFontRelSize = size;
3299 }
3300 if ( 0 < chart )
3301 settings = &_printDataValuesSettings2;
3302 }
3303 emit changed();
3304}
3305
3317 uint align,
3318 int deltaX,
3319 int deltaY,
3320 int rotation,
3321 bool specifyingPositiveValues,
3322 uint chart )
3323{
3324 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3325 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3326 ? &_printDataValuesSettings
3327 : &_printDataValuesSettings2;
3328 for ( uint i = 0; i < count; ++i ) {
3329 if( specifyingPositiveValues ){
3330 // for values greater/equal zero:
3331 settings->_dataValuesAnchorPositivePosition = position;
3332 settings->_dataValuesAnchorPositiveAlign = align;
3333 settings->_dataValuesAnchorPositiveDeltaX = deltaX;
3334 settings->_dataValuesAnchorPositiveDeltaY = deltaY;
3335 settings->_dataValuesPositiveRotation = rotation;
3336 }else{
3337 // for values below zero:
3338 settings->_dataValuesAnchorNegativePosition = position;
3339 settings->_dataValuesAnchorNegativeAlign = align;
3340 settings->_dataValuesAnchorNegativeDeltaX = deltaX;
3341 settings->_dataValuesAnchorNegativeDeltaY = deltaY;
3342 settings->_dataValuesNegativeRotation = rotation;
3343 }
3344 if ( 0 < chart )
3345 settings = &_printDataValuesSettings2;
3346 }
3347 emit changed();
3348}
3349
3373void KDChartParams::setDataValuesColors( const TQColor* color,
3374 const TQBrush& background,
3375 uint chart )
3376{
3377 // first store the color
3378 if( color )
3379 setPrintDataValuesColor( chart, color );
3380 // now store the background
3381 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3382 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3383 ? &_printDataValuesSettings
3384 : &_printDataValuesSettings2;
3385 for ( uint i = 0; i < count; ++i ) {
3386 settings->_dataValuesBrush = background;
3387 if ( 0 < chart )
3388 settings = &_printDataValuesSettings2;
3389 }
3390 emit changed();
3391}
3392
3393
3394/* sorry, but policy handling is not implemnted yet: */
3395void KDChartParams::setDataValuesPolicy(
3397 uint chart )
3398{
3399 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3400 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3401 ? &_printDataValuesSettings
3402 : &_printDataValuesSettings2;
3403 for ( uint i = 0; i < count; ++i ) {
3404 settings->_dataValuesLayoutPolicy = policy;
3405 if ( 0 < chart )
3406 settings = &_printDataValuesSettings2;
3407 }
3408 emit changed();
3409}
3410
3411
3424void KDChartParams::setDataValuesShowInfinite( bool dataValuesShowInfinite,
3425 uint chart)
3426{
3427 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3428 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3429 ? &_printDataValuesSettings
3430 : &_printDataValuesSettings2;
3431 for ( uint i = 0; i < count; ++i ) {
3432 settings->_dataValuesShowInfinite = dataValuesShowInfinite;
3433 if ( 0 < chart )
3434 settings = &_printDataValuesSettings2;
3435 }
3436 emit changed();
3437}
3438
3439
3440/* function only there for backward compatibility */
3441void KDChartParams::setPrintDataValuesColor( uint chart, const TQColor* color )
3442{
3443 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3444 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3445 ? &_printDataValuesSettings
3446 : &_printDataValuesSettings2;
3447 for ( uint i = 0; i < count; ++i ) {
3448 if ( KDCHART_DATA_VALUE_AUTO_COLOR == color ) {
3449 settings->_dataValuesAutoColor = true; // !!!
3450 settings->_dataValuesColor = TQColor( TQt::black );
3451 }
3452 else {
3453 settings->_dataValuesAutoColor = false;
3454 if ( 0 == color )
3455 settings->_dataValuesColor
3456 = TQColor( i ? TQt::darkBlue : TQt::black );
3457 else
3458 settings->_dataValuesColor = *color;
3459 }
3460 if ( 0 < chart )
3461 settings = &_printDataValuesSettings2;
3462 }
3463 emit changed();
3464}
3465
3466
3479{
3480 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3481 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3482 ? &_printDataValuesSettings
3483 : &_printDataValuesSettings2;
3484 uint theSize( UINT_MAX == size ? 16 : size );
3485 for ( uint i = 0; i < count; ++i ) {
3486 settings->_dataValuesUseFontRelSize = ( 0 < theSize );
3487 settings->_dataValuesFontRelSize = theSize;
3488 if ( 0 < chart )
3489 settings = &_printDataValuesSettings2;
3490 }
3491 emit changed();
3492}
3493
3494
3514 bool callSetPrintDataValues )
3515{
3516 uint count = (KDCHART_ALL_CHARTS == chart) ? 2 : 1;
3517 PrintDataValuesSettings * settings = (( 1 < count ) || ( 0 == chart ))
3518 ? &_printDataValuesSettings
3519 : &_printDataValuesSettings2;
3520 for ( uint i = 0; i < count; ++i ) {
3521 settings->_printDataValues = true;
3522 settings->_useDefaultFontParams = true;
3523 if ( 0 < chart )
3524 settings = &_printDataValuesSettings2;
3525 }
3526 if ( callSetPrintDataValues )
3527 setPrintDataValues( true, chart );
3528}
3529
3530
3544
3545
3561
3562
3576
3577
3593
3594
3612
3613
3629
3630
3647
3648
3666{
3667 if ( negative )
3668 return chart ? _printDataValuesSettings2._dataValuesAnchorNegativePosition
3669 : _printDataValuesSettings._dataValuesAnchorNegativePosition;
3670 else
3671 return chart ? _printDataValuesSettings2._dataValuesAnchorPositivePosition
3672 : _printDataValuesSettings._dataValuesAnchorPositivePosition;
3673}
3674
3675
3694uint KDChartParams::dataValuesAnchorAlign( uint chart, bool negative ) const
3695{
3696 if ( negative )
3697 return chart ? _printDataValuesSettings2._dataValuesAnchorNegativeAlign
3698 : _printDataValuesSettings._dataValuesAnchorNegativeAlign;
3699 else
3700 return chart ? _printDataValuesSettings2._dataValuesAnchorPositiveAlign
3701 : _printDataValuesSettings._dataValuesAnchorPositiveAlign;
3702}
3703
3704
3726int KDChartParams::dataValuesAnchorDeltaX( uint chart, bool negative ) const
3727{
3728 if ( negative )
3729 return chart ? _printDataValuesSettings2._dataValuesAnchorNegativeDeltaX
3730 : _printDataValuesSettings._dataValuesAnchorNegativeDeltaX;
3731 else
3732 return chart ? _printDataValuesSettings2._dataValuesAnchorPositiveDeltaX
3733 : _printDataValuesSettings._dataValuesAnchorPositiveDeltaX;
3734}
3735
3736
3758int KDChartParams::dataValuesAnchorDeltaY( uint chart, bool negative ) const
3759{
3760 if ( negative )
3761 return chart ? _printDataValuesSettings2._dataValuesAnchorNegativeDeltaY
3762 : _printDataValuesSettings._dataValuesAnchorNegativeDeltaY;
3763 else
3764 return chart ? _printDataValuesSettings2._dataValuesAnchorPositiveDeltaY
3765 : _printDataValuesSettings._dataValuesAnchorPositiveDeltaY;
3766}
3767
3768
3786int KDChartParams::dataValuesRotation( uint chart, bool negative ) const
3787{
3788 if ( negative )
3789 return chart ? _printDataValuesSettings2._dataValuesNegativeRotation
3790 : _printDataValuesSettings._dataValuesNegativeRotation;
3791 else
3792 return chart ? _printDataValuesSettings2._dataValuesPositiveRotation
3793 : _printDataValuesSettings._dataValuesPositiveRotation;
3794}
3795
3796
3820
3826
3836
3859
3914
3974
4079
4080
4081
4083// END GENERAL
4084
4085// START BARCHART
4091
4099
4100
4110
4111
4122
4123
4124
4135
4136
4148
4163
4179
4180
4195{
4196 if ( angle > 90 ) /* since angle is an uint, we do not need to
4197 test for < 0 */
4198 return ;
4199 _threeDBarAngle = angle;
4200
4201 // cache the cosine of this value
4202 _cosThreeDBarAngle = cos( static_cast < double > ( _threeDBarAngle ) * M_PI / 180.0 );
4203 emit changed();
4204}
4205
4206
4219
4220
4234
4235
4251
4252
4266
4267
4290
4291
4307
4308
4321
4322
4335
4336
4375
4376
4392
4393
4427
4445
4470
4496
4509
4510
4524
4525
4549
4550
4563
4564
4566// END BARCHART
4567
4568// START LINECHART
4574
4582
4583
4593
4594
4604
4605
4606
4623
4624
4634
4635
4641
4642
4665{
4666 _lineMarkerStyles[ dataset ] = style;
4667 _maxDatasetLineMarkerStyle = TQMAX( dataset,
4668 _maxDatasetLineMarkerStyle );
4669 emit changed();
4670}
4671
4681{
4682 if( _lineMarkerStyles.find( dataset ) != _lineMarkerStyles.end() )
4683 return _lineMarkerStyles[ dataset ];
4684 else
4685 return LineMarkerCircle; // default
4686}
4687
4688
4689
4690
4697
4698
4710 _lineMarkerStyles = map;
4711 // update _maxDatasetLineMarkerStyle
4712 uint maxDataset = 0;
4713 for( LineMarkerStyleMap::ConstIterator it = _lineMarkerStyles.begin();
4714 it != _lineMarkerStyles.end(); ++it )
4715 maxDataset = TQMAX( maxDataset, it.key() );
4716 _maxDatasetLineMarkerStyle = maxDataset;
4717}
4718
4719
4730
4731
4743
4744
4760
4761
4771
4772
4792
4793
4802
4803
4827
4828
4837
4838
4860void KDChartParams::setLineStyle( TQt::PenStyle style, uint dataset )
4861{
4862 if( KDCHART_GLOBAL_LINE_STYLE == dataset )
4863 _lineStyle = style;
4864 else
4865 _datasetLineStyles[ dataset ] = style;
4866 emit changed();
4867}
4868
4883TQt::PenStyle KDChartParams::lineStyle( uint dataset ) const
4884{
4885 if( KDCHART_GLOBAL_LINE_STYLE == dataset )
4886 // global line style
4887 return _lineStyle;
4888 else if( _datasetLineStyles.find( dataset ) == _datasetLineStyles.end() )
4889 return lineStyle();
4890 else
4891 return _datasetLineStyles[ dataset ];
4892}
4893
4894
4908
4909
4923
4924
4935
4936
4947
4948
4954/*
4955 \fn void KDChartParams::setThreeDLineXRotation( int degrees )
4956
4957 Specifies the rotation around the X axis in degrees. The value
4958 may be between 0 and 90. Only used if chartType() == Line and
4959 threeDLines() == true. The default is 30 degrees. If 0 degrees is
4960 specified for both the X and the Y rotation, the lines will look
4961 like 2D lines.
4962
4963 \param rotation the rotation in degrees. Must be between 0 and
4964 90.
4965 \sa setThreeDLines(), threeDLines(), threeDLineXRotation()
4966 */
4967
4968
4969
4975/*
4976 \fn int KDChartParams::threeDLineXRotation() const
4977
4978 Returns the rotation around the X axis in degrees. The value may
4979 be between 0 and 90. Only used if chartType() == Line and
4980 threeDLines() == true. The default is 30 degrees.
4981
4982 \return the rotation in degrees. Is always between 0 and 90.
4983 */
4984
4985
4991/*
4992 \fn void KDChartParams::setThreeDLineYRotation( int degrees )
4993
4994 Specifies the rotation around the Y axis in degrees. The value
4995 may be between 0 and 90. Only used if chartType() == Line and
4996 threeDLines() == true. The default is 30 degrees. If 0 degrees is
4997 specified for both the X and the Y rotation, the lines will look
4998 like 2D lines.
4999
5000 \param rotation the rotation in degrees. Must be between 0 and
5001 90.
5002 \sa setThreeDLines(), threeDLines(), threeDLineYRotation()
5003 */
5004
5010/*
5011 \fn int KDChartParams::threeDLineYRotation() const
5012
5013 Returns the rotation around the X axis in degrees. The value may
5014 be between 0 and 90. Only used if chartType() == Line and
5015 threeDLines() == true. The default is 30 degrees.
5016
5017 \return the rotation in degrees. Is always between 0 and 90.
5018 */
5019
5020
5028
5029
5039
5040
5051
5052
5062
5063
5078
5079
5090
5091
5093// END LINECHART
5094
5095// START POLARCHART
5101
5102
5110
5111
5121
5122
5132
5133
5143
5144
5153
5154
5160
5161
5177{
5178 _polarMarkerStyles[ dataset ] = style;
5179 _maxDatasetPolarMarkerStyle = TQMAX( dataset,
5180 _maxDatasetPolarMarkerStyle );
5181 emit changed();
5182}
5183
5193{
5194 if( _polarMarkerStyles.find( dataset ) != _polarMarkerStyles.end() )
5195 return _polarMarkerStyles[ dataset ];
5196 else
5197 return PolarMarkerCircle; // default
5198}
5199
5200
5207
5208
5209
5220 _polarMarkerStyles = map;
5221 // update _maxDatasetPolarMarkerStyle
5222 uint maxDataset = 0;
5223 for( PolarMarkerStyleMap::ConstIterator it = _polarMarkerStyles.begin();
5224 it != _polarMarkerStyles.end(); ++it )
5225 maxDataset = TQMAX( maxDataset, it.key() );
5226 _maxDatasetPolarMarkerStyle = maxDataset;
5227}
5228
5229
5240
5241
5252
5253
5266
5267
5277
5278
5287
5288
5297
5298
5310
5311
5319
5320
5328
5329
5337
5338
5348 bool showDelimiters,
5349 bool showLabels )
5350{
5351 if( KDCHART_MAX_POLAR_DELIMS_AND_LABELS_POS >= pos ) {
5352 _polarDelimsAndLabels[ pos ].showDelimiters = showDelimiters;
5353 _polarDelimsAndLabels[ pos ].showLabels = showLabels;
5354 }
5355}
5356
5364{
5365 if( KDCHART_MAX_POLAR_DELIMS_AND_LABELS_POS >= pos )
5366 return _polarDelimsAndLabels[ pos ].showDelimiters;
5367 else
5368 return false;
5369}
5370
5378{
5379 if( KDCHART_MAX_POLAR_DELIMS_AND_LABELS_POS >= pos )
5380 return _polarDelimsAndLabels[ pos ].showLabels;
5381 else
5382 return false;
5383}
5384
5385
5386
5388// END LINECHART
5389
5390// START RING/PIECHART
5396
5422
5423
5434
5435
5464
5465
5476
5477
5508
5509
5520
5521
5542
5543
5555
5556
5566
5567
5578
5579
5594
5595
5605
5606
5618
5619
5630
5631
5643
5644
5655
5656
5669
5670
5681
5682
5683
5685// END RING/PIECHART
5686
5687// START HILO CHART
5693
5701
5711
5712
5722
5723
5749void KDChartParams::setHiLoChartPrintLowValues( bool active, TQFont* font,
5750 int size, TQColor* color )
5751{
5752 _hiLoChartPrintLowValues = active;
5753 if ( font )
5754 _hiLoChartLowValuesFont = *font;
5755 else
5756 _hiLoChartLowValuesFont = _defaultFont;
5757 _hiLoChartLowValuesUseFontRelSize = ( 0 < size );
5758 _hiLoChartLowValuesFontRelSize = size;
5759 if ( 0 == color )
5760 _hiLoChartLowValuesColor = TQColor( 0, 0, 0 );
5761 else
5762 _hiLoChartLowValuesColor = *color;
5763 emit changed();
5764}
5765
5766
5780
5781
5795
5796
5810
5811
5827
5828
5842
5843
5872void KDChartParams::setHiLoChartPrintHighValues( bool active, TQFont* font,
5873 int size, TQColor* color )
5874{
5875 _hiLoChartPrintHighValues = active;
5876 if ( font )
5877 _hiLoChartHighValuesFont = *font;
5878 else
5879 _hiLoChartHighValuesFont = _defaultFont;
5880 _hiLoChartHighValuesUseFontRelSize = ( 0 < size );
5881 _hiLoChartHighValuesFontRelSize = size;
5882 if ( 0 == color )
5883 _hiLoChartHighValuesColor = TQColor( 0, 0, 0 );
5884 else
5885 _hiLoChartHighValuesColor = *color;
5886 emit changed();
5887}
5888
5889
5903
5904
5918
5919
5933
5934
5950
5951
5965
5966
5994void KDChartParams::setHiLoChartPrintOpenValues( bool active, TQFont* font,
5995 uint size, TQColor* color )
5996{
5997 _hiLoChartPrintOpenValues = active;
5998 if ( font )
5999 _hiLoChartOpenValuesFont = *font;
6000 else
6001 _hiLoChartOpenValuesFont = _defaultFont;
6002 _hiLoChartOpenValuesUseFontRelSize = ( 0 < size );
6003 _hiLoChartOpenValuesFontRelSize = size;
6004 if ( 0 == color )
6005 _hiLoChartOpenValuesColor = TQColor( 0, 0, 0 );
6006 else
6007 _hiLoChartOpenValuesColor = *color;
6008 emit changed();
6009}
6010
6011
6025
6026
6040
6041
6055
6056
6070
6071
6085
6086
6114void KDChartParams::setHiLoChartPrintCloseValues( bool active, TQFont* font,
6115 int size, TQColor* color )
6116{
6117 _hiLoChartPrintCloseValues = active;
6118 if ( font )
6119 _hiLoChartCloseValuesFont = *font;
6120 else
6121 _hiLoChartCloseValuesFont = _defaultFont;
6122 _hiLoChartCloseValuesUseFontRelSize = ( 0 < size );
6123 _hiLoChartCloseValuesFontRelSize = size;
6124 if ( 0 == color )
6125 _hiLoChartCloseValuesColor = TQColor( 0, 0, 0 );
6126 else
6127 _hiLoChartCloseValuesColor = *color;
6128 emit changed();
6129}
6130
6144
6145
6157
6158
6172
6173
6186
6187
6201
6202
6210
6211
6220
6221
6230
6231
6240
6241
6250
6251
6260
6261
6270
6271
6280
6281
6290
6291
6300
6301
6310
6311
6320
6321
6322
6324// END HILO CHART
6325
6326// START BOX/WHISKER CHART
6332
6340
6341 // use the following syntax to avoid warnings:
6350
6351
6361
6362
6372
6373
6374
6388void KDChartParams::setBWChartFences( double upperInner, double lowerInner,
6389 double upperOuter, double lowerOuter )
6390{
6391 _BWChartFenceUpperInner = upperInner;
6392 _BWChartFenceLowerInner = lowerInner;
6393 _BWChartFenceUpperOuter = upperOuter;
6394 _BWChartFenceLowerOuter = lowerOuter;
6395}
6396
6405void KDChartParams::bWChartFences( double& upperInner, double& lowerInner,
6406 double& upperOuter, double& lowerOuter ) const
6407{
6408 upperInner = _BWChartFenceUpperInner;
6409 lowerInner = _BWChartFenceLowerInner;
6410 upperOuter = _BWChartFenceUpperOuter;
6411 lowerOuter = _BWChartFenceLowerOuter;
6412}
6413
6414
6423
6424
6433
6434
6459
6460
6476
6477
6506 bool active,
6507 TQFont* font,
6508 int size,
6509 TQColor* color,
6510 TQBrush* brush )
6511{
6512 BWStatVal statValA = (BWStatValALL == statValue) ? BWStatValSTART : statValue;
6513 BWStatVal statValZ = (BWStatValALL == statValue) ? BWStatValEND : statValue;
6514 for( int i = statValA; i <= statValZ; ++i ){
6515 _BWChartStatistics[ i ].active = active;
6516 if ( font )
6517 _BWChartStatistics[ i ].font = *font;
6518 else
6519 _BWChartStatistics[ i ].font = _defaultFont;
6520 _BWChartStatistics[ i ].useRelSize = ( 0 < size );
6521 _BWChartStatistics[ i ].relSize = size;
6522 if ( 0 == color )
6523 _BWChartStatistics[ i ].color = TQColor( 0, 0, 0 );
6524 else
6525 _BWChartStatistics[ i ].color = *color;
6526 if ( 0 == brush )
6527 _BWChartStatistics[ i ].brush = TQBrush( TQt::white );
6528 else
6529 _BWChartStatistics[ i ].brush = *brush;
6530 }
6531 emit changed();
6532}
6533
6534
6548
6549
6561
6562
6576
6577
6591
6592
6606
6607
6621
6622
6624// END BOX/WHISKER CHART
6625
6626// START LEGENDS
6632
6641
6642
6653
6654
6663
6664
6681
6682
6691
6704
6705
6715
6716
6717
6735
6736
6746
6747
6757
6758
6759
6771
6772
6781
6782
6792
6793
6803
6804
6818
6819
6828
6829
6846
6847
6856
6857
6871
6872
6881
6882
6894
6895
6896
6897
6907
6908
6919
6920
6930
6931
6945
6946
6955
6956
6974
6975
6984
6985
7000
7001
7010
7011
7022
7023
7033
7035// END LEGENDS
7036
7037// START AXES
7043
7053
7054
7064
7065
7074
7075
7090void KDChartParams::setAxisShowGrid( uint n, bool axisShowGrid )
7091{
7092 if ( n < KDCHART_MAX_AXES ) {
7093 _axisSettings[ n ].params.setAxisShowGrid( axisShowGrid );
7094 emit changed();
7095 }
7096}
7097
7105{
7106 for ( uint i = 0; i < KDCHART_MAX_AXES; ++i ) {
7107 if ( _axisSettings[ i ].params.axisVisible()
7108 && _axisSettings[ i ].params.axisShowGrid() )
7109 return true;
7110 }
7111 return false;
7112}
7113
7141void KDChartParams::setAxisDatasets( uint n, uint dataset,
7142 uint dataset2,
7143 uint chart )
7144{
7145 uint a1 = ( KDCHART_ALL_AXES == n )
7146 ? 0
7147 : TQMIN( n, KDCHART_MAX_AXES-1 );
7148 uint a2 = ( KDCHART_ALL_AXES == n )
7150 : TQMIN( n, KDCHART_MAX_AXES-1 );
7151 for( uint i = a1; i <= a2; ++i ) {
7152 _axisSettings[ i ].params.setAxisVisible( KDCHART_NO_DATASET != dataset );
7153 _axisSettings[ i ].dataset = dataset;
7154 _axisSettings[ i ].dataset2 =
7155 ( KDCHART_ALL_DATASETS == dataset
7156 || KDCHART_NO_DATASET == dataset
7157 || KDCHART_ALL_DATASETS == dataset2
7158 || KDCHART_NO_DATASET == dataset2 )
7159 ? dataset
7160 : dataset2;
7161 _axisSettings[ i ].chart = chart;
7162 }
7163 emit changed();
7164}
7165
7177bool KDChartParams::axisDatasets( uint n, uint& dataset,
7178 uint& dataset2, uint& chart ) const
7179{
7180 bool bOk = ( n < KDCHART_MAX_AXES );
7181 if ( bOk ) {
7182 dataset = _axisSettings[ n ].dataset;
7183 dataset2 = _axisSettings[ n ].dataset2;
7184 chart = _axisSettings[ n ].chart;
7185 }
7186 return bOk;
7187}
7188
7189
7206bool KDChartParams::chartAxes( uint chart, uint& cnt, AxesArray& axes ) const
7207{
7208 cnt = 0;
7209 axes.resize( KDCHART_CNT_ORDINATES );
7210 for ( int i2 = 0; i2 < KDCHART_CNT_ORDINATES; ++i2 ) {
7211 axes[ i2 ] = KDCHART_NO_AXIS;
7212 }
7213 for ( uint i = 0; i < KDCHART_MAX_AXES; ++i ) {
7214 if ( chart == _axisSettings[ i ].chart
7215 && ( KDChartAxisParams::AxisPosLeft == i
7216 || KDChartAxisParams::AxisPosRight == i
7217 || KDChartAxisParams::AxisPosLeft2 == i
7218 || KDChartAxisParams::AxisPosRight2 == i ) ) {
7219 for( int j = 0; j < KDCHART_CNT_ORDINATES; ++j ) {
7220 if( KDCHART_NO_AXIS == axes[ j ] || axes[ j ] == i ) {
7221 if( KDCHART_NO_AXIS == axes[ j ] ) {
7222 ++cnt;
7223 axes[ j ] = i;
7224 }
7225 break;
7226 }
7227 }
7228 }
7229 }
7230 return (0 < cnt);
7231}
7232
7233
7234
7235
7251
7265
7279
7280
7295
7296
7317
7318
7328
7329
7350 TQFont axisLabelsFont,
7351 int axisLabelsFontSize,
7352 TQColor axisLabelsColor )
7353{
7354 if ( n < KDCHART_MAX_AXES ) {
7355 bool extraSize = (0 != axisLabelsFontSize);
7356 TQFont theFont( axisLabelsFont );
7357 bool useFontFixedSize = true;
7358 if ( extraSize ){
7359 if( 0 > axisLabelsFontSize ){
7360 useFontFixedSize = false;
7361 _axisSettings[ n ].params.setAxisLabelsFontRelSize( -axisLabelsFontSize );
7362 }else{
7363 theFont.setPointSize( axisLabelsFontSize );
7364 }
7365 }
7366 _axisSettings[ n ].params.setAxisLabelsFont( theFont, useFontFixedSize );
7367 _axisSettings[ n ].params.setAxisLabelsColor( axisLabelsColor );
7368 }
7369}
7370
7371
7385
7386
7423 TQStringList* axisLabelStringList,
7424 TQStringList* axisShortLabelStringList,
7425 const TQString& valueStart,
7426 const TQString& valueEnd )
7427{
7428 if ( n < KDCHART_MAX_AXES ) {
7429 _axisSettings[ n ].params.setAxisLabelStringLists( axisLabelStringList,
7430 axisShortLabelStringList,
7431 valueStart,
7432 valueEnd );
7433 emit changed();
7434 }
7435}
7436
7437
7446{
7447 if ( n < KDCHART_MAX_AXES ) {
7448 _axisSettings[ n ].params = axisParams;
7449 emit changed();
7450 }
7451}
7452
7453
7463
7464
7466// END AXES
7467
7468// START HEADERFOOTER
7469
7553
7554
7560
7561
7567
7573
7579
7585
7591
7597
7603
7609
7615
7621
7627
7633
7639
7640
7646
7652
7658
7659
7665
7671
7677
7678
7684
7690
7696
7702
7708
7709
7728void KDChartParams::setHeaderFooterText( uint pos, const TQString& text )
7729{
7730 if ( HdFtPosEND >= pos ) {
7731 _hdFtParams[ pos ]._text = text;
7732 emit changed();
7733 }
7734}
7735
7736
7754TQString KDChartParams::headerFooterText( uint pos ) const
7755{
7756 if ( HdFtPosEND >= pos )
7757 return _hdFtParams[ pos ]._text;
7758 else
7759 return TQString();
7760}
7761
7762
7763
7769const TQRect& KDChartParams::headerFooterRect( uint pos ) const
7770{
7771 if ( HdFtPosEND >= pos )
7772 return _hdFtParams[ pos ].rect();
7773 else
7774 return _noRect;
7775}
7776
7777
7796void KDChartParams::setHeaderFooterColor( uint pos, const TQColor color )
7797{
7798 if ( HdFtPosEND >= pos ) {
7799 _hdFtParams[ pos ]._color = color;
7800 emit changed();
7801 }
7802}
7803
7804
7822TQColor KDChartParams::headerFooterColor( uint pos ) const
7823{
7824 if ( HdFtPosEND >= pos )
7825 return _hdFtParams[ pos ]._color;
7826 else
7827 return TQColor( TQt::black );
7828}
7829
7830
7852void KDChartParams::setHeaderFooterFont( uint pos, const TQFont& font,
7853 bool fontUseRelSize,
7854 int fontRelSize )
7855{
7856 if ( HdFtPosEND >= pos ) {
7857 _hdFtParams[ pos ]._font = font;
7858 _hdFtParams[ pos ]._fontUseRelSize = fontUseRelSize;
7859 _hdFtParams[ pos ]._fontRelSize = fontRelSize;
7860 emit changed();
7861 }
7862}
7863
7864
7885TQFont KDChartParams::headerFooterFont( uint pos ) const
7886{
7887 if ( HdFtPosEND >= pos )
7888 return _hdFtParams[ pos ]._font;
7889 else
7890 return TQApplication::font();
7891}
7892
7893
7915{
7916 if ( HdFtPosEND >= pos )
7917 return _hdFtParams[ pos ]._fontUseRelSize;
7918 else
7919 return false;
7920}
7921
7922
7945{
7946 if ( HdFtPosEND >= pos )
7947 return _hdFtParams[ pos ]._fontRelSize;
7948 else
7949 return 10;
7950}
7951
7952
7977
7978
8002
8003
8031
8032
8058
8059
8084
8085
8109
8110
8137
8138
8139
8165
8166
8191
8192
8216
8217
8244
8245
8271
8272
8274// END HEADERFOOTER
8275
8276
8277
8278// PRIVATE VARIABLES
8283
8289
8290
8296
8297
8303
8309
8315
8322
8328
8334
8339
8345
8346
8352
8358
8364
8365
8371
8372
8378
8384
8385
8391
8397
8406
8407
8414
8415
8423
8424
8431
8438
8439
8448
8455
8462
8468
8474
8480
8481
8482
8489
8490
8497
8505
8516
8517
8524
8531
8538
8546
8547
8554
8560
8567
8573
8580
8582
8588
8594
8595
8601
8602
8603// documentation of this member variable temporary disabled:
8604// Feature is currently not supported, will be implemented
8605// by future versions of KDChart
8606/*
8607 \var int KDChartParams::_threeDLineXRotation;
8608
8609 Stores the X rotation of 3D lines.
8610 */
8611
8612
8613// documentation of this member variable temporary disabled:
8614// Feature is currently not supported, will be implemented
8615// by future versions of KDChart
8616/*
8617 \var int KDChartParams::_threeDLineYRotation;
8618
8619 Stores the Y rotation of 3D lines.
8620 */
8621
8622
8629
8630
8636
8645
8651
8652
8658
8664
8670
8677
8678
8685
8686
8688
8694
8701
8707
8716
8722
8723
8729
8730
8736
8737
8743
8750
8756
8757
8758
8759// PIES/RINGS
8765
8771
8778
8784
8790
8796
8802
8808
8814
8815
8816// HI-LO CHARTS
8817
8823
8830
8831
8837
8838
8845
8846
8853
8854
8861
8868
8869
8875
8876
8883
8884
8891
8892
8899
8906
8907
8913
8914
8921
8922
8929
8930
8937
8944
8945
8951
8952
8959
8960
8967
8968
8975
8976
8982
8988
8995
9005
9012
9013
9019
9025
9031
9037
9038
9044
9050
9060
9070
9071
9077
9078
9084
9085
9091
9101
9111
9112
9118
9119
9126
9132
9133
9134
9141
9142
9143
9161bool KDChartParams::findFirstAxisCustomBoxID( uint n, uint& boxID ) const
9162{
9163 TQIntDictIterator<KDChartCustomBox> it( _customBoxDict );
9164 for( ; it.current(); ++it ){
9165 if( (*it).anchorArea() == KDChartEnums::AreaAxisBASE + n ){
9166 boxID = it.currentKey();
9167 return true;
9168 }
9169 }
9170 return false;
9171}
9172
9173void KDChartParams::insertDefaultAxisTitleBox( uint n,
9174 bool setTitle, const TQString& axisTitle,
9175 bool setColor, const TQColor& axisTitleColor,
9176 bool setFont, const TQFont& axisTitleFont,
9177 bool setFontUseRelSize, bool axisTitleFontUseRelSize,
9178 bool setFontRelSize, int axisTitleFontRelSize )
9179{
9180 bool bVert = false;
9181 bool bHorz = false;
9182 bool b3rd = false;
9183 switch( KDChartAxisParams::basicAxisPos( n ) ){
9184 case KDChartAxisParams::AxisPosLeft:
9185 case KDChartAxisParams::AxisPosRight:
9186 case KDChartAxisParams::AxisPosLeft2:
9187 case KDChartAxisParams::AxisPosRight2:
9188 bVert = true;
9189 break;
9190 case KDChartAxisParams::AxisPosTop:
9191 case KDChartAxisParams::AxisPosBottom:
9192 case KDChartAxisParams::AxisPosTop2:
9193 case KDChartAxisParams::AxisPosBottom2:
9194 bHorz = true;
9195 break;
9196 default:
9197 b3rd = true;
9198 break;
9199 }
9200 const TQFont defaultFont( "helvetica", 6, TQFont::Normal, false );
9201
9202 TQString titleString { setTitle ? axisTitle : "<qt><center> </center></qt>" };
9203 const TQString stripTitleString( titleString.simplifyWhiteSpace().upper() );
9204 if( setTitle ){
9205 if( !stripTitleString.startsWith("<QT>" ) )
9206 titleString.prepend("<qt><center>");
9207 if( !stripTitleString.endsWith("</QT>" ) )
9208 titleString.append("</center></qt>");
9209 }
9210
9211 KDChartTextPiece textPiece( titleString, setFont ? axisTitleFont : defaultFont );
9212 int fixedFontSize = textPiece.font().pointSize();
9213 if( -1 == fixedFontSize )
9214 fixedFontSize = textPiece.font().pixelSize();
9215 if( -1 == fixedFontSize )
9216 fixedFontSize = 15;
9217 int relFontSize = setFontRelSize ? -axisTitleFontRelSize : -18;
9218
9219 KDChartCustomBox customBox( bVert ? -90 : 0,
9220 textPiece,
9221 setFontUseRelSize
9222 ? ( axisTitleFontUseRelSize ? relFontSize : fixedFontSize )
9223 : relFontSize,
9224 true,
9225 0, 0,
9226 0, 0,
9227 setColor ? axisTitleColor : TQt::darkBlue,
9228 TQt::NoBrush,
9229 KDChartEnums::AreaAxisBASE + n,
9230 bVert ? KDChartEnums::PosCenterLeft : KDChartEnums::PosBottomCenter, bVert ? (TQt::AlignTop + TQt::AlignHCenter) : (TQt::AlignBottom + TQt::AlignHCenter),
9231 0,0,0,
9232 bVert ? (TQt::AlignBottom + TQt::AlignRight) : (TQt::AlignTop + TQt::AlignHCenter),
9233 false, n );
9234
9235 customBox.setParentAxisArea( n );
9236 const uint id = insertCustomBox( customBox );
9237 /*debugging Title box*/
9238 /*
9239 setSimpleFrame(
9240 KDChartEnums::AreaCustomBoxesBASE
9241 + id,
9242 0,0, 0,0,
9243 true,
9244 true,
9245 KDFrame::FrameFlat,
9246 1,
9247 0,
9248 TQt::red,
9249 TQBrush( TQColor ( 255,248,222 ) ) );
9250 */
9251}
9252
9262void KDChartParams::setAxisTitle( uint n, const TQString& axisTitle )
9263{
9264 bool bDone = false;
9265 uint boxID;
9266 if( findFirstAxisCustomBoxID( n, boxID ) ){
9268 if( box ){
9269 TQString title = axisTitle;
9270 const TQString stripTitleString( title.simplifyWhiteSpace().upper() );
9271 if( !stripTitleString.startsWith("<QT>" ) )
9272 title.prepend("<qt><center>");
9273 if( !stripTitleString.endsWith("</QT>" ) )
9274 title.append("</center></qt>");
9275
9276 KDChartTextPiece textPiece( 0, title,
9277 box->content().font() );
9278
9279 box->setContent( textPiece );
9280 //tqDebug ("old Axis Title updated");
9281 bDone = true;
9282 }
9283 }
9284 if( !bDone ){
9285 insertDefaultAxisTitleBox( n,
9286 true, axisTitle,
9287 false, TQColor(),
9288 false, TQFont(),
9289 false, false,
9290 false, 0 );
9291 //tqDebug("new Axis Title Box inserted");
9292 }
9293 emit changed();
9294}
9295
9301TQString KDChartParams::axisTitle( uint n ) const
9302{
9303 uint boxID;
9304 if( findFirstAxisCustomBoxID( n, boxID ) ){
9305 const KDChartCustomBox* box = customBox( boxID );
9306 if( box )
9307 return box->content().text();
9308 }
9309 return TQString();
9310}
9311
9320{
9321 bool bDone = false;
9322 uint boxID;
9323 if( findFirstAxisCustomBoxID( n, boxID ) ){
9325 if( box ){
9326 box->setColor( axisTitleColor );
9327 bDone = true;
9328 }
9329 }
9330 if( !bDone )
9331 insertDefaultAxisTitleBox( n,
9332 false, TQString(),
9333 true, axisTitleColor,
9334 false, TQFont(),
9335 false, false,
9336 false, 0 );
9337 emit changed();
9338}
9339
9345TQColor KDChartParams::axisTitleColor( uint n ) const
9346{
9347 uint boxID;
9348 if( findFirstAxisCustomBoxID( n, boxID ) ){
9349 const KDChartCustomBox* box = customBox( boxID );
9350 if( box )
9351 return box->color();
9352 }
9353 return TQt::darkBlue;
9354}
9355
9366 TQFont axisTitleFont )
9367{
9368 bool bDone = false;
9369 uint boxID;
9370 if( findFirstAxisCustomBoxID( n, boxID ) ){
9372 if( box ){
9373 KDChartTextPiece textPiece( 0, box->content().text(),
9374 axisTitleFont );
9375 box->setContent( textPiece );
9376 bDone = true;
9377 }
9378 }
9379 if( !bDone )
9380 insertDefaultAxisTitleBox( n,
9381 false, TQString(),
9382 false, TQColor(),
9383 true, axisTitleFont,
9384 false, false,
9385 false, 0 );
9386 emit changed();
9387}
9388
9397
9399 TQFont axisTitleFont,
9400 bool useFixedFontSize )
9401{
9402
9403 bool bDone = false;
9404 uint boxID;
9405 if( findFirstAxisCustomBoxID( n, boxID ) ){
9407 if( box ){
9408 KDChartTextPiece textPiece( 0, box->content().text(),
9409 axisTitleFont );
9410 int fixedFontSize = textPiece.font().pointSize();
9411 setAxisTitleFontRelSize( n, fixedFontSize );
9412 box->setContent( textPiece );
9413 bDone = true;
9414 }
9415 }
9416 if( !bDone )
9417 insertDefaultAxisTitleBox( n,
9418 false, TQString(),
9419 false, TQColor(),
9420 true, axisTitleFont,
9421 false, false,
9422 false, 0 );
9423
9424 emit changed();
9425
9426 if ( useFixedFontSize )
9427 setAxisTitleFontUseRelSize( n, false);
9428
9429}
9430
9431
9438TQFont KDChartParams::axisTitleFont( uint n ) const
9439{
9440 uint boxID;
9441 if( findFirstAxisCustomBoxID( n, boxID ) ){
9442 const KDChartCustomBox* box = customBox( boxID );
9443 if( box )
9444 return box->content().font();
9445 }
9446 return TQFont( "helvetica", 6, TQFont::Normal, false );
9447}
9448
9458{
9459 bool bDone = false;
9460 uint boxID;
9461 if( findFirstAxisCustomBoxID( n, boxID ) ){
9463 if( box ){
9464 if ( !axisTitleFontUseRelSize ) {
9465 if ( box->fontSize() < 0 )
9466 box->setFontSize( -(box->fontSize()), true );
9467 } else {
9468 if( 0 <= box->fontSize() ) {
9469 box->setFontSize( -(box->fontSize()), true );
9470 } else
9471 box->setFontSize( box->fontSize(), true);
9472 }
9473 bDone = true;
9474 }
9475 }
9476 if( !bDone )
9477 insertDefaultAxisTitleBox( n,
9478 false, TQString(),
9479 false, TQColor(),
9480 false, TQFont(),
9482 false, 0 );
9483 emit changed();
9484}
9485
9492{
9493 uint boxID;
9494 if( findFirstAxisCustomBoxID( n, boxID ) ){
9495 const KDChartCustomBox* box = customBox( boxID );
9496 if( box )
9497 return ( 0 > box->fontSize() );
9498 }
9499 return true;
9500}
9501
9513{
9514 bool bDone = false;
9515 uint boxID;
9516 if( findFirstAxisCustomBoxID( n, boxID ) ){
9518 if( box ){
9519 box->setFontSize( -axisTitleFontRelSize, true );
9520 bDone = true;
9521 }
9522 }
9523 if( !bDone )
9524 insertDefaultAxisTitleBox( n,
9525 false, TQString(),
9526 false, TQColor(),
9527 false, TQFont(),
9528 true, true,
9529 true, axisTitleFontRelSize );
9530 emit changed();
9531}
9532
9540{
9541 uint boxID;
9542 if( findFirstAxisCustomBoxID( n, boxID ) ){
9543 const KDChartCustomBox* box = customBox( boxID );
9544 if( box ){
9545 int i = box->fontSize();
9546 return (0 > i) ? -i : i;
9547 }
9548 }
9549 return 18;
9550}
Provide access to the chart axis parameters.
#define KDCHART_AXIS_LABELS_AUTO_LIMIT
Use this to specify that the axis label limits are to be calculated automatically.
Definition of a class for specifying and drawing custom boxes.
Definition of global enums.
Header for all common chart parameters.
#define KDCHART_PROPSET_VERT_LINE
Predefined (build-in) property ID.
#define KDCHART_PROPSET_NORMAL_DATA
Default (built-in) property ID, used for data cells without any special properties.
#define KDCHART_PROPSET_HORI_LINE
Predefined (build-in) property ID.
#define KDCHART_CNT_ORDINATES
Our charts may have up to 4 ordinate axes: 2 left ones and 2 right ones.
#define KDCHART_PROPSET_TRANSPARENT_DATA
Predefined (build-in) property ID.
#define KDCHART_MAX_AXES
Charts have up to 12 axes: up to two axes on both sides for X, Y and Z (if data is 3-dimensional).
Header of the KDFrame class providing highly configurable rectangular frame drawing.
access the chart axis parameters.
static AxisPos basicAxisPos(uint pos)
enum KDChartAxisParams::AxisPos { AxisPosSTART = 0,
Class for specifying and drawing custom boxes.
int fontSize() const
Returns the font size to be used.
const KDChartTextPiece & content() const
Returns the text piece content that is to be drawn.
const KDChartCustomBox * clone() const
Create a new box on the heap, copy the settings stored by this box into the newly created box and ret...
void setFontSize(int fontSize, bool fontScaleGlobal)
Specifies the font size to be used.
TQColor color() const
Returns the text color.
void setColor(TQColor color)
Specifies the text color to be used.
void setContent(const KDChartTextPiece &content)
Specifies the text piece content to be drawn.
Encapsulates one data cell in a chart.
TextLayoutPolicy
Text layout policy: what to do if text that is to be drawn would cover neighboring text or neighborin...
PositionFlag
The general position flag to specify a point of an area, for example this could be the anchor point w...
Stores the frame settings for one of the chart areas:
TQColor lineColor() const
Returns the color of the lines in line charts.
KDChartCustomBox * customBoxRef(uint box)
Retrieve a non-const pointer to a custom box from the list.
void setPieStart(int degrees)
Specifies the starting point of the pie circle.
void setDataValuesShowInfinite(bool dataValuesShowInfinite=true, uint chart=KDCHART_ALL_CHARTS)
Specifies whether data value texts should be printed even if the value is KDCHART_POS_INFINITE (or KD...
TQColor dataColor(uint dataset) const
Returns the color for a dataset.
void activateDefaultAxes()
activate the default axis types for this chart:
int dataValuesRotation(uint chart, bool negative) const
Returns the amount of degrees (using a circle of 360 degrees) taken to rotate the text.
void setHiLoChartPrintCloseValues(bool active, TQFont *font=0, int size=14, TQColor *color=0)
Specifies if and how a HiLo chart will print the Close values next to their respective entries.
void setAxisLabelStringParams(uint n, TQStringList *axisLabelStringList, TQStringList *axisShortLabelStringList, const TQString &valueStart=TQString(), const TQString &valueEnd=TQString())
Specifies a TQStringList which the axis label texts for one axis are to be taken from,...
void setLegendOrientation(TQt::Orientation orientation)
Specifies how the legend should be printed.
void setAreaChartSubType(AreaChartSubType areaChartSubType)
Specifies the area chart subtype.
bool printDataValues(uint chart) const
Returns whether the data values will be printed near their respective entries.
void setDataValuesColors(const TQColor *color=KDCHART_DATA_VALUE_AUTO_COLOR, const TQBrush &background=TQBrush(TQt::NoBrush), uint chart=KDCHART_ALL_CHARTS)
Specifies the text color and background brush to be used for printing the data value texts.
void setProperties(int id, KDChartPropertySet &rSet)
Overwrites a property set with a new property set.
void setPolarMarkerSize(TQSize size=TQSize(-40, -40))
Specifies the sizes of polar markers.
void setOptimizeOutputForScreen(bool screenOutput)
Specify whether drawing should be optimized for (low resolution) screen output or whether other routi...
PolarMarkerStyle polarMarkerStyle(uint dataset) const
Returns the marker to be used for a dataset.
int registerProperties(KDChartPropertySet &rSet)
Stores a new property set: data are stored by value so you may use your rSet instance for other purpo...
void bWChartFences(double &upperInner, double &lowerInner, double &upperOuter, double &lowerOuter) const
Retrievs the factors to be used to calculate the position of the inner (or outer, resp....
void setAdditionalChartType(ChartType chartType)
Specifies the additional chart type.
void setDataValuesFont(TQFont *font, uint size=UINT_MAX, uint chart=KDCHART_ALL_CHARTS)
Specifies the font to be used for printing the data value texts.
int headerFooterFontRelSize(uint pos) const
Returns the factor used for dynamical calculation of the font size of the text in the header (or foot...
void setDataDefaultColors()
Specifies KD Chart's default colors for the datasets 0..11.
void setLineMarkerSize(TQSize size)
Specifies the sizes of line markers.
void setChartType(ChartType chartType)
Specifies the chart type.
void setAxisParams(uint n, const KDChartAxisParams &axisParams)
Specifies the parameters for one axis.
void setPolarDelimsAndLabelsAtPos(KDChartEnums::PositionFlag pos, bool showDelimiters, bool showLabels)
Specifies whether to show circular delimiters and labels at a given position in polar charts.
void setHeaderFooterText(uint pos, const TQString &text)
Specifies the text to be displayed in the header (or footer, resp.) section specified by pos.
void setValueBlockGap(int gap)
Specifies the number of pixels between each value block.
void setExplodeFactor(double factor)
Specifies the explode factor in percent, i.e.
void setDrawSolidExcessArrows(bool solidArrows)
Specifies whether arrows showing excess values in bar charts should be drawn solidly or split.
double shadowBrightnessFactor() const
Returns a factor to be used to adjust the built-in brightness of shadow colors in 3-dimensional drawi...
const KDChartFrameSettings * frameSettings(uint area, bool &bFound, int *pIterIdx=0) const
Return the frame settings of one of the chart areas.
void setAxisDatasets(uint n, uint dataset, uint dataset2=KDCHART_NO_DATASET, uint chart=0)
Specifies which data are to be represented by a given axis.
bool polarMarker() const
Returns whether polar markers should be drawn at each data point.
void setThreeDLineDepth(int depth)
Specifies the depth of 3D lines (the "width" in Z direction).
bool findFirstAxisCustomBoxID(uint n, uint &boxID) const
Retrieves the ID of the first KDChartCustomBox that is anchored at axis n.
ChartType additionalChartType() const
Returns the additional chart type configured in this params object.
void changed()
This signal is emitted when any of the chart parameters has changed.
void setThreeDLineYRotation(int degrees)
void setShadowPattern(TQt::BrushStyle style)
Specifies a filling style for filling the shadow areas in 3-dimensional drawings like 3D bar charts.
TQFont headerFooterFont(uint pos) const
Returns the font used in the header (or footer, resp.) section specified by pos.
void setPolarChartSubType(PolarChartSubType polarChartSubType)
Specifies the polar chart subtype.
void setPolarLineWidth(int width=-3)
Specifies the width for lines in polar charts.
void setLegendSource(LegendSource source)
Specifies where the legend text is coming from.
void setAllowOverlappingDataValueTexts(bool allow)
Specifies whether a data value text may be drawn even if it's region intersects with another data val...
void setDataValuesPlacing(KDChartEnums::PositionFlag position, uint align, int deltaX, int deltaY, int rotation, bool specifyingPositiveValues=true, uint chart=KDCHART_ALL_CHARTS)
Specifies the position and rotation of the data value texts to be printed.
void setThreeDLines(bool threeD)
Specifies whether lines should be drawn three-dimensionally or not.
void setLegendFontRelSize(int legendFontRelSize)
Specifies the legend relative font size.
const KDChartFrameSettings * nextFrameSettings(bool &bFound, int *pIterIdx) const
Return the next frame settings specified for the same area type as the frame that was retrieved by pr...
void setExplode(bool explode)
Specifies whether the pie chart or ring chart should be exploding (all pies or ring segments are slig...
const KDChartCustomBox * customBox(uint box) const
Retrieve a const pointer to a custom box from the list.
bool headerFooterFontUseRelSize(uint pos) const
Returns is the font size used in the header (or footer, resp.) section specified by pos will be calcu...
TQColor dataShadow1Color(uint dataset) const
Returns the first shadow color for a dataset.
void setBWChartFences(double upperInner, double lowerInner, double upperOuter, double lowerOuter)
Specifies the factors to be used to calculate the position of the inner (or outer,...
void setAxisLabelTextParams(uint n, bool axisSteadyValueCalc=true, TQVariant axisValueStart=KDCHART_AXIS_LABELS_AUTO_LIMIT, TQVariant axisValueEnd=KDCHART_AXIS_LABELS_AUTO_LIMIT, double axisValueDelta=KDCHART_AXIS_LABELS_AUTO_DELTA, int axisDigitsBehindComma=KDCHART_AXIS_LABELS_AUTO_DIGITS, int axisMaxEmptyInnerSpan=67, KDChartAxisParams::LabelsFromDataRow takeLabelsFromDataRow=KDChartAxisParams::LabelsFromDataRowNo, int labelTextsDataRow=0, TQStringList *axisLabelStringList=0, TQStringList *axisShortLabelsStringList=0, int axisValueLeaveOut=KDCHART_AXIS_LABELS_AUTO_LEAVEOUT, KDChartAxisParams::ValueScale axisValueDeltaScale=KDChartAxisParams::ValueScaleNumerical)
Specifies the label text parameters for one axis.
TQt::PenStyle lineStyle(uint dataset=KDCHART_GLOBAL_LINE_STYLE) const
Returns the line style of one of the lines in a line chart or the global line style if no style was s...
TQMap< uint, LineMarkerStyle > LineMarkerStyleMap
The type of the storage structure for line marker styles.
void setThreeDBarsShadowColors(bool shadow)
int axisTitleFontRelSize(uint n) const
Returns the relative size of the default axis title text, should be ignored if axisTitleFontUseRelSiz...
void setOutlineDataColor(TQColor color)
Specifies a color for the outlines of data displays.
void setAxisTitleColor(uint n, TQColor axisTitleColor)
Specifies the color of the default axis title text.
bool findDataset(SourceMode mode, uint &dataset, uint &dataset2, uint chart=0) const
Retrieves the dataset number or a range of datasets being used with a given SourceMode for a given ch...
void setBarChartSubType(BarChartSubType barChartSubType)
Specifies the bar chart subtype.
void setThreeDLineXRotation(int degrees)
void setLegendPosition(LegendPosition position)
Specifies where the legend should be shown.
void setHeaderFooterFont(uint pos, const TQFont &font, bool fontUseRelSize, int fontRelSize)
Specifies the font to be used in the header (or footer, resp.) section specified by pos.
void setAxisTitleFontUseRelSize(uint n, bool useRelSize)
Specifies whether the fixed size of the the default axis title text's font.
LineMarkerStyle lineMarkerStyle(uint dataset) const
Returns the marker to be used for a dataset.
LineMarkerStyle
The available line marker styles.
void setThreeDBars(bool threeDBars)
Specifies whether the engine should draw the bars in 3D.
bool axisTitleFontUseRelSize(uint n) const
Returns whether the fix font size is used for the default axis title text.
virtual ~KDChartParams()
Destructor.
PolarMarkerStyle
The available polar marker styles.
void setDataRainbowColors()
Specifies a set of eight rainbow-like colors for the datasets 0..7 and sets the lighter versions of t...
bool printDataValuesWithDefaultFontParams(uint chart) const
Retrieves whether data value texts are to be printed with non-default font parameters or not - when t...
void setThreeDPies(bool threeDPies)
Specifies whether the engine should draw the pies in 3D.
void setPrintDataValuesWithDefaultFontParams(uint chart=KDCHART_ALL_CHARTS, bool callSetPrintDataValues=true)
Specifies that data value texts are to be printed with default font parameters.
TQString headerFooterText(uint pos) const
Returns the text that is displayed in the header (or footer, resp.) section specified by pos.
bool calculateProperties(int startId, KDChartPropertySet &rSet) const
Retrieves the values that correspond to a property set by reading this set's properties and obtaining...
void setOutlineDataLineWidth(uint width)
Specifies the width of the outlines of data displays.
void setDatasetGap(int gap)
Specifies the number of pixels between two dataset values.
void setLineStyle(TQt::PenStyle style, uint dataset=KDCHART_GLOBAL_LINE_STYLE)
Specifies a line style to be used for line charts.
void setLineWidth(int width)
Specifies the width for lines in line charts.
void setThreeDBarDepth(double depth)
Specifies the depth of the 3D Effect used for 3D bars.
void setLegendTextColor(const TQColor &color)
Specifies the color to be used for the legend texts.
KDChartEnums::PositionFlag dataValuesAnchorPosition(uint chart, bool negative) const
Returns the anchor position which the text is to be aligned to.
SourceMode
The chart source mode.
void setPrintDataValuesFontRelSize(uint chart, uint size)
Specifies the dynamic font size to be used for printing the data value texts.
int dataValuesAnchorDeltaX(uint chart, bool negative) const
Returns the X distance between the text and its anchor.
void setRingStart(int degrees)
Specifies the starting point of the ring circle.
void setShadowBrightnessFactor(double factor)
Specifies a factor to be used to adjust the built-in brightness of shadow colors in 3-dimensional dra...
void setNumValues(uint numValues)
Specifies how many of the values should be shown.
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 properties(int id, KDChartPropertySet &rSet) const
Retrieves the values specified for a property set that was stored by registerProperties().
void setAxisType(uint n, const KDChartAxisParams::AxisType axisType)
Specifies the axis type.
void setLineMarkerStyle(uint dataset, LineMarkerStyle style)
Specifies the line marker to be used for a dataset.
void setDataSubduedColors(bool ordered=false)
Specifies a set of eighteen subdued colors for the datasets 0..17.
bool removeFrame(uint area)
Remove the last frame, that was specified for this chart area.
void setHiLoChartPrintLowValues(bool active, TQFont *font=0, int size=14, TQColor *color=0)
Specifies if and how a HiLo chart will print the Low values below their respective entries.
TQColor headerFooterColor(uint pos) const
Returns the colour used for the header text (or footer text, resp.) of the header/footer section spec...
void setPolarMarkerStyle(uint dataset, PolarMarkerStyle style)
Specifies the polar marker to be used for a dataset.
void setThreeDBarAngle(uint angle)
Specifies the angle used for 3D bars.
void setDataColor(uint dataset, TQColor color)
Specifies a color for a dataset.
bool showGrid() const
Returns if any grid will be drawn at the data area.
void setBWChartBrush(const TQBrush &bWChartBrush)
Specifies the brush to be used to fill the BoxWhisker charts.
AreaChartSubType areaChartSubType() const
Returns the area chart subtype.
void setDataValuesCalc(int divPow10=0, int digitsBehindComma=KDCHART_DATA_VALUE_AUTO_DIGITS, uint chart=KDCHART_ALL_CHARTS)
Specifies how the data value text figures are modified before printing.
BWStatVal
The different statistical values that can be printed into or asked from a Box and Whisker chart.
TQColor axisTitleColor(uint n) const
Returns the color of the default axis title text.
void setThreeDPieHeight(int pixels)
Specifies the height of the 3D effect for pies in pixels.
void setAxisTitleFontRelSize(uint n, int axisTitleFontRelSize)
Specifies whether a relative size to be used for the default axis title text instead of the fixed siz...
TQColor dataShadow2Color(uint dataset) const
Returns the second shadow color for a dataset.
ChartType
The chart type.
void setPolarZeroDegreePos(int degrees)
Specifies the zero degree position in polar charts.
int lineWidth() const
Returns the line width of the lines in line charts.
KDChartParams()
Constructor.
void setBWChartSubType(BWChartSubType bWChartSubType)
Specifies the BoxWhisker chart subtype.
void setLegendTitleText(const TQString &text)
Specifies a text to be shown as the title of the legend.
void setBWChartOutValMarkerSize(int size)
Specifies how big outlier markers (representing the values outside the inner fences) will be drawn.
void setPolarRotateCircularLabels(bool rotateCircularLabels)
Specifies whether to rotate circular labels in polar charts.
void setAxisVisible(uint n, const bool axisVisible)
Specifies if the axis will be drawn.
void setLineChartSubType(LineChartSubType lineChartSubType)
Specifies the line chart subtype.
bool removeProperties(int id)
Removes a property set from the registry that was registered via registerProperties().
TQFont axisTitleFont(uint n) const
Returns the font of the default axis title text.
uint insertCustomBox(const KDChartCustomBox &box)
Add a new custom box to the list of boxes.
void setLegendTitleFontRelSize(int legendTitleFontRelSize)
Specifies the legend title relative font size.
void setBarWidth(int width=KDCHART_AUTO_SIZE)
Specifies the width of one bar: makes sure that all of the bars have exactly the same width.
TQMap< uint, PolarMarkerStyle > PolarMarkerStyleMap
The type of the storage structure for polar marker styles.
void setAxisLabelsFont(uint n, TQFont axisLabelsFont, int axisLabelsFontSize=0, TQColor axisLabelsColor=TQt::black)
Specifies the axis labels font for one axis.
bool polarLabelsAtPos(KDChartEnums::PositionFlag pos) const
Returns whether to show circular labels at a given position in polar charts.
void setLineColor(TQColor color=TQColor())
Specifies the color of the lines in line charts.
void setPolarMarker(bool marker)
Specifies whether there should be a marker at each data point.
void setAxisLabelsVisible(uint n, bool axisLabelsVisible)
Specifies whether the axis labels of an axis are to be shown.
void setAreaLocation(AreaLocation location)
Specifies whether the area above or below the value points should be filled.
bool removeCustomBox(const uint &idx)
Remove a custom box from the list of boxes.
const KDChartAxisParams & axisParams(uint n) const
Returns the parameters that are currently defined for axis n.
void setRelativeRingThickness(bool relativeThickness)
Specifies whether the ring thickness should be relative to the sum of the values in the dataset that ...
void setAxisTitleFont(uint n, TQFont axisTitleFont)
Specifies the font and the size of the default axis title text.
void setHeaderFooterColor(uint pos, const TQColor color)
Specifies the colour to be used for the header text (or footer text, resp.) of the header/footer sect...
void setLegendTitleFont(const TQFont &font, bool useFontSize)
Specifies the font in which the legend title (if any) is drawn.
void setDefaultAxesTypes()
Set the default axis types for all the axes the user might activate for this chart:
const TQRect & headerFooterRect(uint pos) const
void setLineMarkerStyles(LineMarkerStyleMap map)
Sets a whole map of line marker styles.
uint dataValuesAnchorAlign(uint chart, bool negative) const
Returns the way how the text is to be aligned to the anchor.
void setPrintDataValues(bool active, uint chart=KDCHART_ALL_CHARTS, int divPow10=0, int digitsBehindComma=KDCHART_DATA_VALUE_AUTO_DIGITS, TQFont *font=0, uint size=UINT_MAX, const TQColor *color=KDCHART_DATA_VALUE_AUTO_COLOR, KDChartEnums::PositionFlag negativePosition=KDChartEnums::PosCenter, uint negativeAlign=TQt::AlignCenter, int negativeDeltaX=0, int negativeDeltaY=0, int negativeRotation=0, KDChartEnums::PositionFlag positivePosition=KDChartEnums::PosCenter, uint positiveAlign=TQt::AlignCenter, int positiveDeltaX=0, int positiveDeltaY=0, int positiveRotation=0, KDChartEnums::TextLayoutPolicy policy=KDChartEnums::LayoutPolicyRotate)
Specifies if and how a chart will print the data value texts near their respective entries.
void setChartSourceMode(SourceMode mode, uint dataset, uint dataset2=KDCHART_NO_DATASET, uint chart=0)
Specifies the chart source mode of one or more datasets.
bool axisDatasets(uint n, uint &dataset, uint &dataset2, uint &chart) const
Returns which data are to be represented by a given axis.
void setAxisShowGrid(uint n, bool axisShowGrid)
Specifies whether a grid should be drawn at the chart data area.
void setValueBlockGapIsRelative(bool gapIsRelative)
Specifies if the value set by setValueBlockGap is a per mille value of the chart data area width.
void setBWChartPrintStatistics(BWStatVal statValue, bool active, TQFont *font=0, int size=24, TQColor *color=0, TQBrush *brush=0)
Specifies if and how a BoxWhisker chart will print the respective statistical values near to the draw...
void setLegendShowLines(bool legendShowLines)
Specifies whether the legend shall show lines or just show the markers (or squares,...
void setHiLoChartPrintOpenValues(bool active, TQFont *font=0, uint size=14, TQColor *color=0)
Specifies if and how a HiLo chart will print the Open values below their respective entries.
void setHiLoChartSubType(HiLoChartSubType hiLoChartSubType)
Specifies the HiLo chart subtype.
void setOutlineDataLineStyle(TQt::PenStyle style)
Specifies the line style of the outlines of data displays.
bool polarDelimAtPos(KDChartEnums::PositionFlag pos) const
Returns whether to show circular delimiters at a given position in polar charts.
ChartType chartType() const
Returns the chart type configured in this params object.
void setDatasetGapIsRelative(bool gapIsRelative)
Specifies if the value set by setDatasetGap is a per mille value of the chart data area width.
uint maxCustomBoxIdx() const
Retrieve the biggest custom boxes ID used.
void setPolarMarkerStyles(PolarMarkerStyleMap map)
Sets a whole map of polar marker styles.
void setHiLoChartPrintHighValues(bool active, TQFont *font=0, int size=14, TQColor *color=0)
Specifies if and how a HiLo chart will print the High values below their respective entries.
void setLegendFont(const TQFont &font, bool useFontSize)
Specifies the font in which the legend texts are drawn.
int dataValuesAnchorDeltaY(uint chart, bool negative) const
Returns the Y distance between the text and its anchor.
void setLegendTitleTextColor(const TQColor &color)
Specifies the color to be used for the legend title.
bool moveDataRegionFrame(uint oldDataRow, uint oldDataCol, uint, uint newDataRow, uint newDataCol, uint)
Move a frame that was previously specified using setDataRegionFrame to another location: moves the fr...
void setAxisTitle(uint n, const TQString &axisTitle)
Specifies the default axis title text.
TQString axisTitle(uint n) const
Returns the default axis title text.
void setAxisLabelsTouchEdges(uint n, bool axisLabelsTouchEdges)
Specifies whether the axis labels start and end at the edges of the charts instead being positioned i...
void setGlobalLeading(int left, int top, int right, int bottom)
Specifies the distance between the chart and the left border of the painter area.
bool chartAxes(uint chart, uint &cnt, AxesArray &axes) const
Returns which ORDINATE axis(axes) is(are) representing a given chart.
void setLineMarker(bool marker)
Specifies whether there should be a marker at each data point.
void setLegendSpacing(uint space)
Specifies how much space in pixels there should be between the legend and the data display.
bool findDatasets(SourceMode mode1, SourceMode mode2, uint &dataset, uint &dataset2, uint chart=0) const
Retrieves the dataset number or a range of datasets being used with one of two given SourceModes for ...
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...
void setShowBar(int idShowBar, bool showBar)
Specify the ID of the property set specifying a boolean flag indicating whether this cell's bar is to...
bool hasOwnLineWidth(int &idLineWidth, int &lineWidth)
Returns whether this property set is specifying it's own line width settings.
void setLineWidth(int idLineWidth, int lineWidth)
Specify the ID of the property set specifying the line width to be used for drawing a line from this ...
const KDChartPropertySet * clone() const
Create a new property set on the heap, copy the settings stored by this property set into the newly c...
void setLineColor(int idLineColor, const TQColor &lineColor)
Specify the ID of the property set specifying the line color to be used for drawing a line from this ...
void setMarkerAlign(int idMarkerAlign, uint markerAlign)
Specify the ID of the property set specifying the alignment of the Marker to be displayed for this da...
bool hasOwnLineStyle(int &idLineStyle, TQt::PenStyle &lineStyle)
Returns whether this property set is specifying it's own line style settings.
void quickReset(const TQString &name, int idParent=KDChartPropertySet::UndefinedID)
Set the name, set all of the ID settings to idParent, but do NOT change the value settings,...
bool hasOwnShowMarker(int &idShowMarker, bool &showMarker)
Returns whether this property set is specifying it's own flag indicating whether a Marker is to be di...
void setShowMarker(int idShowMarker, bool showMarker)
Specify the ID of the property set specifying a boolean flag indicating whether a Marker is to be dis...
void setAreaBrush(int idAreaBrush, const TQBrush &areaBrush)
Specify the ID of the property set specifying the area brush to be used for this cell or specify the ...
void setBarColor(int idBarColor, const TQColor &barColor)
Specify the ID of the property set specifying the bar color to be used for this cell or specify the b...
void deepCopy(const KDChartPropertySet *source)
Copy the settings stored by property set source into this property set.
bool hasOwnAreaBrush(int &idAreaBrush, TQBrush &areaBrush)
Returns whether this property set is specifying it's own area brush settings.
bool hasOwnLineColor(int &idLineColor, TQColor &lineColor)
Returns whether this property set is specifying it's own line color settings.
void setLineStyle(int idLineStyle, const TQt::PenStyle &lineStyle)
Specify the ID of the property set specifying the line style to be used for drawing a line from this ...