kchart

KDChartAxisParams.cpp
1/*
2 KDChart - a multi-platform charting engine
3 */
4
5/****************************************************************************
6 ** Copyright (C) 2001-2003 Klarävdalens 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 <KDChartAxisParams.h>
30#ifndef KDCHART_MASTER_CVS
31#include "KDChartAxisParams.moc"
32#endif
33
34
134{
135 _axisType = AxisTypeUnknown;
136 _axisVisible = false;
137 _axisAreaMode = AxisAreaModeAutoSize;
138 _axisUseAvailableSpaceFrom = 0;
139 _axisUseAvailableSpaceTo = -1000;
140 _axisAreaMin = -100;
141 _axisAreaMax = 0;
142 _axisCalcMode = AxisCalcLinear;
143 _axisIsoRefAxis = UINT_MAX; // == KDCHART_NO_AXIS, see KDChartParams.cpp
144 _axisTrueAreaSize = 0;
145 _axisZeroLineStartX = 0.0;
146 _axisZeroLineStartY = 0.0;
147 _axisDtLowPosX = 0.0;
148 _axisDtLowPosY = 0.0;
149 _axisDtHighPosX = 0.0;
150 _axisDtHighPosY = 0.0;
151
152 _axisLineWidth = -3; // == 3/1000
153 _axisTrueLineWidth = 1;
154 _axisLineVisible = true;
155 _axisLineColor = TQColor( 0, 0, 0 );
156
157 _axisShowFractionalValuesDelimiters = true;
158 _axisShowGrid = false;
159 _axisGridColor = KDCHART_DEFAULT_AXIS_GRID_COLOR;
160 _axisGridLineWidth = KDCHART_AXIS_GRID_AUTO_LINEWIDTH;
161 _axisGridStyle = TQt::SolidLine;
162
163 _axisShowSubDelimiters = true;
164 _axisGridSubColor = KDCHART_DEFAULT_AXIS_GRID_COLOR;
165 _axisGridSubLineWidth = KDCHART_AXIS_GRID_AUTO_LINEWIDTH;
166 _axisGridSubStyle = TQt::DotLine;
167
168 _axisZeroLineColor = TQColor( 0x00, 0x00, 0x80 );
169
170 _axisLabelsVisible = true;
171 _axisLabelsFont = TQFont( "helvetica", 12,
172 TQFont::Normal, false );
173 _axisLabelsFontUseRelSize = true;
174 _axisLabelsFontRelSize = 32;
175 _axisLabelsFontMinSize = 6;
176 _axisLabelsDontShrinkFont = false;
177 _axisLabelsDontAutoRotate = false;
178 _axisLabelsRotation = 0;
179 _axisLabelsColor = TQColor( 0, 0, 0 );
180
181 _axisSteadyValueCalc = true;
182 _axisValueStartIsExact = true;
183 _axisValueStart = KDCHART_AXIS_LABELS_AUTO_LIMIT;
184 _axisValueEnd = KDCHART_AXIS_LABELS_AUTO_LIMIT;
185 _axisValueDelta = KDCHART_AXIS_LABELS_AUTO_DELTA;
186 _axisValueDeltaScale = ValueScaleNumerical;
187 _axisValueLeaveOut = KDCHART_AXIS_LABELS_AUTO_LEAVEOUT;
188 _axisValuesDecreasing = false;
189
190 // First we used "h:mm:ss\nd.MM.yyyy" but now we calculate the
191 // format automatically - based on the time span to be displayed.
192 _axisLabelsDateTimeFormat = KDCHART_AXIS_LABELS_AUTO_DATETIME_FORMAT;
193
194 _axisMaxEmptyInnerSpan = 90;
195 _takeLabelsFromDataRow = LabelsFromDataRowNo;
196 _labelTextsDataRow = 0;
197 _axisLabelStringList.clear();
198 _axisShortLabelsStringList.clear();
199
204 setTrueAxisLowHighDelta( 0.0, 0.0, 0.0 );
205 setTrueAxisDtLowHighDeltaScale( TQDateTime(), TQDateTime(), ValueScaleDay );
206
207 _axisLabelsDivPow10 = 0;
208 _axisDigitsBehindComma = KDCHART_AXIS_LABELS_AUTO_DIGITS;
209 _axisLabelsNotation = KDChartEnums::NumberNotationDecimal;
210 _axisLabelsDecimalPoint = ".";
211 _axisLabelsThousandsPoint = ",";
212 _axisLabelsPrefix = "";
213 _axisLabelsPostfix = "";
214 _axisLabelsTotalLen = 0;
215 _axisLabelsPadFill = ' ';
216 _axisLabelsBlockAlign = true;
217}
218
225{
226 // Intentionally left blank for now.
227}
228
229
240void KDChartAxisParams::setAxisType( AxisType axisType )
241{
242 _axisType = axisType;
243 emit changed();
244}
245
358KDChartAxisParams::AxisPos KDChartAxisParams::basicAxisPos( uint pos )
359{
360 AxisPos ret = AxisPos( pos );
361 switch ( pos ) {
362 case AxisPosBottom:
363 case AxisPosLeft:
364 case AxisPosTop:
365 case AxisPosRight:
366 break;
367 case AxisPosLowerRightEdge:
368 ret = AxisPosRight;
369 break;
370 case AxisPosLowerLeftEdge:
371 ret = AxisPosLeft;
372 break;
373 case AxisPosBottom2:
374 ret = AxisPosBottom;
375 break;
376 case AxisPosLeft2:
377 ret = AxisPosLeft;
378 break;
379 case AxisPosTop2:
380 ret = AxisPosTop;
381 break;
382 case AxisPosRight2:
383 ret = AxisPosRight;
384 break;
385 case AxisPosLowerRightEdge2:
386 ret = AxisPosRight;
387 break;
388 case AxisPosLowerLeftEdge2:
389 ret = AxisPosLeft;
390 break;
391 default: {
392 tqDebug( "IMPLEMENTATION ERROR: type missing in KDChartAxisParams::basicAxisPos()" );
393 Q_ASSERT( ret != AxisPos( pos ) );
394 }
395 }
396 return ret;
397}
398
405void KDChartAxisParams::setAxisVisible( bool axisVisible )
406{
407 _axisVisible = axisVisible;
408 emit changed();
409}
410
418{
419 return _axisVisible;
420}
421
422
453void KDChartAxisParams::setAxisAreaMode( AxisAreaMode axisAreaMode )
454{
455 _axisAreaMode = axisAreaMode;
456 emit changed();
457}
458
459
460
468KDChartAxisParams::AxisAreaMode KDChartAxisParams::axisAreaMode() const
469{
470 return _axisAreaMode;
471}
472
479TQString KDChartAxisParams::axisAreaModeToString( AxisAreaMode mode ) {
480 switch( mode ) {
481 case AxisAreaModeFixedSize:
482 return "FixedSize";
483 case AxisAreaModeAutoSize:
484 return "AutoSize";
485 case AxisAreaModeMinMaxSize:
486 return "MinMaxSize";
487 default: // should not happen
488 tqDebug( "Unknown axis area mode" );
489 return "AxisAreaMode";
490 }
491}
492
499KDChartAxisParams::AxisAreaMode KDChartAxisParams::stringToAxisAreaMode( const TQString& type ) {
500 if( type == "FixedSize" )
501 return AxisAreaModeFixedSize;
502 else if( type == "AutoSize" )
503 return AxisAreaModeAutoSize;
504 else if( type == "MinMaxSize" )
505 return AxisAreaModeMinMaxSize;
506 else // should not happen
507 return AxisAreaModeAutoSize;
508}
509
526{
527 _axisAreaMin = axisAreaMin;
528 emit changed();
529}
530
578void KDChartAxisParams::setAxisUseAvailableSpace( int axisUseAvailableSpaceFrom,
579 int axisUseAvailableSpaceTo )
580{
581 _axisUseAvailableSpaceFrom = axisUseAvailableSpaceFrom;
582 _axisUseAvailableSpaceTo = axisUseAvailableSpaceTo;
583 emit changed();
584}
585
586
622{
623 _axisAreaMax = axisAreaMax;
624 emit changed();
625}
650void KDChartAxisParams::setAxisArea( AxisAreaMode axisAreaMode,
651 int axisAreaMin,
652 int axisAreaMax )
653{
654 _axisAreaMode = axisAreaMode;
655 _axisAreaMin = axisAreaMin;
656 _axisAreaMax = axisAreaMax;
657 emit changed();
658}
659
700void KDChartAxisParams::setAxisCalcMode( AxisCalcMode axisCalcMode )
701{
702 _axisCalcMode = axisCalcMode;
703 if( AxisCalcLogarithmic == axisCalcMode ){
704 setAxisValues( true,
707 1.0,
709 }
710 emit changed();
711}
726TQString KDChartAxisParams::axisCalcModeToString( AxisCalcMode mode ) {
727 switch( mode ) {
728 case AxisCalcLinear:
729 return "Linear";
730 case AxisCalcLogarithmic:
731 return "Logarithmic";
732 default: // should not happen
733 tqDebug( "Unknown axis calc mode" );
734 return "Linear";
735 }
736}
737
744KDChartAxisParams::AxisCalcMode KDChartAxisParams::stringToAxisCalcMode( const TQString& type ) {
745 if( type == "Linear" )
746 return AxisCalcLinear;
747 else if( type == "Logarithmic" )
748 return AxisCalcLogarithmic;
749 else // should not happen
750 return AxisCalcLinear;
751}
752
796{
797 _axisIsoRefAxis = isoRefAxis;
798 emit changed();
799}
800
876void KDChartAxisParams::setAxisShowSubDelimiters( bool axisShowSubDelimiters )
877{
878 _axisShowSubDelimiters = axisShowSubDelimiters;
879 emit changed();
880}
881
896{
897 _axisShowFractionalValuesDelimiters = axisShowFracValDelim;
898 emit changed();
899}
900
901
916void KDChartAxisParams::setAxisLineVisible( bool axisLineVisible )
917{
918 _axisLineVisible = axisLineVisible;
919 emit changed();
920}
921
922
941void KDChartAxisParams::setAxisLineWidth( int axisLineWidth )
942{
943 _axisLineWidth = axisLineWidth;
944 emit changed();
945}
946
947
984void KDChartAxisParams::setAxisLineColor( TQColor axisLineColor )
985{
986 _axisLineColor = axisLineColor;
987 emit changed();
988}
989
1014void KDChartAxisParams::setAxisShowGrid( bool axisShowGrid )
1015{
1016 _axisShowGrid = axisShowGrid;
1017 emit changed();
1018}
1019
1039void KDChartAxisParams::setAxisGridColor( TQColor axisGridColor )
1040{
1041 _axisGridColor = axisGridColor;
1042 emit changed();
1043}
1044
1064void KDChartAxisParams::setAxisGridSubColor( TQColor axisGridSubColor )
1065{
1066 _axisGridSubColor = axisGridSubColor;
1067 emit changed();
1068}
1069
1070
1106void KDChartAxisParams::setAxisGridLineWidth( int axisGridLineWidth )
1107{
1108 _axisGridLineWidth = axisGridLineWidth;
1109 emit changed();
1110}
1111
1132void KDChartAxisParams::setAxisGridSubLineWidth( int axisGridSubLineWidth )
1133{
1134 _axisGridSubLineWidth = axisGridSubLineWidth;
1135 emit changed();
1136}
1137
1138
1154void KDChartAxisParams::setAxisGridStyle( TQt::PenStyle axisGridStyle )
1155{
1156 _axisGridStyle = axisGridStyle;
1157 emit changed();
1158}
1159
1178void KDChartAxisParams::setAxisGridSubStyle( TQt::PenStyle axisGridSubStyle )
1179{
1180 _axisGridSubStyle = axisGridSubStyle;
1181 emit changed();
1182}
1183
1203void KDChartAxisParams::setAxisZeroLineColor( TQColor axisZeroLineColor )
1204{
1205 _axisZeroLineColor = axisZeroLineColor;
1206 emit changed();
1207}
1208
1226void KDChartAxisParams::setAxisLabelsVisible( bool axisLabelsVisible )
1227{
1228 _axisLabelsVisible = axisLabelsVisible;
1229 emit changed();
1230}
1231
1232
1266void KDChartAxisParams::setAxisLabelsTouchEdges( bool axisLabelsTouchEdges )
1267{
1268 _axisLabelsTouchEdges = axisLabelsTouchEdges;
1269 emit changed();
1270}
1271
1299void KDChartAxisParams::setAxisLabelsFont( TQFont axisLabelsFont, bool useFontSize )
1300{
1301 _axisLabelsFont = axisLabelsFont;
1302 _axisLabelsFontUseRelSize = ! useFontSize;
1303 emit changed();
1304}
1328void KDChartAxisParams::setAxisLabelsFontUseRelSize( bool axisLabelsFontUseRelSize )
1329{
1330 _axisLabelsFontUseRelSize = axisLabelsFontUseRelSize;
1331 emit changed();
1332}
1333
1354void KDChartAxisParams::setAxisLabelsFontRelSize( int axisLabelsFontRelSize )
1355{
1356 _axisLabelsFontRelSize = axisLabelsFontRelSize;
1357 emit changed();
1358}
1359
1360
1437void KDChartAxisParams::setAxisLabelsColor( TQColor axisLabelsColor )
1438{
1439 _axisLabelsColor = axisLabelsColor;
1440 emit changed();
1441}
1442
1465 int digitsBehindComma )
1466{
1467 _axisLabelsDivPow10 = divPow10;
1468 _axisDigitsBehindComma = digitsBehindComma;
1469 emit changed();
1470}
1471
1485void KDChartAxisParams::setAxisLabelsRadix( const TQString& decimalPoint,
1486 const TQString& thousandsPoint )
1487{
1488 _axisLabelsDecimalPoint = decimalPoint;
1489 _axisLabelsThousandsPoint = thousandsPoint;
1490}
1491
1492
1507{
1508 _axisLabelsNotation = notation;
1509}
1510
1535void KDChartAxisParams::setAxisLabelsFormat( const TQString& prefix,
1536 const TQString& postfix,
1537 const int& totalLen,
1538 const TQChar& padFill,
1539 const bool& blockAlign )
1540{
1541 _axisLabelsPrefix = prefix;
1542 _axisLabelsPostfix = postfix;
1543 _axisLabelsTotalLen = totalLen;
1544 _axisLabelsPadFill = padFill;
1545 _axisLabelsBlockAlign = blockAlign;
1546}
1547
1548
1549
1577TQString KDChartAxisParams::labelsFromDataRowToString( LabelsFromDataRow mode ) {
1578 switch( mode ) {
1579 case LabelsFromDataRowYes:
1580 return "Yes";
1581 case LabelsFromDataRowNo:
1582 return "No";
1583 case LabelsFromDataRowGuess:
1584 return "Guess";
1585 default: // should not happen
1586 tqDebug( "Unknown labels from data row mode" );
1587 return "Guess";
1588 }
1589}
1590
1597KDChartAxisParams::LabelsFromDataRow KDChartAxisParams::stringToLabelsFromDataRow( const TQString& type ) {
1598 if( type == "Yes" )
1599 return LabelsFromDataRowYes;
1600 else if( type == "No" )
1601 return LabelsFromDataRowNo;
1602 else if( type == "Guess" )
1603 return LabelsFromDataRowGuess;
1604 else // should not happen
1605 return LabelsFromDataRowGuess;
1606}
1607
1853void KDChartAxisParams::setAxisValues( bool axisSteadyValueCalc,
1854 const TQVariant& axisValueStart,
1855 const TQVariant& axisValueEnd,
1856 double axisValueDelta,
1857 int axisDigitsBehindComma,
1858 int axisMaxEmptyInnerSpan,
1859 LabelsFromDataRow takeLabelsFromDataRow,
1860 int labelTextsDataRow,
1861 TQStringList* axisLabelStringList,
1862 TQStringList* axisShortLabelsStringList,
1863 int axisValueLeaveOut,
1864 ValueScale axisValueDeltaScale )
1865{
1866 _axisSteadyValueCalc = axisSteadyValueCalc;
1867 _axisValueStart = axisValueStart;
1868 _axisValueEnd = axisValueEnd;
1869 _axisValueLeaveOut = axisValueLeaveOut;
1870 _axisValueDelta = axisValueDelta;
1871 _axisValueDeltaScale = axisValueDeltaScale;
1872 _axisDigitsBehindComma = axisDigitsBehindComma;
1874 if ( 100 < axisMaxEmptyInnerSpan
1875 || 1 > axisMaxEmptyInnerSpan )
1876 _axisMaxEmptyInnerSpan = KDCHART_AXIS_IGNORE_EMPTY_INNER_SPAN;
1877 else
1878 _axisMaxEmptyInnerSpan = axisMaxEmptyInnerSpan;
1879 }
1880 _takeLabelsFromDataRow = takeLabelsFromDataRow;
1881 _labelTextsDataRow = labelTextsDataRow;
1883 _axisLabelStringList = *axisLabelStringList;
1884 else
1885 _axisLabelStringList.clear();
1887 _axisShortLabelsStringList = *axisShortLabelsStringList;
1888 else
1889 _axisShortLabelsStringList.clear();
1890 // label texts must be recalculated?
1891 setAxisLabelTexts( 0 );
1893 setTrueAxisLowHighDelta( 0.0, 0.0, 0.0 );
1894 setTrueAxisDtLowHighDeltaScale( TQDateTime(), TQDateTime(), ValueScaleDay );
1895 emit changed();
1896}
1897
2005void KDChartAxisParams::setAxisValueDelta( const double axisValueDelta,
2006 ValueScale scale )
2007{
2008 _axisValueDelta = axisValueDelta;
2009 _axisValueDeltaScale = scale;
2010}
2011
2109void KDChartAxisParams::setTrueAxisLowHighDelta( double nLow, double nHigh, double nDelta )
2110{
2111 _trueLow = nLow;
2112 _trueHigh = nHigh;
2113 _trueDelta = nDelta;
2114
2115}
2116
2117
2150void KDChartAxisParams::setTrueAxisDtLowHighDeltaScale( TQDateTime dtLow, TQDateTime dtHigh,
2151 ValueScale dtDeltaScale )
2152{
2153 _trueDtLow = dtLow;
2154 _trueDtHigh = dtHigh;
2155 _trueDtDeltaScale = dtDeltaScale;
2156}
2157
2202{
2203 _axisZeroLineStartX = x;
2204 _axisZeroLineStartY = y;
2205}
2206
2243void KDChartAxisParams::setAxisDtLowPos( double x, double y )
2244{
2245 _axisDtLowPosX = x;
2246 _axisDtLowPosY = y;
2247}
2248
2286void KDChartAxisParams::setAxisDtHighPos( double x, double y )
2287{
2288 _axisDtHighPosX = x;
2289 _axisDtHighPosY = y;
2290}
2291
2417void KDChartAxisParams::setLabelTextsFormDataRow( int row, LabelsFromDataRow mode )
2418{
2419 _labelTextsDataRow = row;
2420 _takeLabelsFromDataRow = mode;
2421}
2422
2423
2505void KDChartAxisParams::setAxisLabelStringLists( TQStringList* axisLabelStringList,
2506 TQStringList* axisShortLabelStringList,
2507 const TQString& valueStart,
2508 const TQString& valueEnd )
2509{
2510 TQVariant axisValueStart, axisValueEnd;
2511
2512 if( valueStart.isNull() )
2514 else
2515 axisValueStart = valueStart;
2516
2517 if( valueEnd.isNull() )
2519 else
2520 axisValueEnd = valueEnd;
2521
2522 setAxisValues( false,
2528 LabelsFromDataRowNo,
2529 0,
2531 axisShortLabelStringList,
2533
2534}
2535
2536
2648void KDChartAxisParams::setAxisLabelTexts( const TQStringList* axisLabelTexts )
2649{
2650 _axisLabelTexts.clear();
2651 _axisLabelTextsDirty = ( 0 == axisLabelTexts );
2652 if ( !_axisLabelTextsDirty )
2653 _axisLabelTexts = *axisLabelTexts;
2654}
2655
2712void KDChartAxisParams::setAxisFirstLabelText( const TQString& axisFirstLabelText )
2713{
2714 _axisFirstLabelText = axisFirstLabelText;
2715}
2716
2739void KDChartAxisParams::setAxisLastLabelText( const TQString& axisLastLabelText )
2740{
2741 _axisLastLabelText = axisLastLabelText;
2742}
2743
2744
2745
2778{
2779 if ( this != &R )
2780 deepCopy( *this, R );
2781 return *this;
2782}
2783
2784void KDChartAxisParams::deepCopy( KDChartAxisParams& D, const KDChartAxisParams& R )
2785{
2786 D._axisType = R._axisType;
2787 D._axisVisible = R._axisVisible;
2788 D._axisAreaMode = R._axisAreaMode;
2789 D._axisUseAvailableSpaceFrom = R._axisUseAvailableSpaceFrom;
2790 D._axisUseAvailableSpaceTo = R._axisUseAvailableSpaceTo;
2791 D._axisAreaMin = R._axisAreaMin;
2792 D._axisAreaMax = R._axisAreaMax;
2793 D._axisCalcMode = R._axisCalcMode;
2794 D._axisIsoRefAxis = R._axisIsoRefAxis;
2795 D._axisTrueAreaSize = R._axisTrueAreaSize;
2796 D._axisTrueAreaRect = R._axisTrueAreaRect;
2797 D._axisZeroLineStartX = R._axisZeroLineStartX;
2798 D._axisZeroLineStartY = R._axisZeroLineStartY;
2799 D._axisDtLowPosX = R._axisDtLowPosX;
2800 D._axisDtLowPosY = R._axisDtLowPosY;
2801 D._axisDtHighPosX = R._axisDtHighPosX;
2802 D._axisDtHighPosY = R._axisDtHighPosY;
2803 D._axisLineVisible = R._axisLineVisible;
2804 D._axisLineWidth = R._axisLineWidth;
2805 D._axisTrueLineWidth = R._axisTrueLineWidth;
2806 D._axisLineColor = R._axisLineColor;
2807 // main grid:
2808 D._axisShowFractionalValuesDelimiters = R._axisShowFractionalValuesDelimiters;
2809 D._axisShowGrid = R._axisShowGrid;
2810 D._axisGridColor = R._axisGridColor;
2811 D._axisGridLineWidth = R._axisGridLineWidth;
2812 D._axisGridStyle = R._axisGridStyle;
2813 // sub grid:
2814 D._axisShowSubDelimiters = R._axisShowSubDelimiters;
2815 D._axisGridSubColor = R._axisGridSubColor;
2816 D._axisGridSubLineWidth = R._axisGridSubLineWidth;
2817 D._axisGridSubStyle = R._axisGridSubStyle;
2818
2819 D._axisZeroLineColor = R._axisZeroLineColor;
2820 D._axisLabelsVisible = R._axisLabelsVisible;
2821 D._axisLabelsFont = R._axisLabelsFont;
2822 D._axisLabelsFontUseRelSize = R._axisLabelsFontUseRelSize;
2823 D._axisLabelsDontShrinkFont = R._axisLabelsDontShrinkFont;
2824 D._axisLabelsDontAutoRotate = R._axisLabelsDontAutoRotate;
2825 D._axisLabelsRotation = R._axisLabelsRotation;
2826 D._axisLabelsFontRelSize = R._axisLabelsFontRelSize;
2827 D._axisLabelsFontMinSize = R._axisLabelsFontMinSize;
2828 D._axisLabelsColor = R._axisLabelsColor;
2829
2830 D._axisSteadyValueCalc = R._axisSteadyValueCalc;
2831 D._axisValueStartIsExact = R._axisValueStartIsExact;
2832 D._axisValueStart = R._axisValueStart;
2833 D._axisValueEnd = R._axisValueEnd;
2834 D._axisValueDelta = R._axisValueDelta;
2835 D._axisValueDeltaScale = R._axisValueDeltaScale;
2836 D._axisValueLeaveOut = R._axisValueLeaveOut;
2837 D._axisValuesDecreasing = R._axisValuesDecreasing;
2838 D._axisDigitsBehindComma = R._axisDigitsBehindComma;
2839 D._axisLabelsDateTimeFormat = R._axisLabelsDateTimeFormat;
2840 D._axisMaxEmptyInnerSpan = R._axisMaxEmptyInnerSpan;
2841 D._takeLabelsFromDataRow = R._takeLabelsFromDataRow;
2842 D._labelTextsDataRow = R._labelTextsDataRow;
2843 D._axisLabelStringList = R._axisLabelStringList;
2844 D._axisShortLabelsStringList = R._axisShortLabelsStringList;
2845 D._axisLabelTextsDirty = R._axisLabelTextsDirty;
2846
2847 D._axisLabelsDivPow10 = R._axisLabelsDivPow10;
2848 D._axisLabelsDecimalPoint = R._axisLabelsDecimalPoint;
2849 D._axisLabelsNotation = R._axisLabelsNotation;
2850 D._axisLabelsThousandsPoint= R._axisLabelsThousandsPoint;
2851 D._axisLabelsPrefix = R._axisLabelsPrefix;
2852 D._axisLabelsPostfix = R._axisLabelsPostfix;
2853 D._axisLabelsTotalLen = R._axisLabelsTotalLen;
2854 D._axisLabelsPadFill = R._axisLabelsPadFill;
2855 D._axisLabelsBlockAlign = R._axisLabelsBlockAlign;
2856
2857 D._axisFirstLabelText = R._axisFirstLabelText;
2858 D._axisLastLabelText = R._axisLastLabelText;
2859
2860 D._axisLabelTexts = R._axisLabelTexts;
2861 D._trueAxisDeltaPixels = R._trueAxisDeltaPixels;
2862 D._trueHigh = R._trueHigh;
2863 D._trueLow = R._trueLow;
2864 D._trueDelta = R._trueDelta;
2865 D._trueDtLow = R._trueDtLow;
2866 D._trueDtHigh = R._trueDtHigh;
2867 D._trueDtDeltaScale = R._trueDtDeltaScale;
2868}
2869
2870
2877TQString KDChartAxisParams::axisTypeToString( AxisType type ) {
2878 switch( type ) {
2879 case AxisTypeUnknown:
2880 return "Unknown";
2881 case AxisTypeEAST:
2882 return "East";
2883 case AxisTypeNORTH:
2884 return "North";
2885 case AxisUP:
2886 return "Up";
2887 default: // should not happen
2888 tqDebug( "Unknown axis type" );
2889 return "Unknown";
2890 }
2891}
2892
2899KDChartAxisParams::AxisType KDChartAxisParams::stringToAxisType( const TQString& type ) {
2900 if( type == "Unknown" )
2901 return AxisTypeUnknown;
2902 else if( type == "East" )
2903 return AxisTypeEAST;
2904 else if( type == "North" )
2905 return AxisTypeNORTH;
2906 else if( type == "Up" )
2907 return AxisUP;
2908 else // should not happen
2909 return AxisTypeUnknown;
2910}
2911
2912
2913
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.
#define KDCHART_DEFAULT_AXIS_GRID_COLOR
Use this to reset the grid colour to its default value for re-doing changes made by calling setAxisGr...
#define KDCHART_AXIS_LABELS_AUTO_DELTA
Use this to specify that the step-width from one label to the other shall be calculated automatically...
#define KDCHART_AXIS_GRID_AUTO_LINEWIDTH
Use this to specify that the width of the axis grid lines shall be equal to the width of the axis lin...
#define KDCHART_AXIS_LABELS_AUTO_DATETIME_FORMAT
Use this to specify that date/time format to be used for displaying the axis labels is to be determin...
#define KDCHART_DONT_CHANGE_EMPTY_INNER_SPAN_NOW
Use this to prevent setAxisValues from changing the current setting of _axisMaxEmptyInnerSpan.
#define KDCHART_AXIS_IGNORE_EMPTY_INNER_SPAN
Use this to specify that the zero-line shall NOT be omitted in case all of the data are grouped far a...
#define KDCHART_AXIS_LABELS_AUTO_LEAVEOUT
Use this to specify that an automatically computed amount of axis labels are to be skipped if there i...
#define KDCHART_AXIS_LABELS_AUTO_DIGITS
Use this to specify that the number of digits to be shown on the axis labels behind the comma is to b...
access the chart axis parameters.
static AxisType stringToAxisType(const TQString &type)
Converts the specified string to an axis type enum value.
TQColor axisLabelsColor() const
Returns the axis labels colour.
TQStringList axisShortLabelsStringList() const
Returns a TQStringList containing the label texts to be used in case the axis area size is too small ...
void setAxisLabelsCalc(int divPow10=0, int digitsBehindComma=KDCHART_AXIS_LABELS_AUTO_DIGITS)
Specifies the calculations to be applied to the axis labels.
TQColor axisGridColor() const
Returns the axis grid color.
TQt::PenStyle axisGridStyle() const
Returns the axis grid line pattern.
void setAxisLabelStringLists(TQStringList *axisLabelStringList, TQStringList *axisShortLabelStringList, const TQString &valueStart=TQString(), const TQString &valueEnd=TQString())
Specifies a TQStringList which the axis label texts are to be taken from, the second parameter (if no...
void setAxisDtLowPos(double x, double y)
Specifies the not-rounded screen positions where drawing of this axis low date/time value could be do...
void setAxisGridLineWidth(int axisGridLineWidth)
Specifies the width of the axis grid lines.
void setAxisShowSubDelimiters(bool axisShowSubDelimiters)
Specifies whether the axis sub-delimiters should be drawn.
void setAxisShowFractionalValuesDelimiters(bool axisShowFractValDelim)
Specifies whether the delimiters should be drawn at the position for the fractional values.
static TQString axisTypeToString(AxisType type)
Converts the specified axis type enum to a string representation.
int axisAreaMax() const
Returns the axis area maximum width (or height, resp.).
void changed()
Signals: This signal is emitted when any of the chart axis parameters have changed.
void setAxisLineColor(TQColor axisLineColor)
Specifies the axis line colour.
void setAxisCalcMode(AxisCalcMode axisCalcMode)
enum AxisCalcMode { AxisCalcLinear, AxisCalcLogarithmic }; The axis calculation mode.
void setAxisLabelsFormat(const TQString &prefix="", const TQString &postfix="", const int &totalLen=0, const TQChar &padFill=' ', const bool &blockAlign=true)
Specifies the way how the axis label strings will be formatted.
void setAxisLabelsFont(TQFont axisLabelsFont, bool useFontSize)
Specifies the axis labels font.
AxisAreaMode axisAreaMode() const
Returns the axis size mode configured in this params object.
void setAxisLineVisible(bool axisLineVisible)
Specifies whether the axis line should be drawn.
static AxisPos basicAxisPos(uint pos)
enum KDChartAxisParams::AxisPos { AxisPosSTART = 0,
TQt::PenStyle axisGridSubStyle() const
Returns the axis grid line pattern for the thin lines showing the sub-delimiter values.
void setAxisType(AxisType axisType)
Specifies the axis type.
void setAxisZeroLineColor(TQColor axisZeroLineColor)
Specifies the colour of the zero-line that is drawn if zero is not at the lower edge of the chart.
int axisGridLineWidth() const
Returns the width of the axis grid lines.
void setAxisFirstLabelText(const TQString &axisFirstLabelText=TQString())
Sets a special text that is to be displayed instead_of the first axis label IF the parameter is not a...
void setAxisGridSubLineWidth(int axisGridSubLineWidth)
Specifies the width of the thin lines between the normal axis grid lines.
static TQString labelsFromDataRowToString(LabelsFromDataRow mode)
enum LabelsFromDataRow { LabelsFromDataRowYes, LabelsFromDataRowNo, LabelsFromDataRowGuess };
void setAxisGridColor(TQColor axisGridColor)
Specifies the axis grid colour.
void setTrueAxisDeltaPixels(double nDeltaPixels)
Specifies the true axis pixel distance between two label delimiters.
void setAxisLabelTexts(const TQStringList *axisLabelTexts)
Specifies the label texts that are actually drawn at the axis labels.
TQFont axisLabelsFont() const
Returns the axis labels font.
void setAxisLabelsTouchEdges(bool axisLabelsTouchEdges)
Specifies whether the axis labels start and end at the edges of the charts instead being positioned i...
bool axisShowSubDelimiters() const
Returns whether the axis sub-delimiters will be drawn.
TQVariant axisValueStart() const
Returns the lower limit for the axis labels: the start value.
void setAxisLineWidth(int axisLineWidth)
Specifies the axis line width.
void setAxisDtHighPos(double x, double y)
Specifies the not-rounded screen positions where drawing of this axis high date/time value could be d...
void setAxisLabelsVisible(bool axisLabelsVisible)
Specifies whether the axis labels should be drawn.
int axisMaxEmptyInnerSpan() const
Returns the percentage of the y-axis range that may to contain NO data entries, if - and only if - ax...
void setAxisVisible(bool axisVisible)
Specifies if the axis will be drawn.
static LabelsFromDataRow stringToLabelsFromDataRow(const TQString &type)
Converts the specified string to a data row enum value.
double axisValueDelta() const
Returns the DELTA value for the axis labels: the distance between two labels.
KDChartAxisParams & operator=(const KDChartAxisParams &R)
Assignment operator: By calling the copy method, see also the copy constructor.
KDChartAxisParams()
enum KDChartAxisParams::Axistype { AxisTypeUnknown, AxisTypeEAST, AxisTypeNORTH, AxisUP };
int axisLabelsFontRelSize() const
Returns the axis labels relative font size.
virtual ~KDChartAxisParams()
Destructor.
bool axisLabelsFontUseRelSize() const
Returns whether the fix axis font size is used.
AxisType axisType() const
int labelTextsDataRow() const
Returns the number of the data row that contains (or might contain, resp.) the texts to be taken for ...
void setAxisUseAvailableSpace(int axisUseAvailableSpaceFrom, int axisUseAvailableSpaceTo)
Specifies how the axis will make use of the available space.
void setLabelTextsFormDataRow(int row, LabelsFromDataRow mode)
Specifies whether the axis labels are stored in a data row.
static TQString axisAreaModeToString(AxisAreaMode mode)
Converts the specified axis area mode enum to a string representation.
void setAxisAreaMin(int axisAreaMin)
Specifies the axis area minimum width (or height, resp.).
bool axisShowGrid() const
Returns whether a grid should be drawn at the chart data area.
void setAxisValueDelta(const double axisValueDelta, ValueScale scale=ValueScaleNumerical)
Specifies the DELTA value for the axis labels: the distance between two labels.
int axisGridSubLineWidth() const
Returns the axis grid sub line width.
int axisDigitsBehindComma() const
Returns the number of digits to be printed behind the comma on the axis labels.
void setAxisLastLabelText(const TQString &axisLastLabelText=TQString())
Sets a special text that is to be displayed instead_of the last axis label IF the parameter is not a ...
void setAxisArea(AxisAreaMode axisAreaMode, int axisAreaMin, int axisAreaMax)
Specifies the axis area size mode and the minimum and maximum width (or height, resp....
bool axisSteadyValueCalc() const
Returns whether label values shall be calculataed based upon the associated dataset values (normally ...
void setAxisGridStyle(TQt::PenStyle axisGridStyle)
Specifies the axis grid line pattern.
int axisLineWidth() const
Returns the axis line width.
static AxisAreaMode stringToAxisAreaMode(const TQString &type)
Converts the specified string to an axis area mode enum value.
void setAxisLabelsFontRelSize(int axisLabelsFontRelSize)
Specifies the axis labels relative font size.
void setAxisShowGrid(bool axisShowGrid)
Specifies whether a grid should be drawn at the chart data area.
int axisUseAvailableSpaceFrom() const
Returns the beginning offset of the space used by this axis in comparison to the available space that...
bool axisVisible() const
Returns weither the axis will be drawn or not.
void setAxisLabelsFontUseRelSize(bool axisLabelsFontUseRelSize)
Specifies whether axis labels shall be drawn using relative font size.
TQStringList axisLabelStringList() const
Returns a TQStringList containing the label texts to be used.
AxisCalcMode axisCalcMode() const
Returns the axis calculation mode configured in this params object.
TQColor axisLineColor() const
Returns the axis line colour.
void setAxisGridSubColor(TQColor axisGridSubColor)
Specifies the colour to be used for the thin lines between the normal axis grid lines.
void setAxisLabelsColor(TQColor axisLabelsColor)
Specifies the axis labels colour.
ValueScale axisValueDeltaScale() const
Returns the DELTA value scaling mode for the axis labels.
void setAxisAreaMax(int axisAreaMax)
Specifies the axis area maximum width (or height, resp.).
TQColor axisGridSubColor() const
Returns the axis grid sub color.
void setAxisGridSubStyle(TQt::PenStyle axisGridSubStyle)
Specifies the axis grid line pattern for the thin lines showing the sub-delimiter values.
static AxisCalcMode stringToAxisCalcMode(const TQString &type)
Converts the specified string to an axis calc mode enum value.
int axisUseAvailableSpaceTo() const
Returns the ending offset of the space used by this axis in comparison to the available space that co...
void setTrueAxisLowHighDelta(double nLow, double nHigh, double nDelta)
Specifies the true axis lower and upper limit values of the axis and the exact Delta value between th...
int axisAreaMin() const
Returns the axis area minimum width (or height, resp.).
void setIsometricReferenceAxis(uint isoRefAxis)
Specifies another axis which this axis shall be isometric with.
void setAxisAreaMode(AxisAreaMode axisAreaMode)
enum AxisAreaMode { AxisAreaModeFixedSize, AxisAreaModeAutoSize, AxisAreaModeMinMaxSize };
int axisValueLeaveOut() const
Returns how many axis labels are to be skipped if there is not enough space for displaying all of the...
TQVariant axisValueEnd() const
Returns the upper limit for the axis labels: the end value.
static TQString axisCalcModeToString(AxisCalcMode mode)
Converts the specified axis calc mode enum to a string representation.
bool axisLabelsVisible() const
Returns whether the axis labels should be drawn.
void setAxisValues(bool axisSteadyValueCalc=true, const TQVariant &axisValueStart=KDCHART_AXIS_LABELS_AUTO_LIMIT, const TQVariant &axisValueEnd=KDCHART_AXIS_LABELS_AUTO_LIMIT, double axisValueDelta=KDCHART_AXIS_LABELS_AUTO_DELTA, int axisDigitsBehindComma=KDCHART_AXIS_LABELS_AUTO_DIGITS, int axisMaxEmptyInnerSpan=KDCHART_DONT_CHANGE_EMPTY_INNER_SPAN_NOW, LabelsFromDataRow takeLabelsFromDataRow=LabelsFromDataRowNo, int labelTextsDataRow=0, TQStringList *axisLabelStringList=0, TQStringList *axisShortLabelsStringList=0, int axisValueLeaveOut=KDCHART_AXIS_LABELS_AUTO_LEAVEOUT, ValueScale axisValueDeltaScale=ValueScaleNumerical)
enum ValueScale { ValueScaleNumerical = 0, ( have gaps here to allow specifying of additional scaling...
TQColor axisZeroLineColor() const
Returns the colour used for the zero-value line that is drawn if zero is not at the lower edge of the...
bool axisLineVisible() const
Returns whether the axis line should be drawn.
void setAxisLabelsRadix(const TQString &decimalPoint, const TQString &thousandsPoint)
Specifies the way how the axis label strings will be formatted.
void setAxisLabelsNotation(KDChartEnums::NumberNotation notation)
Specifies the way how the number part of the axis label strings will be formatted.
void setAxisZeroLineStart(double x, double y)
Specifies the not-rounded screen positions where drawing of this axis zero line started.
bool axisLabelsTouchEdges() const
Returns whether the axis labels start and end at the edges of the charts instead being positioned in ...
NumberNotation
Number notation specifies the general way, how a number is to be shown.