1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
|
/*
KDChart - a multi-platform charting engine
*/
/****************************************************************************
** Copyright (C) 2001-2003 Klarälvdalens Datakonsult AB. All rights reserved.
**
** This file is part of the KDChart library.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid commercial KDChart licenses may use this file in
** accordance with the KDChart Commercial License Agreement provided with
** the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.klaralvdalens-datakonsult.se/?page=products for
** information about KDChart Commercial License Agreements.
**
** Contact info@klaralvdalens-datakonsult.se if any conditions of this
** licensing are not clear to you.
**
**********************************************************************/
#include "KDChartParams.h"
#include <KDXMLTools.h>
#include <tqintdict.h>
/**
\fn TQTextStream& operator<<( TQTextStream& s, const KDChartParams& p );
Writes the KDChartParams object p as an XML document to the text stream s.
\param s the text stream to write to
\param p the KDChartParams object to write
\return the text stream after the write operation
*/
TQTextStream& operator<<( TQTextStream& s, const KDChartParams& p )
{
TQDomDocument document = p.saveXML();
s << document.toString();
return s;
}
/**
Helper method saving the axis parameters to an XML file,
this is called by saveXML() only.
*/
void KDChartParams::saveAxesToXML(TQDomDocument& doc, TQDomElement& docRoot) const
{
// the AxisSettings elements
for( int axis = 0; axis < 13; axis++ ) {
TQDomElement axisSettingsElement =
doc.createElement( "AxisSettings" );
docRoot.appendChild( axisSettingsElement );
axisSettingsElement.setAttribute( "Dataset",
_axisSettings[axis].dataset );
axisSettingsElement.setAttribute( "Dataset2",
_axisSettings[axis].dataset2 );
axisSettingsElement.setAttribute( "Chart",
_axisSettings[axis].chart );
{
// the Type element
KDXML::createStringNode( doc, axisSettingsElement, "Type",
KDChartAxisParams::axisTypeToString( _axisSettings[axis].params._axisType ) );
// the Visible element
KDXML::createBoolNode( doc, axisSettingsElement, "Visible",
_axisSettings[axis].params._axisVisible );
// the LabelsTouchEdges element
KDXML::createBoolNode( doc, axisSettingsElement, "LabelsTouchEdges",
_axisSettings[axis].params._axisLabelsTouchEdges );
// the AreaMode element
KDXML::createStringNode( doc, axisSettingsElement, "AreaMode",
KDChartAxisParams::axisAreaModeToString( _axisSettings[axis].params._axisAreaMode ) );
// the UseAvailableSpaceFrom element
KDXML::createIntNode( doc, axisSettingsElement, "UseAvailableSpaceFrom",
_axisSettings[axis].params._axisUseAvailableSpaceFrom );
// the UseAvailableSpaceTo element
KDXML::createIntNode( doc, axisSettingsElement, "UseAvailableSpaceTo",
_axisSettings[axis].params._axisUseAvailableSpaceTo );
// the IsometricReferenceAxis element
KDXML::createIntNode( doc, axisSettingsElement, "IsometricReferenceAxis",
_axisSettings[axis].params._axisIsoRefAxis );
// the AreaMin element
KDXML::createIntNode( doc, axisSettingsElement, "AreaMin",
_axisSettings[axis].params._axisAreaMin );
// the AreaMax element
KDXML::createIntNode( doc, axisSettingsElement, "AreaMax",
_axisSettings[axis].params._axisAreaMax );
// the CalcMode element
KDXML::createStringNode( doc, axisSettingsElement, "CalcMode",
KDChartAxisParams::axisCalcModeToString( _axisSettings[axis].params._axisCalcMode ) );
// the TrueAreaSize element
KDXML::createIntNode( doc, axisSettingsElement, "TrueAreaSize",
_axisSettings[axis].params._axisTrueAreaSize );
// the TrueAreaRect element
KDXML::createRectNode( doc, axisSettingsElement, "TrueAreaRect",
_axisSettings[axis].params._axisTrueAreaRect );
// the ShowSubDelimiters element
KDXML::createBoolNode( doc, axisSettingsElement, "ShowSubDelimiters",
_axisSettings[axis].params._axisShowSubDelimiters );
// the LineVisible element
KDXML::createBoolNode( doc, axisSettingsElement, "LineVisible",
_axisSettings[axis].params._axisLineVisible );
// the LineWidth element
KDXML::createIntNode( doc, axisSettingsElement, "LineWidth",
_axisSettings[axis].params._axisLineWidth );
// the TrueLineWidth element
KDXML::createIntNode( doc, axisSettingsElement, "TrueLineWidth",
_axisSettings[axis].params._axisTrueLineWidth );
// the LineColor element
KDXML::createColorNode( doc, axisSettingsElement, "LineColor",
_axisSettings[axis].params._axisLineColor );
// the ShowGrid element
KDXML::createBoolNode( doc, axisSettingsElement, "ShowGrid",
_axisSettings[axis].params._axisShowGrid );
// the GridColor element
KDXML::createColorNode( doc, axisSettingsElement, "GridColor",
_axisSettings[axis].params._axisGridColor );
// the GridLineWidth element
KDXML::createIntNode( doc, axisSettingsElement, "GridLineWidth",
_axisSettings[axis].params._axisGridLineWidth );
// the GridStyle element
KDXML::createStringNode( doc, axisSettingsElement, "GridStyle",
KDXML::penStyleToString( _axisSettings[axis].params._axisGridStyle ) );
// the GridSubColor element
KDXML::createColorNode( doc, axisSettingsElement, "GridSubColor",
_axisSettings[axis].params._axisGridSubColor );
// the GridSubLineWidth element
KDXML::createIntNode( doc, axisSettingsElement, "GridSubLineWidth",
_axisSettings[axis].params._axisGridSubLineWidth );
// the GridSubStyle element
KDXML::createStringNode( doc, axisSettingsElement, "GridSubStyle",
KDXML::penStyleToString( _axisSettings[axis].params._axisGridSubStyle ) );
// the ZeroLineColor element
KDXML::createColorNode( doc, axisSettingsElement, "ZeroLineColor",
_axisSettings[axis].params._axisZeroLineColor );
// the LabelsVisible element
KDXML::createBoolNode( doc, axisSettingsElement, "LabelsVisible",
_axisSettings[axis].params._axisLabelsVisible );
// the LabelsFont element
createChartFontNode( doc, axisSettingsElement, "LabelsFont",
_axisSettings[axis].params._axisLabelsFont,
_axisSettings[axis].params._axisLabelsFontUseRelSize,
_axisSettings[axis].params._axisLabelsFontRelSize,
_axisSettings[axis].params._axisLabelsFontMinSize );
// the LabelsDontShrinkFont element
KDXML::createBoolNode( doc, axisSettingsElement, "LabelsDontShrinkFont",
_axisSettings[axis].params._axisLabelsDontShrinkFont );
// the LabelsDontAutoRotate element
KDXML::createBoolNode( doc, axisSettingsElement, "LabelsDontAutoRotate",
_axisSettings[axis].params._axisLabelsDontAutoRotate );
// the LabelsRotation element
KDXML::createIntNode( doc, axisSettingsElement, "LabelsRotation",
_axisSettings[axis].params._axisLabelsRotation );
// the LabelsLeaveOut element
KDXML::createIntNode( doc, axisSettingsElement, "LabelsLeaveOut",
_axisSettings[axis].params._axisValueLeaveOut );
// the LabelsColor element
KDXML::createColorNode( doc, axisSettingsElement, "LabelsColor",
_axisSettings[axis].params._axisLabelsColor );
// the SteadyValueCalc element
KDXML::createBoolNode( doc, axisSettingsElement, "SteadyValueCalc",
_axisSettings[axis].params._axisSteadyValueCalc );
// the ValueStart element
if( ! ( KDCHART_AXIS_LABELS_AUTO_LIMIT == _axisSettings[axis].params._axisValueStart ))
createChartValueNode( doc, axisSettingsElement, "ValueStart",
_axisSettings[axis].params._axisValueStart,
0.0,
0 );
// the ValueStartIsExact element
KDXML::createBoolNode( doc, axisSettingsElement, "ValueStartIsExact",
_axisSettings[axis].params._axisValueStartIsExact );
// the ValueEnd element
if( ! ( KDCHART_AXIS_LABELS_AUTO_LIMIT == _axisSettings[axis].params._axisValueEnd ))
createChartValueNode( doc, axisSettingsElement, "ValueEnd",
_axisSettings[axis].params._axisValueEnd,
0.0,
0 );
// the ValueDelta element
if( ! ( KDCHART_AXIS_LABELS_AUTO_DELTA == _axisSettings[axis].params._axisValueDelta ))
KDXML::createDoubleNode( doc, axisSettingsElement, "ValueDelta",
_axisSettings[axis].params._axisValueDelta );
KDXML::createIntNode( doc, axisSettingsElement, "ValueDeltaScale",
_axisSettings[axis].params._axisValueDeltaScale );
// the ValuesDecreasing element
KDXML::createBoolNode( doc, axisSettingsElement, "ValuesDecreasing",
_axisSettings[axis].params._axisValuesDecreasing );
// the TrueLow element
KDXML::createDoubleNode( doc, axisSettingsElement, "TrueLow",
_axisSettings[axis].params._trueLow );
// the TrueHigh element
KDXML::createDoubleNode( doc, axisSettingsElement, "TrueHigh",
_axisSettings[axis].params._trueHigh );
// the TrueDelta element
KDXML::createDoubleNode( doc, axisSettingsElement, "TrueDelta",
_axisSettings[axis].params._trueDelta );
// the ZeroLineStart element
TQDomElement zeroLineStartElement = doc.createElement( "ZeroLineStart" );
axisSettingsElement.appendChild( zeroLineStartElement );
zeroLineStartElement.setAttribute( "X", _axisSettings[axis].params._axisZeroLineStartX );
zeroLineStartElement.setAttribute( "Y", _axisSettings[axis].params._axisZeroLineStartY );
// the DigitsBehindComma element
KDXML::createIntNode( doc, axisSettingsElement, "DigitsBehindComma",
_axisSettings[axis].params._axisDigitsBehindComma );
// the LabelsDateTimeFormat element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsDateTimeFormat",
_axisSettings[axis].params._axisLabelsDateTimeFormat );
// the MaxEmptyInnerSpan element
KDXML::createIntNode( doc, axisSettingsElement, "MaxEmptyInnerSpan",
_axisSettings[axis].params._axisMaxEmptyInnerSpan );
// the LabelsFromDataRow element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsFromDataRow",
KDChartAxisParams::labelsFromDataRowToString( _axisSettings[axis].params._takeLabelsFromDataRow ) );
// the TextsDataRow element
KDXML::createIntNode( doc, axisSettingsElement, "TextsDataRow",
_axisSettings[axis].params._labelTextsDataRow );
// the LabelString elements
KDXML::createStringListNodes( doc, axisSettingsElement, "LabelString",
&_axisSettings[axis].params._axisLabelStringList );
// the ShortLabelString elements
KDXML::createStringListNodes( doc, axisSettingsElement, "ShortLabelString",
&_axisSettings[axis].params._axisShortLabelsStringList );
// the LabelText elements
KDXML::createStringListNodes( doc, axisSettingsElement, "LabelText",
&_axisSettings[axis].params._axisLabelTexts );
// the LabelTextsDirty element
KDXML::createBoolNode( doc, axisSettingsElement, "LabelTextsDirty",
_axisSettings[axis].params._axisLabelTextsDirty );
// labels formatting:
// the extra FirstLabelText element
KDXML::createStringNode( doc, axisSettingsElement, "FirstLabelReplacementText",
_axisSettings[axis].params._axisFirstLabelText );
// the extra LastLabelText element
KDXML::createStringNode( doc, axisSettingsElement, "LastLabelReplacementText",
_axisSettings[axis].params._axisLastLabelText );
// the LabelsDivPow10 element
KDXML::createIntNode( doc, axisSettingsElement, "LabelsDivPow10",
_axisSettings[axis].params._axisLabelsDivPow10 );
// the LabelsDecimalPoint element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsDecimalPoint",
_axisSettings[axis].params._axisLabelsDecimalPoint );
// the LabelsThousandsPoint element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsThousandsPoint",
_axisSettings[axis].params._axisLabelsThousandsPoint );
// the LabelsNotation element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsNotation",
KDChartEnums::numberNotationToString( _axisSettings[axis].params._axisLabelsNotation ) );
// the LabelsPrefix element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsPrefix",
_axisSettings[axis].params._axisLabelsPrefix );
// the LabelsPostfix element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsPostfix",
_axisSettings[axis].params._axisLabelsPostfix );
// the LabelsTotalLen element
KDXML::createIntNode( doc, axisSettingsElement, "LabelsTotalLen",
_axisSettings[axis].params._axisLabelsTotalLen );
// the LabelsPadFill element
KDXML::createStringNode( doc, axisSettingsElement, "LabelsPadFill",
_axisSettings[axis].params._axisLabelsPadFill );
// the LabelsBlockAlign element
KDXML::createBoolNode( doc, axisSettingsElement, "LabelsBlockAlign",
_axisSettings[axis].params._axisLabelsBlockAlign );
}
}
}
/**
Saves the parameters to an XML document.
\return the XML document that represents the parameters
\sa loadXML
*/
TQDomDocument KDChartParams::saveXML( bool withPI ) const
{
// Create an inital DOM document
TQString docstart = "<ChartParams/>";
TQDomDocument doc( "ChartParams" );
doc.setContent( docstart );
if( withPI )
doc.appendChild( doc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
TQDomElement docRoot = doc.documentElement();
docRoot.setAttribute( "xmlns", "http://www.klaralvdalens-datakonsult.se/kdchart" );
docRoot.setAttribute( "xmlns:xsi", "http://www.w3.org/2000/10/XMLSchema-instance" );
docRoot.setAttribute( "xsi:schemaLocation", "http://www.klaralvdalens-datakonsult.se/kdchart" );
// the ChartType element
TQDomElement chartTypeElement = doc.createElement( "ChartType" );
docRoot.appendChild( chartTypeElement );
chartTypeElement.setAttribute( "primary",
chartTypeToString( _chartType ) );
chartTypeElement.setAttribute( "secondary",
chartTypeToString( _additionalChartType ) );
// the NumValues element
KDXML::createIntNode( doc, docRoot, "NumValues", _numValues );
// the ModeAndChartMap element
TQDomElement modeAndChartMapElement =
doc.createElement( "ModeAndChartMap" );
docRoot.appendChild( modeAndChartMapElement );
for( TQMap<uint,KDChartParams::ModeAndChart>::ConstIterator it = _dataSourceModeAndChart.begin();
it != _dataSourceModeAndChart.end(); ++it ) {
// Dataset element
TQDomElement datasetElement = doc.createElement( "Dataset" );
TQDomText datasetContent =
doc.createTextNode( TQString::number( it.key() ) );
datasetElement.appendChild( datasetContent );
modeAndChartMapElement.appendChild( datasetElement );
// ModeAndChart element
TQDomElement modeAndChartElement = doc.createElement( "ModeAndChart" );
modeAndChartElement.setAttribute( "Mode", chartSourceModeToString( it.data().mode() ) );
modeAndChartElement.setAttribute( "Chart", it.data().chart() );
modeAndChartMapElement.appendChild( modeAndChartElement );
}
// the PropertySetMap element
TQDomElement propertySetMapElement =
doc.createElement( "PropertySetMap" );
docRoot.appendChild( propertySetMapElement );
TQIntDictIterator<KDChartPropertySet> it2( _propertySetList );
for( ; it2.current(); ++it2 )
propertySetMapElement.appendChild( it2.current()->saveXML( doc ) );
KDXML::createBoolNode( doc, docRoot, "ChartSourceModeWasUsed",
_setChartSourceModeWasUsed );
// the MaxDatasetSourceMode element
KDXML::createIntNode( doc, docRoot, "MaxDatasetSourceMode",
_maxDatasetSourceMode );
// the ColorSettings element
TQDomElement colorSettingsElement =
doc.createElement( "ColorSettings" );
docRoot.appendChild( colorSettingsElement );
{
// the DataColors element
createColorMapNode( doc, colorSettingsElement,
"DataColors", _dataColors );
// the MaxDatasetColor element
KDXML::createIntNode( doc, colorSettingsElement, "MaxDatasetColor",
_maxDatasetColor );
// the ShadowBrightnessFactor element
KDXML::createDoubleNode( doc, colorSettingsElement,
"ShadowBrightnessFactor",
_shadowBrightnessFactor );
// the ShadowPattern element
KDXML::createStringNode( doc, colorSettingsElement,
"ShadowPattern",
KDXML::brushStyleToString(_shadowPattern ) );
// the ThreeDShadowColors element
KDXML::createBoolNode( doc, colorSettingsElement,
"ThreeDShadowColors",
_threeDShadowColors );
// the DataColorsShadow1 element
createColorMapNode( doc, colorSettingsElement,
"DataColorsShadow1",
_dataColorsShadow1 );
// the DataColorsShadow2 element
createColorMapNode( doc, colorSettingsElement,
"DataColorsShadow2",
_dataColorsShadow2 );
// the OutlineDataColor element
KDXML::createColorNode( doc, colorSettingsElement,
"OutlineDataColor",
_outlineDataColor );
// the OutlineDataLineWidth element
KDXML::createIntNode( doc, colorSettingsElement,
"OutlineDataLineWidth",
_outlineDataLineWidth );
// the OutlineDataLineStyle element
TQDomElement outlineDataLineStyleElement =
doc.createElement( "OutlineDataLineStyle" );
colorSettingsElement.appendChild( outlineDataLineStyleElement );
outlineDataLineStyleElement.setAttribute( "Style",
KDXML::penStyleToString( _outlineDataLineStyle ) );
}
// the BarSettings elemenet
TQDomElement barSettingsElement =
doc.createElement( "BarSettings" );
docRoot.appendChild( barSettingsElement );
{
// the SubType element
KDXML::createStringNode( doc, barSettingsElement,
"SubType", KDChartParams::barChartSubTypeToString( _barChartSubType ) );
KDXML::createBoolNode( doc, barSettingsElement,
"ThreeDBars", _threeDBars );
KDXML::createDoubleNode( doc, barSettingsElement,
"ThreeDBarDepth", _threeDBarDepth );
KDXML::createIntNode( doc, barSettingsElement,
"DatasetGap", _datasetGap );
KDXML::createBoolNode( doc, barSettingsElement,
"DatasetGapIsRelative", _datasetGapIsRelative );
KDXML::createIntNode( doc, barSettingsElement,
"ValueBlockGap", _valueBlockGap );
KDXML::createBoolNode( doc, barSettingsElement,
"ValueBlockGapIsRelative",
_valueBlockGapIsRelative );
KDXML::createIntNode( doc, barSettingsElement,
"BarWidth", _barWidth );
KDXML::createBoolNode( doc, barSettingsElement,
"SolidExcessArrows", _solidExcessArrows );
}
// the LineSettings element
TQDomElement lineSettingsElement =
doc.createElement( "LineSettings" );
docRoot.appendChild( lineSettingsElement );
{
// the SubType element
KDXML::createStringNode( doc, lineSettingsElement,
"SubType", KDChartParams::lineChartSubTypeToString( _lineChartSubType ) );
// the Marker element
KDXML::createBoolNode( doc, lineSettingsElement,
"Marker", _lineMarker );
// the MarkerStyles elements
{for( TQMap<uint,KDChartParams::LineMarkerStyle>::ConstIterator it = _lineMarkerStyles.begin();
it != _lineMarkerStyles.end(); ++it ) {
TQDomElement markerStyleElement = doc.createElement( "MarkerStyle" );
lineSettingsElement.appendChild( markerStyleElement );
markerStyleElement.setAttribute( "Dataset", it.key() );
markerStyleElement.setAttribute( "Style", KDChartParams::lineMarkerStyleToString( it.data() ) );
}}
// the MarkerSize element
KDXML::createSizeNode( doc, lineSettingsElement,
"MarkerSize", _lineMarkerSize );
// the LineWidth element
KDXML::createIntNode( doc, lineSettingsElement,
"LineWidth", _lineWidth );
// the LineColor element
KDXML::createColorNode( doc, lineSettingsElement,
"LineColor",
_lineColor );
// the LineStyle element
TQDomElement lineStyleElement =
doc.createElement( "LineStyle" );
lineSettingsElement.appendChild( lineStyleElement );
lineStyleElement.setAttribute( "Style",
KDXML::penStyleToString( _lineStyle ) );
// the DatasetLineStyles elements
{for( TQMap<uint, Qt::PenStyle>::ConstIterator it = _datasetLineStyles.begin();
it != _datasetLineStyles.end(); ++it ) {
TQDomElement lineStyleElement = doc.createElement( "DatasetLineStyle" );
lineSettingsElement.appendChild( lineStyleElement );
lineStyleElement.setAttribute( "Dataset", it.key() );
lineStyleElement.setAttribute( "Style", KDXML::penStyleToString( it.data() ) );
}}
// the ThreeD element
KDXML::createBoolNode( doc, lineSettingsElement,
"ThreeD", _threeDLines );
// the ThreeDDepth element
KDXML::createIntNode( doc, lineSettingsElement,
"ThreeDDepth", _threeDLineDepth );
// the ThreeDXRotation element
KDXML::createIntNode( doc, lineSettingsElement,
"ThreeDXRotation", _threeDLineXRotation );
// the ThreeDYRotation element
KDXML::createIntNode( doc, lineSettingsElement,
"ThreeDYRotation", _threeDLineYRotation );
}
// the AreaSettings element
TQDomElement areaSettingsElement =
doc.createElement( "AreaSettings" );
docRoot.appendChild( areaSettingsElement );
{
// the SubType element
KDXML::createStringNode( doc, areaSettingsElement, "SubType",
KDChartParams::areaChartSubTypeToString( _areaChartSubType ) );
// the Location elemenet
KDXML::createStringNode( doc, areaSettingsElement, "Location",
KDChartParams::areaLocationToString( _areaLocation ) );
}
// the PieRingSettings element
TQDomElement pieRingSettingsElement =
doc.createElement( "PieRingSettings" );
docRoot.appendChild( pieRingSettingsElement );
{
// the Explode element
KDXML::createBoolNode( doc, pieRingSettingsElement, "Explode",
_explode );
// the DefaultExplodeFactor element
KDXML::createDoubleNode( doc, pieRingSettingsElement, "DefaultExplodeFactor",
_explodeFactor );
// the ExplodeFactors element
createDoubleMapNode( doc, pieRingSettingsElement, "ExplodeFactors",
_explodeFactors );
// the ExplodeSegment element
for( TQValueList<int>::ConstIterator it = _explodeList.begin();
it != _explodeList.end(); ++it )
KDXML::createIntNode( doc, pieRingSettingsElement,
"ExplodeSegment", *it );
// the ThreeDPies element
KDXML::createBoolNode( doc, pieRingSettingsElement, "ThreeDPies",
_threeDPies );
// the ThreeDPieHeight element
KDXML::createIntNode( doc, pieRingSettingsElement, "ThreeDPieHeight",
_threeDPieHeight );
// the PieStart element
KDXML::createIntNode( doc, pieRingSettingsElement, "PieStart",
_pieStart );
// the RingStart element
KDXML::createIntNode( doc, pieRingSettingsElement, "RingStart",
_ringStart );
// the RelativeRingThickness element
KDXML::createBoolNode( doc, pieRingSettingsElement,
"RelativeRingThickness", _relativeRingThickness );
}
// the HiLoSettings element
TQDomElement hiLoSettingsElement =
doc.createElement( "HiLoSettings" );
docRoot.appendChild( hiLoSettingsElement );
{
// the SubType element
KDXML::createStringNode( doc, hiLoSettingsElement, "SubType",
KDChartParams::hiLoChartSubTypeToString( _hiLoChartSubType ) );
// the PrintLowValues element
KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintLowValues",
_hiLoChartPrintLowValues );
// the LowValuesFont element
createChartFontNode( doc, hiLoSettingsElement, "LowValuesFont",
_hiLoChartLowValuesFont,
_hiLoChartLowValuesUseFontRelSize,
_hiLoChartLowValuesFontRelSize );
// the LowValuesColor element
KDXML::createColorNode( doc, hiLoSettingsElement, "LowValuesColor",
_hiLoChartLowValuesColor );
// the PrintHighValues element
KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintHighValues",
_hiLoChartPrintHighValues );
// the HighValuesFont element
createChartFontNode( doc, hiLoSettingsElement, "HighValuesFont",
_hiLoChartHighValuesFont,
_hiLoChartHighValuesUseFontRelSize,
_hiLoChartHighValuesFontRelSize );
// the HighValuesColor element
KDXML::createColorNode( doc, hiLoSettingsElement, "HighValuesColor",
_hiLoChartHighValuesColor );
// the PrintOpenValues element
KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintOpenValues",
_hiLoChartPrintOpenValues );
// the OpenValuesFont element
createChartFontNode( doc, hiLoSettingsElement, "OpenValuesFont",
_hiLoChartOpenValuesFont,
_hiLoChartOpenValuesUseFontRelSize,
_hiLoChartOpenValuesFontRelSize );
// the OpenValuesColor element
KDXML::createColorNode( doc, hiLoSettingsElement, "OpenValuesColor",
_hiLoChartOpenValuesColor );
// the PrintCloseValues element
KDXML::createBoolNode( doc, hiLoSettingsElement, "PrintCloseValues",
_hiLoChartPrintCloseValues );
// the CloseValuesFont element
createChartFontNode( doc, hiLoSettingsElement, "CloseValuesFont",
_hiLoChartCloseValuesFont,
_hiLoChartCloseValuesUseFontRelSize,
_hiLoChartCloseValuesFontRelSize );
// the CloseValuesColor element
KDXML::createColorNode( doc, hiLoSettingsElement, "CloseValuesColor",
_hiLoChartCloseValuesColor );
}
// the BoxAndWhiskerSettings element
TQDomElement bWSettingsElement =
doc.createElement( "BoxAndWhiskerSettings" );
docRoot.appendChild( bWSettingsElement );
{
// the SubType element
KDXML::createStringNode( doc, bWSettingsElement, "SubType",
KDChartParams::bWChartSubTypeToString( _BWChartSubType ) );
// the fences elements
KDXML::createDoubleNode( doc, bWSettingsElement, "FenceUpperInner",
_BWChartFenceUpperInner );
KDXML::createDoubleNode( doc, bWSettingsElement, "FenceLowerInner",
_BWChartFenceLowerInner );
KDXML::createDoubleNode( doc, bWSettingsElement, "FenceUpperOuter",
_BWChartFenceUpperInner );
KDXML::createDoubleNode( doc, bWSettingsElement, "FenceLowerOuter",
_BWChartFenceLowerOuter );
// the brush to be used
KDXML::createBrushNode( doc, bWSettingsElement, "Brush",
_BWChartBrush );
// the size of the outlier markers
KDXML::createIntNode( doc, bWSettingsElement, "OutlierSize",
_BWChartOutValMarkerSize );
// the PrintStatistics elements
for( int i = BWStatValSTART; i <= BWStatValEND; ++i ){
TQDomElement printStatElement =
doc.createElement( "PrintStatistics"+bWChartStatValToString( (BWStatVal)i ) );
KDXML::createBoolNode( doc, printStatElement, "Active",
_BWChartStatistics[ i ].active );
createChartFontNode( doc, printStatElement, "Font",
_BWChartStatistics[ i ].font,
_BWChartStatistics[ i ].useRelSize,
_BWChartStatistics[ i ].relSize );
KDXML::createColorNode( doc, printStatElement, "Color",
_BWChartStatistics[ i ].color );
KDXML::createBrushNode( doc, printStatElement, "Brush",
_BWChartStatistics[ i ].brush );
}
}
// the PolarSettings element
TQDomElement polarSettingsElement =
doc.createElement( "PolarSettings" );
docRoot.appendChild( polarSettingsElement );
{
// the SubType element
KDXML::createStringNode( doc, polarSettingsElement,
"SubType", KDChartParams::polarChartSubTypeToString( _polarChartSubType ) );
// the Marker element
KDXML::createBoolNode( doc, polarSettingsElement,
"Marker", _polarMarker );
// the MarkerStyles elements
for( TQMap<uint,KDChartParams::PolarMarkerStyle>::ConstIterator it = _polarMarkerStyles.begin();
it != _polarMarkerStyles.end(); ++it ) {
TQDomElement markerStyleElement = doc.createElement( "MarkerStyle" );
polarSettingsElement.appendChild( markerStyleElement );
markerStyleElement.setAttribute( "Dataset", it.key() );
markerStyleElement.setAttribute( "Style", KDChartParams::polarMarkerStyleToString( it.data() ) );
}
// the MarkerSize element
KDXML::createSizeNode( doc, polarSettingsElement,
"MarkerSize", _polarMarkerSize );
// the PolarLineWidth element
KDXML::createIntNode( doc, polarSettingsElement,
"PolarLineWidth", _polarLineWidth );
}
// the LegendSettings element
TQDomElement legendSettingsElement =
doc.createElement( "LegendSettings" );
docRoot.appendChild( legendSettingsElement );
{
// the Position element
KDXML::createStringNode( doc, legendSettingsElement, "Position",
KDChartParams::legendPositionToString( _legendPosition ) );
// the Qt::Orientation element
KDXML::createOrientationNode( doc, legendSettingsElement,
"Orientation", _legendOrientation );
// the ShowLines element
KDXML::createBoolNode( doc, legendSettingsElement,
"ShowLines", _legendShowLines );
// the Source element
KDXML::createStringNode( doc, legendSettingsElement, "Source",
KDChartParams::legendSourceToString( _legendSource ) );
// the Text elements
for( TQMap<int,TQString>::ConstIterator it = _legendText.begin();
it != _legendText.end(); ++it ) {
TQDomElement legendTextElement = doc.createElement( "LegendText" );
legendSettingsElement.appendChild( legendTextElement );
legendTextElement.setAttribute( "Dataset", it.key() );
legendTextElement.setAttribute( "Text", it.data() );
}
// the TextColor element
KDXML::createColorNode( doc, legendSettingsElement, "TextColor",
_legendTextColor );
// the TextFont element
createChartFontNode( doc, legendSettingsElement, "TextFont",
_legendFont,
_legendFontUseRelSize,
_legendFontRelSize );
// the TitleText element
KDXML::createStringNode( doc, legendSettingsElement, "TitleText",
_legendTitleText );
// the TitleColor element
KDXML::createColorNode( doc, legendSettingsElement, "TitleColor",
_legendTitleTextColor );
// the TitleFont element
createChartFontNode( doc, legendSettingsElement, "TitleFont",
_legendTitleFont,
_legendTitleFontUseRelSize,
_legendTitleFontRelSize );
// the Spacing element
KDXML::createIntNode( doc, legendSettingsElement, "Spacing",
_legendSpacing );
}
saveAxesToXML(doc, docRoot);
// the HeaderFooterSettings elements
for( int hf = 0; hf < 18; hf++ ) {
TQDomElement hfSettingsElement =
doc.createElement( "HeaderFooterSettings" );
docRoot.appendChild( hfSettingsElement );
{
KDXML::createStringNode( doc, hfSettingsElement, "Text",
_hdFtParams[hf]._text );
createChartFontNode( doc, hfSettingsElement, "Font",
_hdFtParams[hf]._font,
_hdFtParams[hf]._fontUseRelSize,
_hdFtParams[hf]._fontRelSize );
KDXML::createColorNode( doc, hfSettingsElement, "Color",
_hdFtParams[hf]._color );
}
}
// the GlobalLeading element
TQDomElement globalLeadingElement =
doc.createElement( "GlobalLeading" );
docRoot.appendChild( legendSettingsElement );
{
KDXML::createIntNode( doc, globalLeadingElement, "Left",
_globalLeadingLeft );
KDXML::createIntNode( doc, globalLeadingElement, "Top",
_globalLeadingTop );
KDXML::createIntNode( doc, globalLeadingElement, "Right",
_globalLeadingRight );
KDXML::createIntNode( doc, globalLeadingElement, "Bottom",
_globalLeadingBottom );
}
// the DataValuesSettings1 element
TQDomElement dataValuesSettings1Element =
doc.createElement( "DataValuesSettings1" );
docRoot.appendChild( dataValuesSettings1Element );
{
KDXML::createBoolNode( doc, dataValuesSettings1Element, "PrintDataValues",
_printDataValuesSettings._printDataValues );
KDXML::createIntNode( doc, dataValuesSettings1Element, "DivPow10",
_printDataValuesSettings._divPow10 );
KDXML::createIntNode( doc, dataValuesSettings1Element, "DigitsBehindComma",
_printDataValuesSettings._digitsBehindComma );
createChartFontNode( doc, dataValuesSettings1Element, "Font",
_printDataValuesSettings._dataValuesFont,
_printDataValuesSettings._dataValuesUseFontRelSize,
_printDataValuesSettings._dataValuesFontRelSize );
KDXML::createColorNode( doc, dataValuesSettings1Element, "Color",
_printDataValuesSettings._dataValuesColor );
KDXML::createBrushNode( doc, dataValuesSettings1Element, "Background",
_printDataValuesSettings._dataValuesBrush );
KDXML::createBoolNode( doc, dataValuesSettings1Element, "AutoColor",
_printDataValuesSettings._dataValuesAutoColor );
KDXML::createStringNode( doc, dataValuesSettings1Element,
"AnchorNegativePosition",
KDChartEnums::positionFlagToString( _printDataValuesSettings._dataValuesAnchorNegativePosition ) );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"AnchorNegativeAlign",
_printDataValuesSettings._dataValuesAnchorNegativeAlign );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"AnchorNegativeDeltaX",
_printDataValuesSettings._dataValuesAnchorNegativeDeltaX );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"AnchorNegativeDeltaY",
_printDataValuesSettings._dataValuesAnchorNegativeDeltaY );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"NegativeRotation",
_printDataValuesSettings._dataValuesNegativeRotation );
KDXML::createStringNode( doc, dataValuesSettings1Element,
"AnchorPositivePosition",
KDChartEnums::positionFlagToString( _printDataValuesSettings._dataValuesAnchorPositivePosition ) );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"AnchorPositiveAlign",
_printDataValuesSettings._dataValuesAnchorPositiveAlign );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"AnchorPositiveDeltaX",
_printDataValuesSettings._dataValuesAnchorPositiveDeltaX );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"AnchorPositiveDeltaY",
_printDataValuesSettings._dataValuesAnchorPositiveDeltaY );
KDXML::createIntNode( doc, dataValuesSettings1Element,
"PositiveRotation",
_printDataValuesSettings._dataValuesPositiveRotation );
KDXML::createStringNode( doc, dataValuesSettings1Element,
"LayoutPolicy",
KDChartEnums::layoutPolicyToString( _printDataValuesSettings._dataValuesLayoutPolicy ) );
KDXML::createBoolNode( doc, dataValuesSettings1Element, "ShowInfinite",
_printDataValuesSettings._dataValuesShowInfinite );
}
// the DataValuesSettings2 element
TQDomElement dataValuesSettings2Element =
doc.createElement( "DataValuesSettings2" );
docRoot.appendChild( dataValuesSettings2Element );
{
KDXML::createBoolNode( doc, dataValuesSettings2Element, "PrintDataValues",
_printDataValuesSettings2._printDataValues );
KDXML::createIntNode( doc, dataValuesSettings2Element, "DivPow10",
_printDataValuesSettings2._divPow10 );
KDXML::createIntNode( doc, dataValuesSettings2Element, "DigitsBehindComma",
_printDataValuesSettings2._digitsBehindComma );
createChartFontNode( doc, dataValuesSettings2Element, "Font",
_printDataValuesSettings2._dataValuesFont,
_printDataValuesSettings2._dataValuesUseFontRelSize,
_printDataValuesSettings2._dataValuesFontRelSize );
KDXML::createColorNode( doc, dataValuesSettings2Element, "Color",
_printDataValuesSettings2._dataValuesColor );
KDXML::createBrushNode( doc, dataValuesSettings2Element, "Background",
_printDataValuesSettings2._dataValuesBrush );
KDXML::createBoolNode( doc, dataValuesSettings2Element, "AutoColor",
_printDataValuesSettings2._dataValuesAutoColor );
KDXML::createStringNode( doc, dataValuesSettings2Element,
"AnchorNegativePosition",
KDChartEnums::positionFlagToString( _printDataValuesSettings2._dataValuesAnchorNegativePosition ) );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"AnchorNegativeAlign",
_printDataValuesSettings2._dataValuesAnchorNegativeAlign );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"AnchorNegativeDeltaX",
_printDataValuesSettings2._dataValuesAnchorNegativeDeltaX );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"AnchorNegativeDeltaY",
_printDataValuesSettings2._dataValuesAnchorNegativeDeltaY );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"NegativeRotation",
_printDataValuesSettings2._dataValuesNegativeRotation );
KDXML::createStringNode( doc, dataValuesSettings2Element,
"AnchorPositivePosition",
KDChartEnums::positionFlagToString( _printDataValuesSettings2._dataValuesAnchorPositivePosition ) );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"AnchorPositiveAlign",
_printDataValuesSettings2._dataValuesAnchorPositiveAlign );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"AnchorPositiveDeltaX",
_printDataValuesSettings2._dataValuesAnchorPositiveDeltaX );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"AnchorPositiveDeltaY",
_printDataValuesSettings2._dataValuesAnchorPositiveDeltaY );
KDXML::createIntNode( doc, dataValuesSettings2Element,
"PositiveRotation",
_printDataValuesSettings2._dataValuesPositiveRotation );
KDXML::createStringNode( doc, dataValuesSettings2Element,
"LayoutPolicy",
KDChartEnums::layoutPolicyToString( _printDataValuesSettings2._dataValuesLayoutPolicy ) );
KDXML::createBoolNode( doc, dataValuesSettings2Element, "ShowInfinite",
_printDataValuesSettings2._dataValuesShowInfinite );
}
// global settings for data value settings of _all_ charts
TQDomElement dataValuesGlobalSettingsElement =
doc.createElement( "DataValuesGlobalSettings" );
docRoot.appendChild( dataValuesGlobalSettingsElement );
{
KDXML::createBoolNode( doc, dataValuesGlobalSettingsElement,
"allowOverlappingTexts",
_allowOverlappingDataValueTexts );
}
// the AreaMap element
TQDomElement areaMapElement =
doc.createElement( "AreaMap" );
docRoot.appendChild( areaMapElement );
{
TQDictIterator<KDChartFrameSettings> it( _areaDict );
for( ; it.current(); ++it ){
KDChartFrameSettings::createFrameSettingsNode( doc, areaMapElement,
"FrameSettings",
it.current(),
it.currentKey().left(5).stripWhiteSpace().toUInt() );
}
}
// the CustomBoxMap element
TQDomElement customBoxMapElement =
doc.createElement( "CustomBoxMap" );
docRoot.appendChild( customBoxMapElement );
{
TQIntDictIterator<KDChartCustomBox> it( _customBoxDict );
for( ; it.current(); ++it ){
KDXML::createIntNode( doc, customBoxMapElement, "Number", it.currentKey() );
KDChartCustomBox::createCustomBoxNode( doc, customBoxMapElement,
"CustomBox", it );
}
}
return doc;
}
/**
\fn TQTextStream& operator>>( TQTextStream& s, KDChartParams& p );
Reads the an XML document from the text stream s into the
KDChartParams object p
\param s the text stream to read from
\param p the KDChartParams object to read into
\return the text stream after the read operation
*/
TQTextStream& operator>>( TQTextStream& s, KDChartParams& p )
{
TQDomDocument doc( "ChartParams" );
// would be nicer if TQDomDocument could read from a TQTextStream...
TQString docString = s.read();
doc.setContent( docString );
p.loadXML( doc );
return s;
}
/**
Helper method called by loadXML() only.
*/
void KDChartParams::loadAxesFormXML(int& curAxisSettings, TQDomElement& element)
{
KDChartAxisParams* axisSettings =
&( _axisSettings[ curAxisSettings ].params );
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Type" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisType = KDChartAxisParams::stringToAxisType( string );
} else if( tagName == "Visible" ) {
bool visible;
if( KDXML::readBoolNode( element, visible ) )
axisSettings->_axisVisible = visible;
} else if( tagName == "LabelsTouchEdges" ) {
bool labelsTouchEdges;
if( KDXML::readBoolNode( element, labelsTouchEdges ) )
axisSettings->_axisLabelsTouchEdges = labelsTouchEdges;
} else if( tagName == "AreaMode" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisAreaMode = KDChartAxisParams::stringToAxisAreaMode( string );
} else if( tagName == "UseAvailableSpaceFrom" ) {
int spaceFrom;
if( KDXML::readIntNode( element, spaceFrom ) )
axisSettings->_axisUseAvailableSpaceFrom = spaceFrom;
} else if( tagName == "UseAvailableSpaceTo" ) {
int spaceTo;
if( KDXML::readIntNode( element, spaceTo ) )
axisSettings->_axisUseAvailableSpaceTo = spaceTo;
} else if( tagName == "IsometricReferenceAxis" ) {
int isoRefAxis;
if( KDXML::readIntNode( element, isoRefAxis ) )
axisSettings->_axisIsoRefAxis = isoRefAxis;
} else if( tagName == "AreaMin" ) {
int areaMin;
if( KDXML::readIntNode( element, areaMin ) )
axisSettings->_axisAreaMin = areaMin;
} else if( tagName == "AreaMax" ) {
int areaMax;
if( KDXML::readIntNode( element, areaMax ) )
axisSettings->_axisAreaMax = areaMax;
} else if( tagName == "CalcMode" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisCalcMode = KDChartAxisParams::stringToAxisCalcMode( string );
} else if( tagName == "TrueAreaSize" ) {
int trueAreaSize;
if( KDXML::readIntNode( element, trueAreaSize ) )
axisSettings->_axisTrueAreaSize = trueAreaSize;
} else if( tagName == "TrueAreaRect" ) {
TQRect trueAreaRect;
if( KDXML::readRectNode( element, trueAreaRect ) )
axisSettings->_axisTrueAreaRect = trueAreaRect;
} else if( tagName == "ShowSubDelimiters" ) {
bool showSubDelimiters;
if( KDXML::readBoolNode( element, showSubDelimiters ) )
axisSettings->_axisShowSubDelimiters = showSubDelimiters;
} else if( tagName == "LineVisible" ) {
bool lineVisible;
if( KDXML::readBoolNode( element, lineVisible ) )
axisSettings->_axisLineVisible = lineVisible;
} else if( tagName == "LineWidth" ) {
int lineWidth;
if( KDXML::readIntNode( element, lineWidth ) )
axisSettings->_axisLineWidth = lineWidth;
} else if( tagName == "TrueLineWidth" ) {
int trueLineWidth;
if( KDXML::readIntNode( element, trueLineWidth ) )
axisSettings->_axisTrueLineWidth = trueLineWidth;
} else if( tagName == "LineColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
axisSettings->_axisLineColor = color;
} else if( tagName == "ShowGrid" ) {
bool showGrid;
if( KDXML::readBoolNode( element, showGrid ) )
axisSettings->_axisShowGrid = showGrid;
} else if( tagName == "GridColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
axisSettings->_axisGridColor = color;
} else if( tagName == "GridLineWidth" ) {
int gridLineWidth;
if( KDXML::readIntNode( element, gridLineWidth ) )
axisSettings->_axisGridLineWidth = gridLineWidth;
} else if( tagName == "GridStyle" ) {
if( element.hasAttribute( "Style" ) )
axisSettings->_axisGridStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
} else if( tagName == "GridSubColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
axisSettings->_axisGridSubColor = color;
} else if( tagName == "GridSubLineWidth" ) {
int gridSubLineWidth;
if( KDXML::readIntNode( element, gridSubLineWidth ) )
axisSettings->_axisGridSubLineWidth = gridSubLineWidth;
} else if( tagName == "GridSubStyle" ) {
if( element.hasAttribute( "Style" ) )
axisSettings->_axisGridSubStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
} else if( tagName == "ZeroLineColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
axisSettings->_axisZeroLineColor = color;
} else if( tagName == "LabelsVisible" ) {
bool labelsVisible;
if( KDXML::readBoolNode( element, labelsVisible ) )
axisSettings->_axisLabelsVisible = labelsVisible;
} else if( tagName == "LabelsFont" ) {
readChartFontNode( element,
axisSettings->_axisLabelsFont,
axisSettings->_axisLabelsFontUseRelSize,
axisSettings->_axisLabelsFontRelSize,
&axisSettings->_axisLabelsFontMinSize );
} else if( tagName == "LabelsDontShrinkFont" ) {
bool dontShrink;
if( KDXML::readBoolNode( element, dontShrink ) )
axisSettings->_axisLabelsDontShrinkFont = dontShrink;
} else if( tagName == "LabelsDontAutoRotate" ) {
bool dontRotate;
if( KDXML::readBoolNode( element, dontRotate ) )
axisSettings->_axisLabelsDontAutoRotate = dontRotate;
} else if( tagName == "LabelsRotation" ) {
int rotation;
if( KDXML::readIntNode( element, rotation ) )
axisSettings->_axisLabelsRotation = rotation;
} else if( tagName == "LabelsLeaveOut" ) {
int leaveOut;
if( KDXML::readIntNode( element, leaveOut ) )
axisSettings->_axisValueLeaveOut = leaveOut;
} else if( tagName == "LabelsColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
axisSettings->_axisLabelsColor = color;
} else if( tagName == "SteadyValueCalc" ) {
bool steadyValueCalc;
if( KDXML::readBoolNode( element, steadyValueCalc ) )
axisSettings->_axisSteadyValueCalc = steadyValueCalc;
} else if( tagName == "ValueStart" ) {
TQVariant valX, valY;
int propID;
if( readChartValueNode( element, valY, valX, propID ) &&
TQVariant::Double == valY.type() )
axisSettings->_axisValueStart = valY.toDouble();
} else if( tagName == "ValueStartIsExact" ) {
bool isExactValue;
if( KDXML::readBoolNode( element, isExactValue ) )
axisSettings->_axisValueStartIsExact = isExactValue;
} else if( tagName == "ValueEnd" ) {
TQVariant valX, valY;
int propID;
if( readChartValueNode( element, valY, valX, propID ) &&
TQVariant::Double == valY.type() )
axisSettings->_axisValueEnd = valY.toDouble();
} else if( tagName == "ValueDelta" ) {
double valueDelta;
if( KDXML::readDoubleNode( element, valueDelta ) )
axisSettings->_axisValueDelta = valueDelta;
} else if( tagName == "ValueDeltaScale" ) {
int valueDeltaScale;
if( KDXML::readIntNode( element, valueDeltaScale ) )
axisSettings->_axisValueDeltaScale = (KDChartAxisParams::ValueScale)valueDeltaScale;
} else if( tagName == "ValuesDecreasing" ) {
bool decreasing;
if( KDXML::readBoolNode( element, decreasing ) )
axisSettings->_axisValuesDecreasing = decreasing;
} else if( tagName == "TrueLow" ) {
double trueLow;
if( KDXML::readDoubleNode( element, trueLow ) )
axisSettings->_trueLow = trueLow;
} else if( tagName == "TrueHigh" ) {
double trueHigh;
if( KDXML::readDoubleNode( element, trueHigh ) )
axisSettings->_trueHigh = trueHigh;
} else if( tagName == "TrueDelta" ) {
double trueDelta;
if( KDXML::readDoubleNode( element, trueDelta ) )
axisSettings->_trueDelta = trueDelta;
} else if( tagName == "ZeroLineStart" ) {
double x = 0.0;
double y = 0.0;
bool ok = true;
if( element.hasAttribute( "X" ) &&
element.hasAttribute( "Y" ) ) {
x = element.attribute( "X" ).toDouble( &ok );
if( ok )
y = element.attribute( "Y" ).toDouble( &ok );
} else
ok = false;
if( ok ) {
axisSettings->_axisZeroLineStartX = x;
axisSettings->_axisZeroLineStartY = y;
}
} else if( tagName == "DigitsBehindComma" ) {
int digitsBehindComma;
if( KDXML::readIntNode( element, digitsBehindComma ) )
axisSettings->_axisDigitsBehindComma = digitsBehindComma;
} else if( tagName == "LabelsDateTimeFormat" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisLabelsDateTimeFormat = string;
} else if( tagName == "MaxEmptyInnerSpan" ) {
int maxEmptyInnerSpan;
if( KDXML::readIntNode( element, maxEmptyInnerSpan ) )
axisSettings->_axisMaxEmptyInnerSpan = maxEmptyInnerSpan;
} else if( tagName == "LabelsFromDataRow" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_labelTextsDataRow = KDChartAxisParams::stringToLabelsFromDataRow( string );
} else if( tagName == "TextsDataRow" ) {
int textsDataRow;
if( KDXML::readIntNode( element, textsDataRow ) )
axisSettings->_labelTextsDataRow = textsDataRow;
} else if( tagName == "LabelString" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisLabelStringList << string;
} else if( tagName == "ShortLabelString" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisShortLabelsStringList << string;
} else if( tagName == "LabelText" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisLabelTexts = string;
} else if( tagName == "LabelTextsDirty" ) {
bool labelTextsDirty;
if( KDXML::readBoolNode( element, labelTextsDirty ) )
axisSettings->_axisLabelTextsDirty = labelTextsDirty;
} else if( tagName == "FirstLabelReplacementText" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
axisSettings->_axisFirstLabelText = value;
} else if( tagName == "LastLabelReplacementText" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
axisSettings->_axisLastLabelText = value;
} else if( tagName == "LabelsDivPow10" ) {
int divPow10;
if( KDXML::readIntNode( element, divPow10 ) )
axisSettings->_axisLabelsDivPow10 = divPow10;
} else if( tagName == "LabelsDecimalPoint" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
axisSettings->_axisLabelsDecimalPoint = value;
} else if( tagName == "LabelsThousandsPoint" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
axisSettings->_axisLabelsThousandsPoint = value;
} else if( tagName == "LabelsNotation" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
axisSettings->_axisLabelsNotation = KDChartEnums::stringToNumberNotation( string );
} else if( tagName == "LabelsPrefix" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
axisSettings->_axisLabelsPrefix = value;
} else if( tagName == "LabelsPostfix" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
axisSettings->_axisLabelsPostfix = value;
} else if( tagName == "LabelsTotalLen" ) {
int totalLen;
if( KDXML::readIntNode( element, totalLen ) )
axisSettings->_axisLabelsTotalLen = totalLen;
} else if( tagName == "LabelsPadFill" ) {
TQString value;
if( KDXML::readStringNode( element, value ) ){
if( value.isEmpty() )
axisSettings->_axisLabelsPadFill = ' ';
else
axisSettings->_axisLabelsPadFill = value.at(0);
}
} else if( tagName == "LabelsBlockAlign" ) {
bool blockAlign;
if( KDXML::readBoolNode( element, blockAlign ) )
axisSettings->_axisLabelsBlockAlign = blockAlign;
} else {
tqDebug( "Unknown subelement of AxisSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
curAxisSettings++; // one axis settings entry finished
}
/**
Reads the parameters from an XML document.
\param doc the XML document to read from
\return true if the parameters could be read, false if a file
format error occurred
\sa saveXML
*/
bool KDChartParams::loadXML( const TQDomDocument& doc )
{
int curAxisSettings = 0;
int curHFSettings = 0;
TQDomElement docRoot = doc.documentElement(); // ChartParams element
TQDomNode node = docRoot.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "ChartType" ) {
if( element.hasAttribute( "primary" ) )
_chartType = KDChartParams::stringToChartType( element.attribute( "primary" ) );
if( element.hasAttribute( "secondary" ) )
_additionalChartType = KDChartParams::stringToChartType( element.attribute( "secondary" ) );
} else if( tagName == "NumValues" ) {
int numValues;
if( KDXML::readIntNode( element, numValues ) )
_numValues = numValues;
} else if( tagName == "ModeAndChartMap" ) {
int dataset = -1;
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Dataset" ) {
KDXML::readIntNode( element, dataset );
} else if( tagName == "ModeAndChart" ) {
Q_ASSERT( dataset != -1 ); // there must have been a dataset tag before
if( element.hasAttribute( "Mode" ) &&
element.hasAttribute( "Chart" ) ) {
KDChartParams::SourceMode sourceMode = KDChartParams::stringToChartSourceMode( element.attribute( "Mode" ) );
bool ok = false;
uint chart = element.attribute( "Chart" ).toUInt( &ok );
if( ok )
_dataSourceModeAndChart[dataset] = KDChartParams::ModeAndChart( sourceMode, chart );
}
} else {
tqDebug( "Unknown subelement of ModeAndChartMap found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "PropertySetMap" ) {
// the PropertySetMap element
TQDomNode node = element.firstChild();
KDChartPropertySet set;
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() // was really an element
&& KDChartPropertySet::loadXML( element, set ) ) // parsed OK
setProperties( set.id(), set );
node = node.nextSibling();
}
} else if( tagName == "ChartSourceModeWasUsed" ) {
bool chartSourceModeWasUsed;
if( KDXML::readBoolNode( element, chartSourceModeWasUsed ) )
_setChartSourceModeWasUsed = chartSourceModeWasUsed;
} else if( tagName == "MaxDatasetSourceMode" ) {
int maxDatasetSourceMode;
if( KDXML::readIntNode( element, maxDatasetSourceMode ) )
_maxDatasetSourceMode = maxDatasetSourceMode;
} else if( tagName == "ColorSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "DataColors" ) {
TQMap<uint,TQColor>* map = &_dataColors;
readColorMapNode( element, map );
} else if( tagName == "MaxDatasetColor" ) {
int maxDatasetColor;
if( KDXML::readIntNode( element, maxDatasetColor ) )
_maxDatasetColor = maxDatasetColor;
} else if( tagName == "ShadowBrightnessFactor" ) {
double shadowBrightnessFactor;
if( KDXML::readDoubleNode( element, shadowBrightnessFactor ) )
_shadowBrightnessFactor = shadowBrightnessFactor;
} else if( tagName == "ShadowPattern" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_shadowPattern = KDXML::stringToBrushStyle( value );
} else if( tagName == "ThreeDShadowColors" ) {
bool threeDShadowColors;
if( KDXML::readBoolNode( element, threeDShadowColors ) )
_threeDShadowColors = threeDShadowColors;
} else if( tagName == "DataColorsShadow1" ) {
TQMap<uint,TQColor>* map = &_dataColorsShadow1;
readColorMapNode( element, map );
} else if( tagName == "DataColorsShadow2" ) {
TQMap<uint,TQColor>* map = &_dataColorsShadow2;
readColorMapNode( element, map );
} else if( tagName == "OutlineDataColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_outlineDataColor = color;
} else if( tagName == "OutlineDataLineWidth" ) {
int outlineDataLineWidth;
if( KDXML::readIntNode( element, outlineDataLineWidth ) )
_outlineDataLineWidth = outlineDataLineWidth;
} else if( tagName == "OutlineDataLineStyle" ) {
if( element.hasAttribute( "Style" ) )
_outlineDataLineStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
} else {
tqDebug( "!!!Unknown subelement of ColorSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "BarSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "SubType" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_barChartSubType = KDChartParams::stringToBarChartSubType( value );
} else if( tagName == "ThreeDBars" ) {
bool threeDBars;
if( KDXML::readBoolNode( element, threeDBars ) )
_threeDBars = threeDBars;
} else if( tagName == "ThreeDBarDepth" ) {
double threeDBarDepth;
if( KDXML::readDoubleNode( element, threeDBarDepth ) )
_threeDBarDepth = threeDBarDepth;
} else if( tagName == "DatasetGap" ) {
int datasetGap;
if( KDXML::readIntNode( element, datasetGap ) )
_datasetGap = datasetGap;
} else if( tagName == "DatasetGapIsRelative" ) {
bool datasetGapIsRelative;
if( KDXML::readBoolNode( element, datasetGapIsRelative ) )
_datasetGapIsRelative = datasetGapIsRelative;
} else if( tagName == "ValueBlockGap" ) {
int valueBlockGap;
if( KDXML::readIntNode( element, valueBlockGap ) )
_valueBlockGap = valueBlockGap;
} else if( tagName == "ValueBlockGapIsRelative" ) {
bool valueBlockGapIsRelative;
if( KDXML::readBoolNode( element, valueBlockGapIsRelative ) )
_valueBlockGapIsRelative = valueBlockGapIsRelative;
} else if( tagName == "BarWidth" ) {
int barWidth;
if( KDXML::readIntNode( element, barWidth ) )
_barWidth = barWidth;
} else if( tagName == "SolidExcessArrows" ) {
bool solidExcessArrows;
if( KDXML::readBoolNode( element, solidExcessArrows ) )
_solidExcessArrows = solidExcessArrows;
} else {
tqDebug( "Unknown subelement of BarSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "LineSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "SubType" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_lineChartSubType = KDChartParams::stringToLineChartSubType( value );
} else if( tagName == "Marker" ) {
bool marker;
if( KDXML::readBoolNode( element, marker ) )
_lineMarker = marker;
} else if( tagName == "MarkerStyle" ) {
bool ok = true;
uint dataset;
KDChartParams::LineMarkerStyle style = LineMarkerCircle;
if( element.hasAttribute( "Dataset" ) &&
element.hasAttribute( "Style" ) ) {
dataset = element.attribute( "Dataset" ).toUInt( &ok );
if( ok )
style = KDChartParams::stringToLineMarkerStyle( element.attribute( "Style" ) );
} else
ok = false;
if( ok )
_lineMarkerStyles[dataset] = style;
} else if( tagName == "MarkerSize" ) {
int width = 1;
int height= 1;
bool ok = true;
if( element.hasAttribute( "Width" ) &&
element.hasAttribute( "Height" ) ) {
width = element.attribute( "Width" ).toInt( &ok );
if( ok )
height = element.attribute( "Height" ).toInt( &ok );
} else
ok = false;
if( ok ) {
_lineMarkerSize.setWidth( width );
_lineMarkerSize.setHeight( height );
}
} else if( tagName == "LineWidth" ) {
int lineWidth;
if( KDXML::readIntNode( element, lineWidth ) )
_lineWidth = lineWidth;
} else if( tagName == "LineColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_lineColor = color;
} else if( tagName == "LineStyle" ) {
if( element.hasAttribute( "Style" ) )
_lineStyle = KDXML::stringToPenStyle( element.attribute( "Style" ) );
} else if( tagName == "DatasetLineStyle" ) {
bool ok = true;
uint dataset;
Qt::PenStyle style = Qt::SolidLine;
if( element.hasAttribute( "Dataset" ) &&
element.hasAttribute( "Style" ) ) {
dataset = element.attribute( "Dataset" ).toUInt( &ok );
if( ok )
style = KDXML::stringToPenStyle( element.attribute( "Style" ) );
} else
ok = false;
if( ok )
_datasetLineStyles[dataset] = style;
} else if( tagName == "ThreeD" ) {
bool threeD;
if( KDXML::readBoolNode( element, threeD ) )
_threeDLines = threeD;
} else if( tagName == "ThreeDDepth" ) {
int depth;
if( KDXML::readIntNode( element, depth ) )
_threeDLineDepth = depth;
} else if( tagName == "ThreeDXRotation" ) {
int rotation;
if( KDXML::readIntNode( element, rotation ) )
_threeDLineXRotation = rotation;
} else if( tagName == "ThreeDYRotation" ) {
int rotation;
if( KDXML::readIntNode( element, rotation ) )
_threeDLineYRotation = rotation;
} else {
tqDebug( "Unknown subelement of LineSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "AreaSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "SubType" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_areaChartSubType = KDChartParams::stringToAreaChartSubType( value );
} else if( tagName == "Location" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
_areaLocation = KDChartParams::stringToAreaLocation( string );
} else {
tqDebug( "Unknown subelement of AreaSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "PieRingSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Explode" ) {
bool explode;
if( KDXML::readBoolNode( element, explode ) )
_explode = explode;
} else if( tagName == "DefaultExplodeFactor" ) {
double defaultExplodeFactor;
if( KDXML::readDoubleNode( element, defaultExplodeFactor ) )
_explodeFactor = defaultExplodeFactor;
} else if( tagName == "ExplodeFactors" ) {
TQMap<int,double>* map = &_explodeFactors;
readDoubleMapNode( element, map );
} else if( tagName == "ExplodeSegment" ) {
int explodeSegment;
if( KDXML::readIntNode( element, explodeSegment ) )
_explodeList << explodeSegment;
} else if( tagName == "ThreeDPies" ) {
bool threeDPies;
if( KDXML::readBoolNode( element, threeDPies ) )
_threeDPies = threeDPies;
} else if( tagName == "ThreeDPieHeight" ) {
int threeDPieHeight;
if( KDXML::readIntNode( element, threeDPieHeight ) )
_threeDPieHeight = threeDPieHeight;
} else if( tagName == "PieStart" ) {
int pieStart;
if( KDXML::readIntNode( element, pieStart ) )
_pieStart = pieStart;
} else if( tagName == "RingStart" ) {
int ringStart;
if( KDXML::readIntNode( element, ringStart ) )
_ringStart = ringStart;
} else if( tagName == "RelativeRingThickness" ) {
bool relativeRingThickness;
if( KDXML::readBoolNode( element, relativeRingThickness ) )
_relativeRingThickness = relativeRingThickness;
} else {
tqDebug( "Unknown subelement of PieRingSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "HiLoSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "SubType" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_hiLoChartSubType = KDChartParams::stringToHiLoChartSubType( value );
} else if( tagName == "PrintLowValues" ) {
bool printLowValues;
if( KDXML::readBoolNode( element, printLowValues ) )
_hiLoChartPrintLowValues = printLowValues;
} else if( tagName == "LowValuesFont" ) {
readChartFontNode( element,
_hiLoChartLowValuesFont,
_hiLoChartLowValuesUseFontRelSize,
_hiLoChartLowValuesFontRelSize );
} else if( tagName == "LowValuesColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_hiLoChartLowValuesColor = color;
} else if( tagName == "PrintHighValues" ) {
bool printHighValues;
if( KDXML::readBoolNode( element, printHighValues ) )
_hiLoChartPrintHighValues = printHighValues;
} else if( tagName == "HighValuesFont" ) {
readChartFontNode( element,
_hiLoChartHighValuesFont,
_hiLoChartHighValuesUseFontRelSize,
_hiLoChartHighValuesFontRelSize );
} else if( tagName == "HighValuesColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_hiLoChartHighValuesColor = color;
} else if( tagName == "PrintOpenValues" ) {
bool printOpenValues;
if( KDXML::readBoolNode( element, printOpenValues ) )
_hiLoChartPrintOpenValues = printOpenValues;
} else if( tagName == "OpenValuesFont" ) {
readChartFontNode( element,
_hiLoChartOpenValuesFont,
_hiLoChartOpenValuesUseFontRelSize,
_hiLoChartOpenValuesFontRelSize );
} else if( tagName == "OpenValuesColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_hiLoChartOpenValuesColor = color;
} else if( tagName == "PrintCloseValues" ) {
bool printCloseValues;
if( KDXML::readBoolNode( element, printCloseValues ) )
_hiLoChartPrintCloseValues = printCloseValues;
} else if( tagName == "CloseValuesFont" ) {
readChartFontNode( element,
_hiLoChartCloseValuesFont,
_hiLoChartCloseValuesUseFontRelSize,
_hiLoChartCloseValuesFontRelSize );
} else if( tagName == "CloseValuesColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_hiLoChartCloseValuesColor = color;
} else {
tqDebug( "Unknown subelement of HiLoSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "BoxAndWhiskerSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "SubType" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_BWChartSubType = KDChartParams::stringToBWChartSubType( value );
} else if( tagName == "FenceUpperInner" ) {
double fence;
if( KDXML::readDoubleNode( element, fence ) )
_BWChartFenceUpperInner = fence;
} else if( tagName == "FenceLowerInner" ) {
double fence;
if( KDXML::readDoubleNode( element, fence ) )
_BWChartFenceUpperOuter = fence;
} else if( tagName == "FenceUpperOuter" ) {
double fence;
if( KDXML::readDoubleNode( element, fence ) )
_BWChartFenceUpperOuter = fence;
} else if( tagName == "FenceLowerOuter" ) {
double fence;
if( KDXML::readDoubleNode( element, fence ) )
_BWChartFenceUpperOuter = fence;
} else if( tagName == "Brush" ) {
TQBrush brush;
if( KDXML::readBrushNode( element, brush ) )
_BWChartBrush = brush;
} else if( tagName == "OutlierSize" ) {
int size;
if( KDXML::readIntNode( element, size ) )
_BWChartOutValMarkerSize = size;
} else if( tagName.startsWith("PrintStatistics") ) {
// 012345678901234
TQString statName(tagName.mid( 15 ));
BWStatVal i( stringToBWChartStatVal( statName ) );
if( BWStatValSTART <= i && i <= BWStatValEND ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Active" ) {
bool active;
if( KDXML::readBoolNode( element, active ) )
_BWChartStatistics[ i ].active = active;
} else if( tagName == "Font" ) {
readChartFontNode( element,
_BWChartStatistics[ i ].font,
_BWChartStatistics[ i ].useRelSize,
_BWChartStatistics[ i ].relSize );
} else if( tagName == "Color" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_BWChartStatistics[ i ].color = color;
} else if( tagName == "Brush" ) {
TQBrush brush;
if( KDXML::readBrushNode( element, brush ) )
_BWChartStatistics[ i ].brush = brush;
} else {
tqDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
}
}
}
} else {
tqDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
}
} else {
tqDebug( "Unknown subelement of BoxAndWhiskerSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "PolarSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "SubType" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_polarChartSubType = KDChartParams::stringToPolarChartSubType( value );
} else if( tagName == "Marker" ) {
bool marker;
if( KDXML::readBoolNode( element, marker ) )
_polarMarker = marker;
} else if( tagName == "MarkerStyle" ) {
bool ok = true;
uint dataset;
KDChartParams::PolarMarkerStyle style = PolarMarkerCircle;
if( element.hasAttribute( "Dataset" ) &&
element.hasAttribute( "Style" ) ) {
dataset = element.attribute( "Dataset" ).toUInt( &ok );
if( ok )
style = KDChartParams::stringToPolarMarkerStyle( element.attribute( "Style" ) );
} else
ok = false;
if( ok )
_polarMarkerStyles[dataset] = style;
} else if( tagName == "MarkerSize" ) {
int width = 1;
int height= 1;
bool ok = true;
if( element.hasAttribute( "Width" ) &&
element.hasAttribute( "Height" ) ) {
width = element.attribute( "Width" ).toInt( &ok );
if( ok )
height = element.attribute( "Height" ).toInt( &ok );
} else
ok = false;
if( ok ) {
_polarMarkerSize.setWidth( width );
_polarMarkerSize.setHeight( height );
}
} else if( tagName == "PolarLineWidth" ) {
int polarLineWidth;
if( KDXML::readIntNode( element, polarLineWidth ) )
_polarLineWidth = polarLineWidth;
} else {
tqDebug( "Unknown subelement of PolarSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "LegendSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Position" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
_legendPosition = KDChartParams::stringToLegendPosition( string );
} else if( tagName == "Orientation" ) {
Qt::Orientation value=Qt::Vertical;
if( KDXML::readOrientationNode( element, value ) )
_legendOrientation = value;
} else if( tagName == "ShowLines" ) {
bool showLines;
if( KDXML::readBoolNode( element, showLines ) )
_legendShowLines = showLines;
} else if( tagName == "Source" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
_legendSource = KDChartParams::stringToLegendSource( string );
} else if( tagName == "LegendText" ) {
bool ok = true;
uint dataset = 0;
TQString text;
if( element.hasAttribute( "Dataset" ) &&
element.hasAttribute( "Text" ) ) {
dataset = element.attribute( "Dataset" ).toUInt( &ok );
if( ok )
text = element.attribute( "Text" );
} else
ok = false;
if( ok )
_legendText[dataset] = text;
} else if( tagName == "TextColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_legendTextColor = color;
} else if( tagName == "TextFont" ) {
readChartFontNode( element,
_legendFont,
_legendFontUseRelSize,
_legendFontRelSize );
} else if( tagName == "TitleText" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
_legendTitleText = string;
} else if( tagName == "TitleColor" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
_legendTitleTextColor = color;
} else if( tagName == "TitleFont" ) {
readChartFontNode( element,
_legendTitleFont,
_legendTitleFontUseRelSize,
_legendTitleFontRelSize );
} else if( tagName == "Spacing" ) {
int spacing;
if( KDXML::readIntNode( element, spacing ) )
_legendSpacing = spacing;
} else {
tqDebug( "Unknown subelement of LegendSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "AxisSettings" ) {
loadAxesFormXML(curAxisSettings, element);
} else if( tagName == "HeaderFooterSettings" ) {
KDChartParams::HdFtParams* hfSettings =
&( _hdFtParams[ curHFSettings ] );
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Text" ) {
TQString string;
if( KDXML::readStringNode( element, string ) )
hfSettings->_text = string;
} else if( tagName == "Font" ) {
readChartFontNode( element,
hfSettings->_font,
hfSettings->_fontUseRelSize,
hfSettings->_fontRelSize );
} else if( tagName == "Color" ) {
TQColor color;
if( KDXML::readColorNode( element, color ) )
hfSettings->_color = color;
} else {
tqDebug( "Unknown subelement of HeaderFooterSettings found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
curHFSettings++; // one header/footer setting finished
} else if( tagName == "GlobalLeading" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an elemente
TQString tagName = element.tagName();
if( tagName == "Left" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_globalLeadingLeft = value;
}
else if( tagName == "Top" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_globalLeadingTop = value;
}
else if( tagName == "Right" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_globalLeadingRight = value;
}
else if( tagName == "Bottom" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_globalLeadingBottom = value;
} else {
tqDebug( "Unknown subelement of GlobalLeading found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "DataValuesSettings1" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "PrintDataValues" ) {
bool value;
if( KDXML::readBoolNode( element, value ) )
_printDataValuesSettings._printDataValues = value;
} else if( tagName == "DivPow10" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._divPow10 = value;
} else if( tagName == "DigitsBehindComma" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._digitsBehindComma = value;
} else if( tagName == "Font" ) {
readChartFontNode( element,
_printDataValuesSettings._dataValuesFont,
_printDataValuesSettings._dataValuesUseFontRelSize,
_printDataValuesSettings._dataValuesFontRelSize );
} else if( tagName == "Color" ) {
KDXML::readColorNode( element, _printDataValuesSettings._dataValuesColor );
} else if( tagName == "Background" ) {
KDXML::readBrushNode( element, _printDataValuesSettings._dataValuesBrush );
} else if( tagName == "AutoColor" ) {
KDXML::readBoolNode( element,
_printDataValuesSettings._dataValuesAutoColor );
} else if( tagName == "AnchorNegativePosition" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorNegativePosition = KDChartEnums::stringToPositionFlag( value );
} else if( tagName == "AnchorNegativeAlign" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorNegativeAlign = value;
} else if( tagName == "AnchorNegativeDeltaX" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorNegativeDeltaX = value;
} else if( tagName == "AnchorNegativeDeltaY" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorNegativeDeltaY = value;
} else if( tagName == "NegativeRotation" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesNegativeRotation = value;
} else if( tagName == "AnchorPositivePosition" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorPositivePosition = KDChartEnums::stringToPositionFlag( value );
} else if( tagName == "AnchorPositiveAlign" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorPositiveAlign = value;
} else if( tagName == "AnchorPositiveDeltaX" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorPositiveDeltaX = value;
} else if( tagName == "AnchorPositiveDeltaY" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesAnchorPositiveDeltaY = value;
} else if( tagName == "PositiveRotation" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings._dataValuesPositiveRotation = value;
} else if( tagName == "LayoutPolicy" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_printDataValuesSettings._dataValuesLayoutPolicy = KDChartEnums::stringToLayoutPolicy( value );
} else if( tagName == "ShowInfinite" ) {
KDXML::readBoolNode( element, _printDataValuesSettings._dataValuesShowInfinite );
} else {
tqDebug( "Unknown subelement of DataValuesSettings1 found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "DataValuesSettings2" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "PrintDataValues" ) {
bool value;
if( KDXML::readBoolNode( element, value ) )
_printDataValuesSettings2._printDataValues = value;
} else if( tagName == "DivPow10" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._divPow10 = value;
} else if( tagName == "DigitsBehindComma" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._digitsBehindComma = value;
} else if( tagName == "Font" ) {
readChartFontNode( element,
_printDataValuesSettings2._dataValuesFont,
_printDataValuesSettings2._dataValuesUseFontRelSize,
_printDataValuesSettings2._dataValuesFontRelSize );
} else if( tagName == "Color" ) {
KDXML::readColorNode( element, _printDataValuesSettings2._dataValuesColor );
} else if( tagName == "Background" ) {
KDXML::readBrushNode( element, _printDataValuesSettings2._dataValuesBrush );
} else if( tagName == "AutoColor" ) {
KDXML::readBoolNode( element,
_printDataValuesSettings2._dataValuesAutoColor );
} else if( tagName == "AnchorNegativePosition" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorNegativePosition = KDChartEnums::stringToPositionFlag( value );
} else if( tagName == "AnchorNegativeAlign" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorNegativeAlign = value;
} else if( tagName == "AnchorNegativeDeltaX" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorNegativeDeltaX = value;
} else if( tagName == "AnchorNegativeDeltaY" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorNegativeDeltaY = value;
} else if( tagName == "NegativeRotation" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesNegativeRotation = value;
} else if( tagName == "AnchorPositivePosition" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorPositivePosition = KDChartEnums::stringToPositionFlag( value );
} else if( tagName == "AnchorPositiveAlign" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorPositiveAlign = value;
} else if( tagName == "AnchorPositiveDeltaX" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorPositiveDeltaX = value;
} else if( tagName == "AnchorPositiveDeltaY" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesAnchorPositiveDeltaY = value;
} else if( tagName == "PositiveRotation" ) {
int value;
if( KDXML::readIntNode( element, value ) )
_printDataValuesSettings2._dataValuesPositiveRotation = value;
} else if( tagName == "LayoutPolicy" ) {
TQString value;
if( KDXML::readStringNode( element, value ) )
_printDataValuesSettings2._dataValuesLayoutPolicy = KDChartEnums::stringToLayoutPolicy( value );
} else if( tagName == "ShowInfinite" ) {
KDXML::readBoolNode( element, _printDataValuesSettings2._dataValuesShowInfinite );
} else {
tqDebug( "Unknown subelement of DataValuesSettings2 found: %s", tagName.latin1() );
}
}
node = node.nextSibling();
}
} else if( tagName == "DataValuesGlobalSettings" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "allowOverlappingTexts" ) {
bool value;
if( KDXML::readBoolNode( element, value ) )
_allowOverlappingDataValueTexts = value;
}
else
tqDebug( "Unknown subelement of DataValuesGlobalSettings found: %s", tagName.latin1() );
// do _not_ return false here (to enable future extentions)
}
node = node.nextSibling();
}
} else if( tagName == "AreaMap" ) {
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "FrameSettings" ) {
KDChartFrameSettings* frameSettings = new KDChartFrameSettings;
uint areaId = KDChartEnums::AreaUNKNOWN;
if( KDChartFrameSettings::readFrameSettingsNode(
element, *frameSettings, areaId ) ) {
TQString str;
if(areaId == KDChartEnums::AreaChartDataRegion)
str = TQString( "%1/%2/%3/%4" )
.arg( areaId, 5 )
.arg( frameSettings->dataRow(), 5 )
.arg( frameSettings->dataCol(), 5 )
.arg( 0, 5 );//frameSettings->data3rd(), 5 );
else
str = TQString( "%1/-----/-----/-----" ).arg( areaId, 5 );
_areaDict.replace( str, frameSettings );
}
}
else
tqDebug( "Unknown tag in AreaMap found: %s", tagName.latin1() );
// do _not_ return false here (to enable future extentions)
}
node = node.nextSibling();
}
} else if( tagName == "CustomBoxMap" ) {
TQDomNode node = element.firstChild();
int curNumber = -1;
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Number" ) {
KDXML::readIntNode( element, curNumber );
} else if( tagName == "CustomBox" ) {
Q_ASSERT( curNumber != -1 ); // there was a Dataset tag before
KDChartCustomBox customBox;
KDChartCustomBox::readCustomBoxNode( element,
customBox );
_customBoxDict.insert( curNumber, customBox.clone() );
}
else
tqDebug( "Unknown tag in CustomBoxMap found: %s", tagName.latin1() );
}
node = node.nextSibling();
}
} else {
tqDebug( "Unknown second-level element found: %s", tagName.latin1() );
// NOTE: We do *not* 'return false' here but continue normal operation
// since additional elements might have been added in future versions
}
}
node = node.nextSibling();
}
return true;
}
/**
Creates a DOM element node that represents a map of TQColor objects
for use in a DOM document.
\param doc the DOM document to which the node will belong
\param parent the parent node to which the new node will be appended
\param elementName the name of the new node
\param map the map of colors to be represented
*/
void KDChartParams::createColorMapNode( TQDomDocument& doc, TQDomNode& parent,
const TQString& elementName,
const TQMap< uint, TQColor >& map )
{
TQDomElement mapElement =
doc.createElement( elementName );
parent.appendChild( mapElement );
for( TQMap<uint,TQColor>::ConstIterator it = map.begin();
it != map.end(); ++it ) {
// Dataset element
TQDomElement datasetElement = doc.createElement( "Dataset" );
mapElement.appendChild( datasetElement );
TQDomText datasetContent =
doc.createTextNode( TQString::number( it.key() ) );
datasetElement.appendChild( datasetContent );
// Color element
KDXML::createColorNode( doc, mapElement, "Color", it.data() );
}
}
/**
Creates a DOM element node that represents a map of doubles
for use in a DOM document.
\param doc the DOM document to which the node will belong
\param parent the parent node to which the new node will be appended
\param elementName the name of the new node
\param map the map of doubles to be represented
*/
void KDChartParams::createDoubleMapNode( TQDomDocument& doc, TQDomNode& parent,
const TQString& elementName,
const TQMap< int, double >& map )
{
TQDomElement mapElement =
doc.createElement( elementName );
parent.appendChild( mapElement );
for( TQMap<int,double>::ConstIterator it = map.begin();
it != map.end(); ++it ) {
// Dataset element
TQDomElement valueElement = doc.createElement( "Value" );
mapElement.appendChild( valueElement );
TQDomText valueContent =
doc.createTextNode( TQString::number( it.key() ) );
valueElement.appendChild( valueContent );
// Color element
KDXML::createDoubleNode( doc, mapElement, "Factor", it.data() );
}
}
void dataCoordToElementAttr(const TQVariant& val, TQDomElement& element, const TQString& postfix)
{
if( TQVariant::Double == val.type() )
element.setAttribute( "DoubleValue"+postfix,
TQString::number( val.toDouble() ) );
else if( TQVariant::String == val.type() )
element.setAttribute( "StringValue"+postfix, val.toString() );
else if( TQVariant::DateTime == val.type() )
element.setAttribute( "DateTimeValue"+postfix,
val.toDateTime().toString( Qt::ISODate ) );
else
element.setAttribute( "NoValue"+postfix, "true" );
}
/**
Creates a DOM element node that represents a
chart value for use in a DOM document.
\param doc the DOM document to which the node will belong
\param parent the parent node to which the new node will be appended
\param elementName the name of the new node
\param data the chart value to be represented
*/
void KDChartParams::createChartValueNode( TQDomDocument& doc, TQDomNode& parent,
const TQString& elementName,
const TQVariant& valY,
const TQVariant& valX,
const int& propID )
{
TQDomElement element = doc.createElement( elementName );
parent.appendChild( element );
dataCoordToElementAttr( valY, element, "" ); // no postfix for Y value: backwards compat.
dataCoordToElementAttr( valX, element, "X" );
element.setAttribute( "PropertySetID",
TQString::number( propID ) );
}
/**
Creates a DOM element node that represents a font used in a
chart for use in a DOM document.
\param doc the DOM document to which the node will belong
\param parent the parent node to which the new node will be appended
\param elementName the name of the new node
\param font the font to be resented
\param useRelFont the specification whether the font size
is relative
\param relFont the relative font size
\param minFont the minimal font size in points, leave this parameter out if not needed
*/
void KDChartParams::createChartFontNode( TQDomDocument& doc, TQDomNode& parent,
const TQString& elementName,
const TQFont& font, bool useRelFont,
int relFont,
int minFont )
{
TQDomElement chartFontElement = doc.createElement( elementName );
parent.appendChild( chartFontElement );
KDXML::createFontNode( doc, chartFontElement, "Font", font );
KDXML::createBoolNode( doc, chartFontElement, "UseRelFontSize",
useRelFont );
KDXML::createIntNode( doc, chartFontElement, "RelFontSize", relFont );
if( 0 <= minFont )
KDXML::createIntNode( doc, chartFontElement, "MinFontSize", minFont );
}
/**
Creates a DOM element node that represents a color map
for use in a DOM document.
\param doc the DOM document to which the node will belong
\param parent the parent node to which the new node will be appended
\param elementName the name of the new node
\param map the color map to be represented
*/
bool KDChartParams::readColorMapNode( const TQDomElement& element,
TQMap<uint,TQColor>* value )
{
TQDomNode node = element.firstChild();
int curDataset = -1;
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Dataset" ) {
KDXML::readIntNode( element, curDataset );
} else if( tagName == "Color" ) {
Q_ASSERT( curDataset != -1 ); // there was a Dataset tag before
TQColor color;
KDXML::readColorNode( element, color );
value->insert( curDataset, color );
} else {
tqDebug( "Unknown tag in color map" );
}
}
node = node.nextSibling();
}
return true;
}
/**
Reads data from a DOM element node that represents a double
map and fills a double map with the data.
\param element the DOM element to read from
\param map the frame settings object to read the data into
*/
bool KDChartParams::readDoubleMapNode( const TQDomElement& element,
TQMap<int,double>* value )
{
TQDomNode node = element.firstChild();
int curValue = -1;
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Value" ) {
KDXML::readIntNode( element, curValue );
} else if( tagName == "Factor" ) {
Q_ASSERT( curValue != -1 ); // there was a Value tag before
double doubleValue;
KDXML::readDoubleNode( element, doubleValue );
value->insert( curValue, doubleValue );
} else {
tqDebug( "Unknown tag in double map" );
}
}
node = node.nextSibling();
}
return true;
}
/**
Reads data from a DOM element node that represents a font
uses in a chart and fills the reference parameters
with the data.
\param element the DOM element to read from
\param font the represented font
\param useRelFont whether the font size is relative
\param relFontSize the relative font size
*/
bool KDChartParams::readChartFontNode( const TQDomElement& element,
TQFont& font,
bool& useRelFont,
int& relFontSize,
int* minFontSize )
{
bool ok = true;
TQFont tempFont;
bool tempRelFont;
int tempRelFontSize;
int tempMinFontSize=-1;
TQDomNode node = element.firstChild();
while( !node.isNull() ) {
TQDomElement element = node.toElement();
if( !element.isNull() ) { // was really an element
TQString tagName = element.tagName();
if( tagName == "Font" ) {
ok = ok & KDXML::readFontNode( element, tempFont );
} else if( tagName == "UseRelFontSize" ) {
ok = ok & KDXML::readBoolNode( element, tempRelFont );
} else if( tagName == "RelFontSize" ) {
ok = ok & KDXML::readIntNode( element, tempRelFontSize );
} else if( tagName == "MinFontSize" ) {
ok = ok & KDXML::readIntNode( element, tempMinFontSize );
} else {
tqDebug( "Unknown tag in color map" );
}
}
node = node.nextSibling();
}
if( ok ) {
font = tempFont;
useRelFont = tempRelFont;
relFontSize = tempRelFontSize;
if( minFontSize && 0 <= tempMinFontSize )
*minFontSize = tempMinFontSize;
}
return ok;
}
bool foundCoordAttribute( const TQDomElement& element, const TQString& postfix,
TQVariant& val )
{
if( element.hasAttribute( "NoValue"+postfix ) )
val = TQVariant();
else if( element.hasAttribute( "DoubleValue"+postfix ) )
val = element.attribute( "DoubleValue"+postfix );
else if( element.hasAttribute( "DateTimeValue"+postfix ) )
val = element.attribute( "DateTimeValue"+postfix );
else if( element.hasAttribute( "StringValue"+postfix ) )
val = element.attribute( "StringValue"+postfix );
else
return false;
return true;
}
// PENDING(kalle) Support DateTime values, even when writing.
/**
Reads data from a DOM element node that represents a chart
value and fills a KDChartData object with the data.
\param element the DOM element to read from
\param value the chart data object to read the data into
*/
bool KDChartParams::readChartValueNode( const TQDomElement& element,
TQVariant& valY,
TQVariant& valX,
int& propID )
{
if( foundCoordAttribute( element, "", valY ) ||
foundCoordAttribute( element, "Y", valY ) ){ // valY must be there
if( !foundCoordAttribute( element, "X", valX ) ){
valX = TQVariant();
}
propID = 0;
if( element.hasAttribute( "PropertySetID" ) ) {
bool ok;
int i = element.attribute( "PropertySetID" ).toInt( &ok );
if( ok )
propID = i;
}
return true; // if Y value found everything is OK
}
return false;
}
/**
Converts the specified chart type enum to a string representation.
\param type the type enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::chartTypeToString( ChartType type )
{
switch( type ) {
case NoType:
return "NoType";
case Bar:
return "Bar";
case Line:
return "Line";
case Area:
return "Area";
case Pie:
return "Pie";
case HiLo:
return "HiLo";
case BoxWhisker:
return "BoxWhisker";
case Ring:
return "Ring";
case Polar:
return "Polar";
default: // should not happen
return "NoType";
}
}
/**
Converts the specified string to a chart type enum value.
\param string the string to convert
\return the chart type enum value
*/
KDChartParams::ChartType KDChartParams::stringToChartType( const TQString& string )
{
if( string == "NoType" )
return NoType;
else if( string == "Bar" )
return Bar;
else if( string == "Line" )
return Line;
else if( string == "Area" )
return Area;
else if( string == "Pie" )
return Pie;
else if( string == "HiLo" )
return HiLo;
else if( string == "BoxWhisker" )
return BoxWhisker;
else if( string == "Ring" )
return Ring;
else if( string == "Polar" )
return Polar;
else // default, should not happen
return NoType;
}
TQString KDChartParams::markerStyleToString( int style )
{
switch( style ) {
case LineMarkerSquare:
return "Square";
case LineMarkerDiamond:
return "Diamond";
case LineMarkerCircle:
return "Circle";
case LineMarker1Pixel:
return "one Pixel";
case LineMarker4Pixels:
return "four Pixels";
case LineMarkerRing:
return "Ring";
case LineMarkerCross:
return "Cross";
case LineMarkerFastCross:
return "fast Cross";
default: // should not happen
tqDebug( "Unknown marker style" );
return "Circle";
}
}
TQString KDChartParams::markerStyleToStringTr( int style )
{
switch( style ) {
case LineMarkerSquare:
return tr( "Square" );
case LineMarkerDiamond:
return tr( "Diamond" );
case LineMarkerCircle:
return tr( "Circle" );
case LineMarker1Pixel:
return tr( "One pixel" );
case LineMarker4Pixels:
return tr( "Four pixels" );
case LineMarkerRing:
return tr( "Ring" );
case LineMarkerCross:
return tr( "Cross" );
case LineMarkerFastCross:
return tr( "fast Cross" );
default: // should not happen
tqDebug( "Unknown line marker style!" );
return tr( "Circle" );
}
}
int KDChartParams::stringToMarkerStyle( const TQString& string )
{
if( string == "Square" )
return LineMarkerSquare;
else if( string == "Diamond" )
return LineMarkerDiamond;
else if( string == "Circle" )
return LineMarkerCircle;
else if( string == "one Pixel" )
return LineMarker1Pixel;
else if( string == "four Pixels" )
return LineMarker4Pixels;
else if( string == "Ring" )
return LineMarkerRing;
else if( string == "Cross" )
return LineMarkerCross;
else if( string == "fast Cross" )
return LineMarkerFastCross;
else // default, should not happen
return LineMarkerCircle;
}
int KDChartParams::stringToMarkerStyleTr( const TQString& string )
{
if( string == tr( "Square" ) )
return LineMarkerSquare;
else if( string == tr( "Diamond" ) )
return LineMarkerDiamond;
else if( string == tr( "Circle" ) )
return LineMarkerCircle;
else if( string == tr( "One pixel" ) )
return LineMarker1Pixel;
else if( string == tr( "Four pixels" ) )
return LineMarker4Pixels;
else if( string == tr( "Ring" ) )
return LineMarkerRing;
else if( string == tr( "Cross" ) )
return LineMarkerCross;
else if( string == tr( "fast Cross" ) )
return LineMarkerFastCross;
else // default, should not happen
return LineMarkerCircle;
}
/**
Converts the specified bar chart subtype enum to a string representation.
\param type the type enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::barChartSubTypeToString( BarChartSubType type ) {
switch( type ) {
case BarNormal:
return "BarNormal";
case BarStacked:
return "BarStacked";
case BarPercent:
return "BarPercent";
case BarMultiRows:
return "BarMultiRows";
default: // should not happen
tqDebug( "Unknown bar type" );
return "BarNormal";
}
}
/**
Converts the specified string to a bar chart subtype enum value.
\param string the string to convert
\return the bar chart subtype enum value
*/
KDChartParams::BarChartSubType KDChartParams::stringToBarChartSubType( const TQString& string ) {
if( string == "BarNormal" )
return BarNormal;
else if( string == "BarStacked" )
return BarStacked;
else if( string == "BarPercent" )
return BarPercent;
else if( string == "BarMultiRows" )
return BarMultiRows;
else // should not happen
return BarNormal;
}
/**
Converts the specified string to a line chart subtype enum value.
\param string the string to convert
\return the line chart subtype enum value
*/
KDChartParams::LineChartSubType KDChartParams::stringToLineChartSubType( const TQString& string ) {
if( string == "LineNormal" )
return LineNormal;
else if( string == "LineStacked" )
return LineStacked;
else if( string == "LinePercent" )
return LinePercent;
else // should not happen
return LineNormal;
}
/**
Converts the specified line chart subtype enum to a string representation.
\param type the type enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::lineChartSubTypeToString( LineChartSubType type ) {
switch( type ) {
case LineNormal:
return "LineNormal";
case LineStacked:
return "LineStacked";
case LinePercent:
return "LinePercent";
default: // should not happen
tqDebug( "Unknown bar type" );
return "LineNormal";
}
}
/**
Converts the specified line marker style enum to a string
representation.
\param type the type enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::lineMarkerStyleToString( LineMarkerStyle style )
{
return markerStyleToString( style );
}
/**
Converts the specified line marker style enum to a localized
string representation that can be used for string output.
\param type the type enum to convert
\return the localized string representation of the type enum
*/
TQString KDChartParams::lineMarkerStyleToStringTr( LineMarkerStyle style )
{
return markerStyleToStringTr( style );
}
/**
Converts the specified string to a line marker style value.
\param string the string to convert
\return the line marker style enum value
*/
KDChartParams::LineMarkerStyle KDChartParams::stringToLineMarkerStyle( const TQString& string )
{
return static_cast<KDChartParams::LineMarkerStyle>(stringToMarkerStyle( string ));
}
/**
Converts the specified localized string to a line marker style
value.
\param string the string to convert
\return the line marker style enum value
*/
KDChartParams::LineMarkerStyle KDChartParams::stringToLineMarkerStyleTr( const TQString& string )
{
return static_cast<KDChartParams::LineMarkerStyle>(stringToMarkerStyleTr( string ));
}
/**
Converts the specified area chart subtype enum to a string representation.
\param type the subtype enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::areaChartSubTypeToString( AreaChartSubType type ) {
switch( type ) {
case AreaNormal:
return "AreaNormal";
case AreaStacked:
return "AreaStacked";
case AreaPercent:
return "AreaPercent";
default: // should not happen
tqDebug( "Unknown area chart subtype" );
return "AreaNormal";
}
}
/**
Converts the specified string to a area chart subtype enum value.
\param string the string to convert
\return the area chart subtype enum value
*/
KDChartParams::AreaChartSubType KDChartParams::stringToAreaChartSubType( const TQString& string ) {
if( string == "AreaNormal" )
return AreaNormal;
else if( string == "AreaStacked" )
return AreaStacked;
else if( string == "AreaPercent" )
return AreaPercent;
else // should not happen
return AreaNormal;
}
/**
Converts the specified area location enum to a string representation.
\param type the location enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::areaLocationToString( AreaLocation type ) {
switch( type ) {
case AreaAbove:
return "Above";
case AreaBelow:
return "Below";
default: // should not happen
tqDebug( "Unknown area location" );
return "Below";
}
}
/**
Converts the specified string to an area location enum value.
\param string the string to convert
\return the aration location enum value
*/
KDChartParams::AreaLocation KDChartParams::stringToAreaLocation( const TQString& string ) {
if( string == "Above" )
return AreaAbove;
else if( string == "Below" )
return AreaBelow;
else // default, should not happen
return AreaBelow;
}
/**
Converts the specified string to a polar chart subtype enum value.
\param string the string to convert
\return the polar chart subtype enum value
*/
KDChartParams::PolarChartSubType KDChartParams::stringToPolarChartSubType( const TQString& string ) {
if( string == "PolarNormal" )
return PolarNormal;
else if( string == "PolarStacked" )
return PolarStacked;
else if( string == "PolarPercent" )
return PolarPercent;
else // should not happen
return PolarNormal;
}
/**
Converts the specified polar chart subtype enum to a string representation.
\param type the type enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::polarChartSubTypeToString( PolarChartSubType type ) {
switch( type ) {
case PolarNormal:
return "PolarNormal";
case LineStacked:
return "PolarStacked";
case LinePercent:
return "PolarPercent";
default: // should not happen
tqDebug( "Unknown polar type" );
return "PolarNormal";
}
}
/**
Converts the specified polar marker style enum to a string
representation.
\param type the type enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::polarMarkerStyleToString( PolarMarkerStyle style )
{
return markerStyleToString( style );
}
/**
Converts the specified polar marker style enum to a localized
string representation that can be used for string output.
\param type the type enum to convert
\return the localized string representation of the type enum
*/
TQString KDChartParams::polarMarkerStyleToStringTr( PolarMarkerStyle style )
{
return markerStyleToStringTr( style );
}
/**
Converts the specified string to a polar marker style value.
\param string the string to convert
\return the polar marker style enum value
*/
KDChartParams::PolarMarkerStyle KDChartParams::stringToPolarMarkerStyle( const TQString& string )
{
return static_cast<KDChartParams::PolarMarkerStyle>(stringToMarkerStyle( string ));
}
/**
Converts the specified localized string to a polar marker style
value.
\param string the string to convert
\return the polar marker style enum value
*/
KDChartParams::PolarMarkerStyle KDChartParams::stringToPolarMarkerStyleTr( const TQString& string )
{
return static_cast<KDChartParams::PolarMarkerStyle>(stringToMarkerStyle( string ));
}
/**
Converts the specified HiLo chart subtype enum to a string representation.
\param type the subtype enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::hiLoChartSubTypeToString( HiLoChartSubType type ) {
switch( type ) {
case HiLoSimple:
return "HiLoSimple";
case HiLoClose:
return "HiLoClose";
case HiLoOpenClose:
return "HiLoOpenClose";
default: // should not happen
tqDebug( "Unknown HiLo chart subtype" );
return "HiLoNormal";
}
}
/**
Converts the specified string to a HiLo chart subtype enum value.
\param string the string to convert
\return the HiLo chart subtype enum value
*/
KDChartParams::HiLoChartSubType KDChartParams::stringToHiLoChartSubType( const TQString& string ) {
if( string == "HiLoSimple" )
return HiLoSimple;
else if( string == "HiLoClose" )
return HiLoClose;
else if( string == "HiLoOpenClose" )
return HiLoOpenClose;
else // should not happen
return HiLoNormal;
}
/**
Converts the specified string to a BoxWhisker chart subtype enum value.
\param string the string to convert
\return the BoxWhisker chart subtype enum value
*/
KDChartParams::BWChartSubType KDChartParams::stringToBWChartSubType( const TQString& string ) {
if( string == "BWSimple" )
return BWSimple;
else // should not happen
return BWNormal;
}
/**
Converts the specified BWStatVal enum to a string representation.
\param type the BWStatVal enum to convert
\return the string representation of the type BWStatVal
*/
TQString KDChartParams::bWChartStatValToString( BWStatVal type ) {
switch( type ) {
case UpperOuterFence:
return "UpperOuterFence";
case UpperInnerFence:
return "UpperInnerFence";
case Quartile3:
return "Quartile3";
case Median:
return "Median";
case Quartile1:
return "Quartile1";
case LowerInnerFence:
return "LowerInnerFence";
case LowerOuterFence:
return "LowerOuterFence";
case MaxValue:
return "MaxValue";
case MeanValue:
return "MeanValue";
case MinValue:
return "MinValue";
default: // should not happen
tqDebug( "Unknown BoxWhisker statistical value type" );
return "unknown";
}
}
/**
Converts the specified string to a BWStatVal enum value.
\param string the string to convert
\return the BWStatVal enum value
*/
KDChartParams::BWStatVal KDChartParams::stringToBWChartStatVal( const TQString& string ) {
if( string == "UpperOuterFence" )
return UpperOuterFence;
else if( string == "UpperInnerFence" )
return UpperInnerFence;
else if( string == "Quartile3" )
return Quartile3;
else if( string == "Median" )
return Median;
else if( string == "Quartile1" )
return Quartile1;
else if( string == "LowerInnerFence" )
return LowerInnerFence;
else if( string == "LowerOuterFence" )
return LowerOuterFence;
else if( string == "MaxValue" )
return MaxValue;
else if( string == "MeanValue" )
return MeanValue;
else if( string == "MinValue" )
return MinValue;
else // should not happen
return BWStatValUNKNOWN;
}
/**
Converts the specified legend position enum to a string representation.
\param type the legend position enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::legendPositionToString( LegendPosition pos ) {
switch( pos ) {
case NoLegend:
return "NoLegend";
case LegendTop:
return "LegendTop";
case LegendBottom:
return "LegendBottom";
case LegendLeft:
return "LegendLeft";
case LegendRight:
return "LegendRight";
case LegendTopLeft:
return "LegendTopLeft";
case LegendTopLeftTop:
return "LegendTopLeftTop";
case LegendTopLeftLeft:
return "LegendTopLeftLeft";
case LegendBottomLeft:
return "LegendBottomLeft";
case LegendBottomLeftBottom:
return "LegendBottomLeftBottom";
case LegendBottomLeftLeft:
return "LegendBottomLeftLeft";
case LegendTopRight:
return "LegendTopRight";
case LegendTopRightTop:
return "LegendTopRightTop";
case LegendTopRightRight:
return "LegendTopRightRight";
case LegendBottomRight:
return "LegendBottomRight";
case LegendBottomRightBottom:
return "LegendBottomRightBottom";
case LegendBottomRightRight:
return "LegendBottomRightRight";
default: // should not happen
tqDebug( "Unknown legend position" );
return "LegendLeft";
}
}
/**
Converts the specified string to a legend position enum value.
\param string the string to convert
\return the legend position enum value
*/
KDChartParams::LegendPosition KDChartParams::stringToLegendPosition( const TQString& string ) {
if( string == "NoLegend" )
return NoLegend;
else if( string == "LegendTop" )
return LegendTop;
else if( string == "LegendBottom" )
return LegendBottom;
else if( string == "LegendLeft" )
return LegendLeft;
else if( string == "LegendRight" )
return LegendRight;
else if( string == "LegendTopLeft" )
return LegendTopLeft;
else if( string == "LegendTopLeftTop" )
return LegendTopLeftTop;
else if( string == "LegendTopLeftLeft" )
return LegendTopLeftLeft;
else if( string == "LegendBottomLeft" )
return LegendBottomLeft;
else if( string == "LegendBottomLeftBottom" )
return LegendBottomLeftBottom;
else if( string == "LegendBottomLeftLeft" )
return LegendBottomLeftLeft;
else if( string == "LegendTopRight" )
return LegendTopRight;
else if( string == "LegendTopRightTop" )
return LegendTopRightTop;
else if( string == "LegendTopRightRight" )
return LegendTopRightRight;
else if( string == "LegendBottomRight" )
return LegendBottomRight;
else if( string == "LegendBottomRightBottom" )
return LegendBottomRightBottom;
else if( string == "LegendBottomRightRight" )
return LegendBottomRightRight;
else // default, should not happen
return LegendLeft;
}
/**
Converts the specified legend source enum to a string representation.
\param source the legend source enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::legendSourceToString( LegendSource source ) {
switch( source ) {
case LegendManual:
return "Manual";
case LegendFirstColumn:
return "FirstColumn";
case LegendAutomatic:
return "Automatic";
default: // should not happen
tqDebug( "Unknown legend source" );
return "Automatic";
}
}
/**
Converts the specified string to a legend source enum value.
\param string the string to convert
\return the legend source enum value
*/
KDChartParams::LegendSource KDChartParams::stringToLegendSource( const TQString& string ) {
if( string == "Manual" )
return LegendManual;
else if( string == "FirstColumn" )
return LegendFirstColumn;
else if( string == "Automatic" )
return LegendAutomatic;
else // default, should not happen
return LegendAutomatic;
}
/**
Converts the specified chart source mode enum value to a string.
\param mode the chart source mode enum value to convert
\return the string
*/
TQString KDChartParams::chartSourceModeToString( const SourceMode& mode )
{
switch( mode ){
case UnknownMode:
return "UnknownMode";
case DontUse:
return "DontUse";
case DataEntry:
return "DataEntry";
case AxisLabel:
return "AxisLabel";
case LegendText:
return "LegendText";
case ExtraLinesAnchor:
return "ExtraLinesAnchor";
default: // should not happen
return "UnknownMode";
}
}
/**
Converts the specified string to a chart source mode enum value.
\param string the string to convert
\return the chart source mode enum value
*/
KDChartParams::SourceMode KDChartParams::stringToChartSourceMode( const TQString& string )
{
if( string.isEmpty() )
return UnknownMode;
// compatibility with pre-1.0 KDChart stream format:
bool bOk;
int mode = string.toInt( &bOk );
if( bOk && mode >= 0 && mode <= Last_SourceMode )
return (KDChartParams::SourceMode)mode;
// new (KDChart 1.0...) stream format:
if( string == "UnknownMode" )
return UnknownMode;
if( string == "DontUse" )
return DontUse;
if( string == "DataEntry" )
return DataEntry;
if( string == "AxisLabel" )
return AxisLabel;
if( string == "LegendText" )
return LegendText;
if( string == "ExtraLinesAnchor" )
return ExtraLinesAnchor;
// should not happen
return UnknownMode;
}
/**
Converts the specified BoxWhisker chart subtype enum to a string
representation.
\param type the subtype enum to convert
\return the string representation of the type enum
*/
TQString KDChartParams::bWChartSubTypeToString( BWChartSubType type ) {
switch( type ) {
case BWSimple:
return "BWSimple";
default: // should not happen
tqDebug( "Unknown BoxWhisker chart subtype" );
return "BWNormal";
}
}
|