/usr/share/doc/blt-dev/html/barchart.html is in blt-dev 2.5.3+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!-- manual page source format generated by PolyglotMan v3.0.8+XFree86, -->
<!-- available via anonymous ftp from ftp.cs.berkeley.edu:/ucb/people/phelps/tcltk/rman.tar.Z -->
<HTML>
<HEAD>
<TITLE>barchat(n) manual page</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">
<A HREF="#toc">Table of Contents</A><P>
<H2><A NAME="sect0" HREF="#toc0">Name</A></H2>
barchart - Bar chart for plotting X-Y coordinate
data.
<H2><A NAME="sect1" HREF="#toc1">Synopsis</A></H2>
<B>barchart<I> <I>pathName </I></I></B>?<I>option value</I>?...
<H2><A NAME="sect2" HREF="#toc2">Description</A></H2>
The <B>barchart</B> command
creates a bar chart for plotting two-dimensional data (X-Y coordinates). A
bar chart is a graphic means of comparing numbers by displaying bars of
lengths proportional to the y-coordinates of the points they represented.
The bar chart has many configurable components: coordinate axes, elements,
legend, grid lines, cross hairs, etc. They allow you to customize the look
and feel of the graph.
<H2><A NAME="sect3" HREF="#toc3">Introduction</A></H2>
The <B>barchart</B> command creates a new window
for plotting two-dimensional data (X-Y coordinates), using bars of various
lengths to represent the data points. The bars are drawn in a rectangular
area displayed in the center of the new window. This is the <I>plotting area</I>.
The coordinate axes are drawn in the margins surrounding the plotting
area. By default, the legend is drawn in the right margin. The title is
displayed in top margin. <P>
A <B>barchart</B> widget has several configurable components:
coordinate axes, data elements, legend, grid, cross hairs, pens, postscript,
and annotation markers. Each component can be queried or modified.
<DL>
<DT><I>axis</I>
</DT>
<DD><P>
Up to four coordinate axes (two X-coordinate and two Y-coordinate axes)
can be displayed, but you can create and use any number of axes. Axes control
what region of data is displayed and how the data is scaled. Each axis consists
of the axis line, title, major and minor ticks, and tick labels. Tick labels
display the value at each major tick. </DD>
<DT><I>crosshairs</I> </DT>
<DD>Cross hairs are used to
position the mouse pointer relative to the X and Y coordinate axes. Two
perpendicular lines, intersecting at the current location of the mouse,
extend across the plotting area to the coordinate axes. </DD>
<DT><I>element</I> </DT>
<DD>An element
represents a set of data to be plotted. It contains an x and y vector of
values representing the data points. Each data point is displayed as a
bar where the length of the bar is proportional to the ordinate (Y-coordinate)
of the data point. The appearance of the bar, such as its color, stipple,
or relief is configurable. <P>
A special case exists when two or more data points
have the same abscissa (X-coordinate). By default, the bars are overlayed,
one on top of the other. The bars are drawn in the order of the element
display list. But you can also configure the bars to be displayed in two
other ways. They may be displayed as a stack, where each bar (with the
same abscissa) is stacked on the previous. Or they can be drawn side-by-side
as thin bars. The width of each bar is a function of the number of data
points with the same abscissa. </DD>
<DT><I>grid</I> </DT>
<DD>Extends the major and minor ticks of
the X-axis and/or Y-axis across the plotting area. </DD>
<DT><I>legend</I> </DT>
<DD>The legend displays
the name and symbol of each data element. The legend can be drawn in any
margin or in the plotting area. </DD>
<DT><I>marker</I> </DT>
<DD>Markers are used annotate or highlight
areas of the graph. For example, you could use a text marker to label a
particular data point. Markers come in various forms: text strings, bitmaps,
connected line segments, images, polygons, or embedded widgets. </DD>
<DT><I>pen</I> </DT>
<DD>Pens
define attributes for elements. Data elements use pens to specify how they
should be drawn. A data element may use many pens at once. Here the particular
pen used for a data point is determined from each element's weight vector
(see the element's <B>-weight</B> and <B>-style</B> options). </DD>
<DT><I>postscript</I> </DT>
<DD>The widget can generate
encapsulated PostScript output. This component has several options to configure
how the PostScript is generated. </DD>
</DL>
<H2><A NAME="sect4" HREF="#toc4">Syntax</A></H2>
<BR>
<P>
<CODE><B>barchart <I>pathName </I></B>?<I>option value</I>?...<BR>
</CODE><P>The <B>barchart</B> command creates a new window <I>pathName</I> and makes it into a
<B>barchart</B> widget. At the time this command is invoked, there must not exist
a window named <I>pathName</I>, but <I>pathName</I>'s parent must exist. Additional options
may be specified on the command line or in the option database to configure
aspects of the graph such as its colors and font. See the <B>configure</B> operation
below for the exact details about what <I>option</I> and <I>value</I> pairs are valid.
<P>
If successful, <B>barchart</B> returns the path name of the widget. It also creates
a new Tcl command by the same name. You can use this command to invoke
various operations that query or modify the graph. The general form is:
<BR>
<P>
<CODE><I>pathName <I>operation</I></I> ?<I>arg</I>?...<BR>
</CODE><P>Both <I>operation</I> and its arguments determine the exact behavior of the command.
The operations available for the graph are described in the <FONT SIZE=-1><B>BARCHART
OPERATIONS</B></FONT>
section. <P>
The command can also be used to access components of
the graph. <BR>
<P>
<CODE><I>pathName component operation</I> ?<I>arg</I>?...<BR>
</CODE><P>The operation, now located after the name of the component, is the function
to be performed on that component. Each component has its own set of operations
that manipulate that component. They will be described below in their own
sections.
<H2><A NAME="sect5" HREF="#toc5">Example</A></H2>
The <B>barchart</B> command creates a new bar chart. <BR>
<CODE># Create a new bar chart. Plotting area is black.<BR>
barchart .b -plotbackground black<BR>
</CODE><P>A new Tcl command <I>.b</I> is created. This command can be used to query and modify
the bar chart. For example, to change the title of the graph to "My Plot",
you use the new command and the <B>configure</B> operation. <BR>
<CODE># Change the title.<BR>
.b configure -title "My Plot"<BR>
</CODE><P>To add data elements, you use the command and the <B>element</B> component. <BR>
<CODE># Create a new element named "e1"<BR>
.b element create e1 \<BR>
<tt> </tt> <tt> </tt> -xdata { 1 2 3 4 5 6 7 8 9 10 } \<BR>
<tt> </tt> <tt> </tt> -ydata { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 <BR>
<tt> </tt> <tt> </tt> <tt> </tt> <tt> </tt> 155.85 166.60 175.38 }<BR>
</CODE><P>The element's X-Y coordinates are specified using lists of numbers. Alternately,
BLT vectors could be used to hold the X-Y coordinates. <BR>
<CODE># Create two vectors and add them to the barchart.<BR>
vector xVector yVector<BR>
xVector set { 1 2 3 4 5 6 7 8 9 10 }<BR>
yVector set { 26.18 50.46 72.85 93.31 111.86 128.47 143.14 155.85 <BR>
<tt> </tt> <tt> </tt> 166.60 175.38 }<BR>
n.b element create e1 -xdata xVector -ydata yVector<BR>
</CODE><P>The advantage of using vectors is that when you modify one, the graph is
automatically redrawn to reflect the new values. <BR>
<CODE># Change the y coordinate of the first point.<BR>
set yVector(0) 25.18<BR>
</CODE><P>An element named <I>e1</I> is now created in <I>.b</I>. It is automatically added to
the display list of elements. You can use this list to control in what
order elements are displayed. To query or reset the element display list,
you use the element's <B>show</B> operation. <BR>
<CODE># Get the current display list <BR>
set elemList [.b element show]<BR>
# Remove the first element so it won't be displayed.<BR>
.b element show [lrange $elemList 0 end]<BR>
</CODE><P>The element will be displayed by as many bars as there are data points
(in this case there are ten). The bars will be drawn centered at the x-coordinate
of the data point. All the bars will have the same attributes (colors,
stipple, etc). The width of each bar is by default one unit. You can change
this with using the <B>-barwidth</B> option. <BR>
<CODE># Change the scale of the x-coordinate data <BR>
xVector set { 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 }<BR>
# Make sure we change the bar width too.<BR>
.b configure -barwidth 0.2<BR>
</CODE><P>The height of each bar is proportional to the ordinate (Y-coordinate) of
the data point. <P>
If two or more data points have the same abscissa (X-coordinate
value), the bars representing those data points may be drawn in various
ways. The default is to overlay the bars, one on top of the other. The ordering
is determined from the of element display list. If the stacked mode is
selected (using the <B>-barmode</B> configuration option), the bars are stacked,
each bar above the previous. <BR>
<CODE># Display the elements as stacked.<BR>
.b configure -barmode stacked<BR>
</CODE><P>If the aligned mode is selected, the bars having the same x-coordinates
are displayed side by side. The width of each bar is a fraction of its
normal width, based upon the number of bars with the same x-coordinate. <BR>
<CODE># Display the elements side-by-side.<BR>
.b configure -barmode aligned<BR>
</CODE><P>By default, the element's label in the legend will be also <I>e1</I>. You can change
the label, or specify no legend entry, again using the element's <B>configure</B>
operation. <BR>
<CODE># Don't display "e1" in the legend.<BR>
.b element configure e1 -label ""<BR>
</CODE><P>You can configure more than just the element's label. An element has many
attributes such as stipple, foreground and background colors, relief, etc.
<BR>
<CODE>.b element configure e1 -fg red -bg pink \<BR>
<tt> </tt> <tt> </tt> -stipple gray50<BR>
</CODE><P>Four coordinate axes are automatically created: <I>x</I>, <I>x2</I>, <I>y</I>, and <I>y2</I>. And by
default, elements are mapped onto the axes <I>x</I> and <I>y</I>. This can be changed
with the <B>-mapx</B> and <B>-mapy</B> options. <BR>
<CODE># Map "e1" on the alternate y axis "y2".<BR>
.b element configure e1 -mapy y2<BR>
</CODE><P>Axes can be configured in many ways too. For example, you change the scale
of the Y-axis from linear to log using the <B>axis</B> component. <BR>
<CODE># Y-axis is log scale.<BR>
.b axis configure y -logscale yes<BR>
</CODE><P>One important way axes are used is to zoom in on a particular data region.
Zooming is done by simply specifying new axis limits using the <B>-min</B> and
<B>-max</B> configuration options. <BR>
<CODE>.b axis configure x -min 1.0 -max 1.5<BR>
.b axis configure y -min 12.0 -max 55.15<BR>
</CODE><P>To zoom interactively, you link the<B>axis configure</B> operations with some
user interaction (such as pressing the mouse button), using the <B>bind</B> command.
To convert between screen and graph coordinates, use the <B>invtransform</B>
operation. <BR>
<CODE># Click the button to set a new minimum <BR>
bind .b <ButtonPress-1> { <BR>
%W axis configure x -min [%W axis invtransform x %x]<BR>
%W axis configure x -min [%W axis invtransform x %y]<BR>
}<BR>
</CODE><P>By default, the limits of the axis are determined from data values. To reset
back to the default limits, set the <B>-min</B> and <B>-max</B> options to the empty value.
<BR>
<CODE># Reset the axes to autoscale again.<BR>
.b axis configure x -min {} -max {}<BR>
.b axis configure y -min {} -max {}<BR>
</CODE><P>By default, the legend is drawn in the right margin. You can change this
or any legend configuration options using the <B>legend</B> component. <BR>
<CODE># Configure the legend font, color, and relief<BR>
.b legend configure -position left -relief raised \<BR>
<tt> </tt> <tt> </tt> -font fixed -fg blue<BR>
</CODE><P>To prevent the legend from being displayed, turn on the <B>-hide</B> option. <BR>
<CODE># Don't display the legend.<BR>
.b legend configure -hide yes<BR>
</CODE><P>The <B>barchart</B> has simple drawing procedures called markers. They can be
used to highlight or annotate data in the graph. The types of markers available
are bitmaps, polygons, lines, or windows. Markers can be used, for example,
to mark or brush points. For example there may be a line marker which indicates
some low-water value. Markers are created using the <B>marker</B> operation. <BR>
<CODE># Create a line represent the low water mark at 10.0<BR>
.b marker create line -name "low_water" \<BR>
<tt> </tt> <tt> </tt> -coords { -Inf 10.0 Inf 10.0 } \<BR>
<tt> </tt> <tt> </tt> -dashes { 2 4 2 } -fg red -bg blue <BR>
</CODE><P>This creates a line marker named <I>low_water</I>. It will display a horizontal
line stretching across the plotting area at the y-coordinate 10.0. The coordinates
"-Inf" and "Inf" indicate the relative minimum and maximum of the axis (in
this case the x-axis). By default, markers are drawn last, on top of the
bars. You can change this with the <B>-under</B> option. <BR>
<CODE># Draw the marker before elements are drawn.<BR>
.b marker configure low_water -under yes<BR>
</CODE><P>You can add cross hairs or grid lines using the <B>crosshairs</B> and <B>grid</B> components.
<BR>
<CODE># Display both cross hairs and grid lines.<BR>
.b crosshairs configure -hide no -color red<BR>
.b grid configure -hide no -dashes { 2 2 }<BR>
</CODE><P>Finally, to get hardcopy of the graph, use the <B>postscript</B> component. <BR>
<CODE># Print the bar chart into file "file.ps"<BR>
.b postscript output file.ps -maxpect yes -decorations no<BR>
</CODE><P>This generates a file <I>file.ps</I> containing the encapsulated PostScript of
the graph. The option <B>-maxpect</B> says to scale the plot to the size of the
page. Turning off the <B>-decorations</B> option denotes that no borders or color
backgrounds should be drawn (i.e. the background of the margins, legend,
and plotting area will be white).
<H2><A NAME="sect6" HREF="#toc6">Syntax</A></H2>
<BR>
<P>
<CODE><B>barchart <I>pathName </I></B>?<I>option value</I>?...<BR>
</CODE><P>The <B>barchart</B> command creates a new window <I>pathName</I> and makes it into a
barchart widget. At the time this command is invoked, there must not exist
a window named <I>pathName</I>, but <I>pathName</I>'s parent must exist. Additional options
may may be specified on the command line or in the option database to configure
aspects of the bar chart such as its colors and font. See the <B>configure</B>
operation below for the exact details as to what <I>option</I> and <I>value</I> pairs
are valid. <P>
If successful, <B>barchart</B> returns <I>pathName</I>. It also creates a new
Tcl command <I>pathName</I>. This command may be used to invoke various operations
to query or modify the bar chart. It has the general form: <BR>
<P>
<CODE><I>pathName <I>operation</I></I> ?<I>arg</I>?...<BR>
</CODE><P>Both <I>operation</I> and its arguments determine the exact behavior of the command.
The operations available for the bar chart are described in the following
section.
<H2><A NAME="sect7" HREF="#toc7">Barchart Operations</A></H2>
<DL>
<DT><I>pathName <B>bar <I>elemName </I></B></I>?<I>option value</I>?... </DT>
<DD>Creates
a new barchart element <I>elemName</I>. It's an error if an element <I>elemName</I> already
exists. See the manual for <B>barchart</B> for details about what <I>option</I> and
<I>value</I> pairs are valid. </DD>
<DT><I>pathName <B>cget</B></I> <I>option</I> </DT>
<DD>Returns the current value of
the configuration option given by <I>option</I>. <I>Option</I> may be any option described
below for the <B>configure</B> operation. </DD>
<DT><I>pathName <B>configure </B></I>?<I>option value</I>?... </DT>
<DD>Queries
or modifies the configuration options of the graph. If <I>option</I> isn't specified,
a list describing the current options for <I>pathName</I> is returned. If <I>option</I>
is specified, but not <I>value</I>, then a list describing <I>option</I> is returned.
If one or more <I>option</I> and <I>value</I> pairs are specified, then for each pair,
the option <I>option</I> is set to <I>value</I>. The following options are valid. <blockquote></DD>
<DT><B>-background
<I>color</I></B> </DT>
<DD>Sets the background color. This includes the margins and legend, but
not the plotting area. </DD>
<DT><B>-barmode <I>mode</I></B> </DT>
<DD>Indicates how related bar elements
will be drawn. Related elements have data points with the same abscissas
(X-coordinates). <I>Mode</I> indicates how those segments should be drawn. <I>Mode</I> can
be <I>infront</I>, <I>aligned</I>, <I>overlap</I>, or <I>stacked</I>. The default mode is <I>infront</I>. <blockquote></DD>
<DT><I>infront</I>
</DT>
<DD>Each successive segment is drawn in front of the previous. </DD>
<DT><I>stacked</I> </DT>
<DD>Each
successive segment is stacked vertically on top of the previous. </DD>
<DT><I>aligned</I>
</DT>
<DD>Segments is displayed aligned from right-to-left. </DD>
<DT><I>overlap</I> </DT>
<DD>Like <I>aligned</I> but
segments slightly overlap each other. </DD>
</DL>
</blockquote>
<DL>
<DT><B>-barwidth <I>value</I></B> </DT>
<DD>Specifies the width
of the bars. This value can be overridden by the individual elements using
their <B>-barwidth</B> configuration option. <I>Value</I> is the width in terms of graph
coordinates. The default width is <I>1.0</I>. </DD>
<DT><B>-borderwidth <I>pixels</I></B> </DT>
<DD>Sets the width
of the 3-D border around the outside edge of the widget. The <B>-relief</B> option
determines if the border is to be drawn. The default is <I>2</I>. </DD>
<DT><B>-bottommargin
<I>pixels</I></B> </DT>
<DD>Specifies the size of the margin below the X-coordinate axis. If
<I>pixels</I> is <I>0</I>, the size of the margin is selected automatically. The default
is <I>0</I>. </DD>
<DT><B>-bufferelements <I>boolean</I></B> </DT>
<DD>Indicates whether an internal pixmap to buffer
the display of data elements should be used. If <I>boolean</I> is true, data elements
are drawn to an internal pixmap. This option is especially useful when
the graph is redrawn frequently while the remains data unchanged (for example,
moving a marker across the plot). See the <FONT SIZE=-1><B>SPEED TIPS</B></FONT>
section. The default
is <I>1</I>. </DD>
<DT><B>-cursor <I>cursor</I></B> </DT>
<DD>Specifies the widget's cursor. The default cursor is
<I>crosshair</I>. </DD>
<DT><B>-font <I>fontName</I></B> </DT>
<DD>Specifies the font of the graph title. The default
is <I>*-Helvetica-Bold-R-Normal-*-18-180-*</I>. </DD>
<DT><B>-halo <I>pixels</I></B> </DT>
<DD>Specifies a maximum distance
to consider when searching for the closest data point (see the element's
<B>closest</B> operation below). Data points further than <I>pixels</I> away are ignored.
The default is <I>0.5i</I>. </DD>
<DT><B>-height <I>pixels</I></B> </DT>
<DD>Specifies the requested height of widget.
The default is <I>4i</I>. </DD>
<DT><B>-invertxy <I>boolean</I></B> </DT>
<DD>Indicates whether the placement X-axis
and Y-axis should be inverted. If <I>boolean</I> is true, the X and Y axes are
swapped. The default is <I>0</I>. </DD>
<DT><B>-justify <I>justify</I></B> </DT>
<DD>Specifies how the title should
be justified. This matters only when the title contains more than one line
of text. <I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD>
<DT><B>-leftmargin
<I>pixels</I></B> </DT>
<DD>Sets the size of the margin from the left edge of the window to
the Y-coordinate axis. If <I>pixels</I> is <I>0</I>, the size is calculated automatically.
The default is <I>0</I>. </DD>
<DT><B>-plotbackground <I>color</I></B> </DT>
<DD>Specifies the background color of
the plotting area. The default is <I>white</I>. </DD>
<DT><B>-plotborderwidth <I>pixels</I></B> </DT>
<DD>Sets the
width of the 3-D border around the plotting area. The <B>-plotrelief</B> option
determines if a border is drawn. The default is <I>2</I>. </DD>
<DT><B>-plotpadx <I>pad</I></B> </DT>
<DD>Sets the
amount of padding to be added to the left and right sides of the plotting
area. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has two
elements, the left side of the plotting area entry is padded by the first
distance and the right side by the second. If <I>pad</I> is just one distance,
both the left and right sides are padded evenly. The default is <I>8</I>. </DD>
<DT><B>-plotpady
<I>pad</I></B> </DT>
<DD>Sets the amount of padding to be added to the top and bottom of the
plotting area. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I>
has two elements, the top of the plotting area is padded by the first distance
and the bottom by the second. If <I>pad</I> is just one distance, both the top
and bottom are padded evenly. The default is <I>8</I>. </DD>
<DT><B>-plotrelief <I>relief</I></B> </DT>
<DD>Specifies
the 3-D effect for the plotting area. <I>Relief</I> specifies how the interior
of the plotting area should appear relative to rest of the graph; for example,
<I>raised</I> means the plot should appear to protrude from the graph, relative
to the surface of the graph. The default is <I>sunken</I>. </DD>
<DT><B>-relief <I>relief</I></B> </DT>
<DD>Specifies
the 3-D effect for the barchart widget. <I>Relief</I> specifies how the graph should
appear relative to widget it is packed into; for example, <I>raised</I> means
the graph should appear to protrude. The default is <I>flat</I>. </DD>
<DT><B>-rightmargin <I>pixels</I></B>
</DT>
<DD>Sets the size of margin from the plotting area to the right edge of the
window. By default, the legend is drawn in this margin. If <I>pixels</I> is than
1, the margin size is selected automatically. </DD>
<DT><B>-takefocus</B> <I>focus</I> </DT>
<DD>Provides
information used when moving the focus from window to window via keyboard
traversal (e.g., Tab and Shift-Tab). If <I>focus</I> is <I>0</I>, this means that this window
should be skipped entirely during keyboard traversal. <I>1</I> means that the
this window should always receive the input focus. An empty value means
that the traversal scripts make the decision whether to focus on the window.
The default is <I>""</I>. </DD>
<DT><B>-tile <I>image</I></B> </DT>
<DD>Specifies a tiled background for the widget.
If <I>image</I> isn't <I>""</I>, the background is tiled using <I>image</I>. Otherwise, the normal
background color is drawn (see the <B>-background</B> option). <I>Image</I> must be an
image created using the Tk <B>image</B> command. The default is <I>""</I>. </DD>
<DT><B>-title <I>text</I></B>
</DT>
<DD>Sets the title to <I>text</I>. If <I>text</I> is <I>""</I>, no title will be displayed. </DD>
<DT><B>-topmargin
<I>pixels</I></B> </DT>
<DD>Specifies the size of the margin above the x2 axis. If <I>pixels</I> is
<I>0</I>, the margin size is calculated automatically. </DD>
<DT><B>-width <I>pixels</I></B> </DT>
<DD>Specifies the
requested width of the widget. The default is <I>5i</I>. </DD>
</DL>
</blockquote>
<DL>
<DT><I>pathName <B>crosshairs <I>operation
</I></B></I>?<I>arg</I>? </DT>
<DD>See the <FONT SIZE=-1><B>CROSSHAIRS COMPONENT</B></FONT>
section. </DD>
<DT><I>pathName <B>element <I>operation
</I></B></I>?<I>arg</I>?... </DT>
<DD>See the <FONT SIZE=-1><B>ELEMENT COMPONENTS</B></FONT>
section. </DD>
<DT><I>pathName <B>extents <I>item</I></B></I> </DT>
<DD>Returns
the size of a particular item in the graph. <I>Item</I> must be either <I>leftmargin</I>,
<I>rightmargin</I>, <I>topmargin</I>, <I>bottommargin</I>, <I>plotwidth</I>, or <I>plotheight</I>. </DD>
<DT><I>pathName
<B>grid <I>operation </I></B></I>?<I>arg</I>?... </DT>
<DD>See the <FONT SIZE=-1><B>GRID COMPONENT</B></FONT>
section. </DD>
<DT><I>pathName <B>invtransform
<I>winX winY</I></B></I> </DT>
<DD>Performs an inverse coordinate transformation, mapping window
coordinates back to graph coordinates, using the standard X-axis and Y-axis.
Returns a list of containing the X-Y graph coordinates. </DD>
<DT><I>pathName <B>inside <I>x
y</I></B></I> </DT>
<DD>Returns <I>1</I> is the designated screen coordinate (<I>x</I> and <I>y</I>) is inside the
plotting area and <I>0</I> otherwise. </DD>
<DT><I>pathName <B>legend <I>operation </I></B></I>?<I>arg</I>?... </DT>
<DD>See the
<FONT SIZE=-1><B>LEGEND COMPONENT</B></FONT>
section. </DD>
<DT><I>pathName <B>line<B> operation arg</B></B></I>... </DT>
<DD>The operation is
the same as <B>element</B>. </DD>
<DT><I>pathName <B>marker <I>operation </I></B></I>?<I>arg</I>?... </DT>
<DD>See the <FONT SIZE=-1><B>MARKER COMPONENTS</B></FONT>
section. </DD>
<DT><I>pathName</I> <B>metafile</B> ?<I>fileName</I>? </DT>
<DD><I>This operation is for Window platforms
only</I>. Creates a Windows enhanced metafile of the barchart. If present,
<I>fileName</I> is the file name of the new metafile. Otherwise, the metafile is
automatically added to the clipboard. </DD>
<DT><I>pathName <B>postscript <I>operation </I></B></I>?<I>arg</I>?...
</DT>
<DD>See the <FONT SIZE=-1><B>POSTSCRIPT COMPONENT</B></FONT>
section. </DD>
<DT><I>pathName <B>snap <I>photoName</I></B></I> </DT>
<DD>Takes a
snapshot of the graph and stores the contents in the photo image <I>photoName</I>.
<I>PhotoName</I> is the name of a Tk photo image that must already exist. </DD>
<DT><I>pathName
<B>transform <I>x y</I></B></I> </DT>
<DD>Performs a coordinate transformation, mapping graph coordinates
to window coordinates, using the standard X-axis and Y-axis. Returns a list
containing the X-Y screen coordinates. </DD>
<DT><I>pathName <B>xaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
<DD></DD>
<DT><I>pathName
<B>x2axis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
<DD></DD>
<DT><I>pathName <B>yaxis <I>operation</I></B></I> ?<I>arg</I>?... </DT>
<DD></DD>
<DT><I>pathName <B>y2axis
<I>operation</I></B></I> ?<I>arg</I>?... </DT>
<DD>See the <FONT SIZE=-1><B>AXIS COMPONENTS</B></FONT>
section. </DD>
</DL>
<H2><A NAME="sect8" HREF="#toc8">Barchart Components</A></H2>
A
graph is composed of several components: coordinate axes, data elements,
legend, grid, cross hairs, postscript, and annotation markers. Instead of
one big set of configuration options and operations, the graph is partitioned,
where each component has its own configuration options and operations that
specifically control that aspect or part of the graph.
<H3><A NAME="sect9" HREF="#toc9">Axis Components</A></H3>
Four
coordinate axes are automatically created: two X-coordinate axes (<I>x</I> and
<I>x2</I>) and two Y-coordinate axes (<I>y</I>, and <I>y2</I>). By default, the axis <I>x</I> is located
in the bottom margin, <I>y</I> in the left margin, <I>x2</I> in the top margin, and <I>y2</I>
in the right margin. <P>
An axis consists of the axis line, title, major and
minor ticks, and tick labels. Major ticks are drawn at uniform intervals
along the axis. Each tick is labeled with its coordinate value. Minor ticks
are drawn at uniform intervals within major ticks. <P>
The range of the axis
controls what region of data is plotted. Data points outside the minimum
and maximum limits of the axis are not plotted. By default, the minimum
and maximum limits are determined from the data, but you can reset either
limit. <P>
You can create and use several axes. To create an axis, invoke the
axis component and its create operation. <BR>
<CODE># Create a new axis called "temperature"<BR>
.b axis create temperature<BR>
</CODE><P>You map data elements to an axis using the element's -mapy and -mapx configuration
options. They specify the coordinate axes an element is mapped onto. <BR>
<CODE># Now map the temperature data to this axis.<BR>
.b element create "temp" -xdata $x -ydata $tempData \<BR>
-mapy temperature<BR>
</CODE><P>While you can have many axes, only four axes can be displayed simultaneously.
They are drawn in each of the margins surrounding the plotting area. The
axes <I>x</I> and <I>y</I> are drawn in the bottom and left margins. The axes <I>x2</I> and <I>y2</I>
are drawn in top and right margins. Only <I>x</I> and <I>y</I> are shown by default. Note
that the axes can have different scales. <P>
To display a different axis, you
invoke one of the following components: <B>xaxis</B>, <B>yaxis</B>, <B>x2axis</B>, and <B>y2axis</B>.
The <B>use</B> operation designates the axis to be drawn in the corresponding
margin: <B>xaxis</B> in the bottom, <B>yaxis</B> in the left, <B>x2axis</B> in the top, and
<B>y2axis</B> in the right. <BR>
<CODE># Display the axis temperature in the left margin.<BR>
.b yaxis use temperature<BR>
<P>
</CODE><P>You can configure axes in many ways. The axis scale can be linear or logarithmic.
The values along the axis can either monotonically increase or decrease.
If you need custom tick labels, you can specify a Tcl procedure to format
the label any way you wish. You can control how ticks are drawn, by changing
the major tick interval or the number of minor ticks. You can define non-uniform
tick intervals, such as for time-series plots. <P>
<DL>
<DT><I>pathName <B>axis <B>cget <I>axisName
<I>option</I></I></B></B></I> </DT>
<DD>Returns the current value of the option given by <I>option</I> for <I>axisName</I>.
<I>Option</I> may be any option described below for the axis <B>configure</B> operation.
</DD>
<DT><I>pathName <B>axis <B>configure <I>axisName </I></B></B></I>?<I>axisName</I>?... ?<I>option value</I>?... </DT>
<DD>Queries or modifies
the configuration options of <I>axisName</I>. Several axes can be changed. If <I>option</I>
isn't specified, a list describing all the current options for <I>axisName</I>
is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing
<I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified,
then for each pair, the axis option <I>option</I> is set to <I>value</I>. The following
options are valid for axes. <blockquote></DD>
<DT><B>-autorange <I>range</I></B> </DT>
<DD>Sets the range of values for
the axis to <I>range</I>. The axis limits are automatically reset to display the
most recent data points in this range. If <I>range</I> is 0.0, the range is determined
from the limits of the data. If <B>-min</B> or <B>-max</B> are specified, they override
this option. The default is <I>0.0</I>. </DD>
<DT><B>-color <I>color</I></B> </DT>
<DD>Sets the color of the axis and
tick labels. The default is <I>black</I>. </DD>
<DT><B>-command <I>prefix</I></B> </DT>
<DD>Specifies a Tcl command
to be invoked when formatting the axis tick labels. <I>Prefix</I> is a string containing
the name of a Tcl proc and any extra arguments for the procedure. This
command is invoked for each major tick on the axis. Two additional arguments
are passed to the procedure: the pathname of the widget and the current
the numeric value of the tick. The procedure returns the formatted tick
label. If <I>""</I> is returned, no label will appear next to the tick. You can
get the standard tick labels again by setting <I>prefix</I> to <I>""</I>. The default
is <I>""</I>. <P>
Please note that this procedure is invoked while the bar chart is
redrawn. You may query the widget's configuration options. But do not reset
options, because this can have unexpected results. </DD>
<DT><B>-descending <I>boolean</I></B> </DT>
<DD>Indicates
whether the values along the axis are monotonically increasing or decreasing.
If <I>boolean</I> is true, the axis values will be decreasing. The default is
<I>0</I>. </DD>
<DT><B>-hide <I>boolean</I></B> </DT>
<DD>Indicates whether the axis is displayed. </DD>
<DT><B>-justify <I>justify</I></B>
</DT>
<DD>Specifies how the axis title should be justified. This matters only when
the axis title contains more than one line of text. <I>Justify</I> must be <I>left</I>,
<I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD>
<DT><B>-limits <I>formatStr</I></B> </DT>
<DD>Specifies a printf-like
description to format the minimum and maximum limits of the axis. The limits
are displayed at the top/bottom or left/right sides of the plotting area.
<I>FormatStr</I> is a list of one or two format descriptions. If one description
is supplied, both the minimum and maximum limits are formatted in the same
way. If two, the first designates the format for the minimum limit, the
second for the maximum. If <I>""</I> is given as either description, then the
that limit will not be displayed. The default is <I>""</I>. </DD>
<DT><B>-linewidth <I>pixels</I></B> </DT>
<DD>Sets
the width of the axis and tick lines. The default is <I>1</I> pixel. </DD>
<DT><B>-logscale <I>boolean</I></B>
</DT>
<DD>Indicates whether the scale of the axis is logarithmic or linear. If <I>boolean</I>
is true, the axis is logarithmic. The default scale is linear. </DD>
<DT><B>-loose <I>boolean</I></B>
</DT>
<DD>Indicates whether the limits of the axis should fit the data points tightly,
at the outermost data points, or loosely, at the outer tick intervals. This
is relevant only when the axis limit is automatically calculated. If <I>boolean</I>
is true, the axis range is "loose". The default is <I>0</I>. </DD>
<DT><B>-majorticks <I>majorList</I></B>
</DT>
<DD>Specifies where to display major axis ticks. You can use this option to
display ticks at non-uniform intervals. <I>MajorList</I> is a list of axis coordinates
designating the location of major ticks. No minor ticks are drawn. If <I>majorList</I>
is <I>""</I>, major ticks will be automatically computed. The default is <I>""</I>. </DD>
<DT><B>-max
<I>value</I></B> </DT>
<DD>Sets the maximum limit of <I>axisName</I>. Any data point greater than
<I>value</I> is not displayed. If <I>value</I> is <I>""</I>, the maximum limit is calculated
using the largest data value. The default is <I>""</I>. </DD>
<DT><B>-min <I>value</I></B> </DT>
<DD>Sets the minimum
limit of <I>axisName</I>. Any data point less than <I>value</I> is not displayed. If
<I>value</I> is <I>""</I>, the minimum limit is calculated using the smallest data value.
The default is <I>""</I>. </DD>
<DT><B>-minorticks <I>minorList</I></B> </DT>
<DD>Specifies where to display minor
axis ticks. You can use this option to display minor ticks at non-uniform
intervals. <I>MinorList</I> is a list of real values, ranging from 0.0 to 1.0, designating
the placement of a minor tick. No minor ticks are drawn if the <B>-majortick</B>
option is also set. If <I>minorList</I> is <I>""</I>, minor ticks will be automatically
computed. The default is <I>""</I>. </DD>
<DT><B>-rotate <I>theta</I></B> </DT>
<DD>Specifies the how many degrees
to rotate the axis tick labels. <I>Theta</I> is a real value representing the number
of degrees to rotate the tick labels. The default is <I>0.0</I> degrees. </DD>
<DT><B>-shiftby
<I>value</I></B> </DT>
<DD>Specifies how much to automatically shift the range of the axis. When
the new data exceeds the current axis maximum, the maximum is increased
in increments of <I>value</I>. You can use this option to prevent the axis limits
from being recomputed at each new time point. If <I>value</I> is 0.0, then no automatic
shifting is down. The default is <I>0.0</I>. </DD>
<DT><B>-showticks <I>boolean</I></B> </DT>
<DD>Indicates whether
axis ticks should be drawn. If <I>boolean</I> is true, ticks are drawn. If false,
only the axis line is drawn. The default is <I>1</I>. </DD>
<DT><B>-stepsize <I>value</I></B> </DT>
<DD>Specifies the
interval between major axis ticks. If <I>value</I> isn't a valid interval (must
be less than the axis range), the request is ignored and the step size
is automatically calculated. </DD>
<DT><B>-subdivisions <I>number</I></B> </DT>
<DD>Indicates how many minor
axis ticks are to be drawn. For example, if <I>number</I> is two, only one minor
tick is drawn. If <I>number</I> is one, no minor ticks are displayed. The default
is <I>2</I>. </DD>
<DT><B>-tickfont <I>fontName</I></B> </DT>
<DD>Specifies the font for axis tick labels. The default
is <I>*-Courier-Bold-R-Normal-*-100-*</I>. </DD>
<DT><B>-ticklength <I>pixels</I></B> </DT>
<DD>Sets the length of major
and minor ticks (minor ticks are half the length of major ticks). If <I>pixels</I>
is less than zero, the axis will be inverted with ticks drawn pointing
towards the plot. The default is <I>0.1i</I>. </DD>
<DT><B>-title <I>text</I></B> </DT>
<DD>Sets the title of the axis.
If <I>text</I> is <I>""</I>, no axis title will be displayed. </DD>
<DT><B>-titlecolor <I>color</I></B> </DT>
<DD>Sets
the color of the axis title. The default is <I>black</I>. </DD>
<DT><B>-titlefont <I>fontName</I></B> </DT>
<DD>Specifies
the font for axis title. The default is <I>*-Helvetica-Bold-R-Normal-*-14-140-*</I>. </DD>
</DL>
<P>
Axis
configuration options may be also be set by the <B>option</B> command. The resource
class is <I>Axis</I>. The resource names are the names of the axes (such as <I>x</I>
or <I>x2</I>). <BR>
<CODE>option add *Barchart.Axis.Color blue<BR>
option add *Barchart.x.LogScale true<BR>
option add *Barchart.x2.LogScale false<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>axis <B>create <I>axisName </I></B></B></I>?<I>option value</I>?... </DT>
<DD>Creates a new axis by the
name <I>axisName</I>. No axis by the same name can already exist. <I>Option</I> and <I>value</I>
are described in above in the axis <B>configure</B> operation. </DD>
<DT><I>pathName <B>axis <B>delete
</B></B></I>?<I>axisName</I>?... </DT>
<DD>Deletes the named axes. An axis is not really deleted until it
is not longer in use, so it's safe to delete axes mapped to elements. </DD>
<DT><I>pathName
<B>axis invtransform <I>axisName value</I></B></I> </DT>
<DD>Performs the inverse transformation, changing
the screen coordinate <I>value</I> to a graph coordinate, mapping the value mapped
to <I>axisName</I>. Returns the graph coordinate. </DD>
<DT><I>pathName <B>axis limits <I>axisName</I></B></I>
</DT>
<DD>Returns a list of the minimum and maximum limits for <I>axisName</I>. The order
of the list is <I>min max</I>. </DD>
<DT><I>pathName <B>axis names </B></I>?<I>pattern</I>?... </DT>
<DD>Returns a list of
axes matching zero or more patterns. If no <I>pattern</I> argument is give, the
names of all axes are returned. </DD>
<DT><I>pathName <B>axis transform <I>axisName value</I></B></I> </DT>
<DD>Transforms
the coordinate <I>value</I> to a screen coordinate by mapping the it to <I>axisName</I>.
Returns the transformed screen coordinate. </DD>
</DL>
<P>
Only four axes can be displayed
simultaneously. By default, they are <I>x</I>, <I>y</I>, <I>x2</I>, and <I>y2</I>. You can swap in
a different axis with <B>use</B> operation of the special axis components: <B>xaxis</B>,
<B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B>. <BR>
<CODE>.g create axis temp<BR>
.g create axis time<BR>
...<BR>
.g xaxis use temp<BR>
.g yaxis use time<BR>
</CODE><P>Only the axes specified for use are displayed on the screen. <P>
The <B>xaxis</B>,
<B>x2axis</B>, <B>yaxis</B>, and <B>y2axis</B> components operate on an axis location rather
than a specific axis like the more general <B>axis</B> component does. The <B>xaxis</B>
component manages the X-axis located in the bottom margin (whatever axis
that happens to be). Likewise, <B>yaxis</B> uses the Y-axis in the left margin,
<B>x2axis</B> the top X-axis, and <B>y2axis</B> the right Y-axis. <P>
They implicitly control
the axis that is currently using to that location. By default, <B>xaxis</B> uses
the <I>x</I> axis, <B>yaxis</B> uses <I>y</I>, <B>x2axis</B> uses <I>x2</I>, and <B>y2axis</B> uses <I>y2</I>. These components
can be more convenient to use than always determining what axes are current
being displayed by the graph. <P>
The following operations are available for
axes. They mirror exactly the operations of the <B>axis</B> component. The <I>axis</I>
argument must be <B>xaxis</B>, <B>x2axis</B>, <B>yaxis</B>, or <B>y2axis</B>.
<DL>
<DT><I>pathName <I>axis <B>cget <I>option</I></B></I></I>
</DT>
<DD></DD>
<DT><I>pathName <I>axis <B>configure </B></I></I>?<I>option value</I>?... </DT>
<DD></DD>
<DT><I>pathName <I>axis<B> invtransform <I>value</I></B></I></I>
</DT>
<DD></DD>
<DT><I>pathName <I>axis <B>limits</B></I></I> </DT>
<DD></DD>
<DT><I>pathName <I>axis<B> transform <I>value</I></B></I></I> </DT>
<DD></DD>
<DT><I>pathName <I>axis<B> use </B></I></I>?<I>axisName</I>?
</DT>
<DD>Designates the axis <I>axisName</I> is to be displayed at this location. <I>AxisName</I>
can not be already in use at another location. This command returns the
name of the axis currently using this location. </DD>
</DL>
<H3><A NAME="sect10" HREF="#toc10">Crosshairs Component</A></H3>
Cross
hairs consist of two intersecting lines (one vertical and one horizontal)
drawn completely across the plotting area. They are used to position the
mouse in relation to the coordinate axes. Cross hairs differ from line
markers in that they are implemented using XOR drawing primitives. This
means that they can be quickly drawn and erased without redrawing the entire
widget. <P>
The following operations are available for cross hairs:
<DL>
<DT><I>pathName
<B>crosshairs cget <I>option</I></B></I> </DT>
<DD>Returns the current value of the cross hairs configuration
option given by <I>option</I>. <I>Option</I> may be any option described below for the
cross hairs <B>configure</B> operation. </DD>
<DT><I>pathName <B>crosshairs configure </B></I>?<I>option value</I>?...
</DT>
<DD>Queries or modifies the configuration options of the cross hairs. If
<I>option</I> isn't specified, a list describing all the current options for the
cross hairs is returned. If <I>option</I> is specified, but not <I>value</I>, then a
list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs
are specified, then for each pair, the cross hairs option <I>option</I> is set
to <I>value</I>. The following options are available for cross hairs. <blockquote></DD>
<DT><B>-color <I>color</I></B>
</DT>
<DD>Sets the color of the cross hairs. The default is <I>black</I>. </DD>
<DT><B>-dashes <I>dashList</I></B>
</DT>
<DD>Sets the dash style of the cross hairs. <I>DashList</I> is a list of up to 11 numbers
that alternately represent the lengths of the dashes and gaps on the cross
hair lines. Each number must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the
cross hairs will be solid lines. </DD>
<DT><B>-hide <I>boolean</I></B> </DT>
<DD>Indicates whether cross hairs
are drawn. If <I>boolean</I> is true, cross hairs are not drawn. The default is
<I>yes</I>. </DD>
<DT><B>-linewidth <I>pixels</I></B> </DT>
<DD>Set the width of the cross hair lines. The default
is <I>1</I>. </DD>
<DT><B>-position <I>pos</I></B> </DT>
<DD>Specifies the screen position where the cross hairs
intersect. <I>Pos</I> must be in the form "<I>@x,y</I>", where <I>x</I> and <I>y</I> are the window
coordinates of the intersection. </DD>
</DL>
<P>
Cross hairs configuration options may be
also be set by the <B>option</B> command. The resource name and class are <I>crosshairs</I>
and <I>Crosshairs</I> respectively. <BR>
<CODE>option add *Barchart.Crosshairs.LineWidth 2<BR>
option add *Barchart.Crosshairs.Color red<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>crosshairs off</B></I> </DT>
<DD>Turns off the cross hairs. </DD>
<DT><I>pathName <B>crosshairs
on</B></I> </DT>
<DD>Turns on the display of the cross hairs. </DD>
<DT><I>pathName <B>crosshairs toggle</B></I>
</DT>
<DD>Toggles the current state of the cross hairs, alternately mapping and unmapping
the cross hairs. </DD>
</DL>
<H2><A NAME="sect11" HREF="#toc11">Elements</A></H2>
A data element represents a set of data. It contains
x and y vectors which are the coordinates of the data points. Elements
are displayed as bars where the length of the bar is proportional to the
ordinate of the data point. Elements also control the appearance of the
data, such as the color, stipple, relief, etc. <P>
When new data elements are
created, they are automatically added to a list of displayed elements.
The display list controls what elements are drawn and in what order.
<P>
The following operations are available for elements.
<DL>
<DT><I>pathName <B>element activate
<I>elemName </I></B></I>?<I>index</I>?... </DT>
<DD>Specifies the data points of element <I>elemName</I> to be drawn
using active foreground and background colors. <I>ElemName</I> is the name of
the element and <I>index</I> is a number representing the index of the data point.
If no indices are present then all data points become active. </DD>
<DT><I>pathName <B>element
bind <I>tagName</I></B></I> ?<I>sequence</I>? ?<I>command</I>? </DT>
<DD>Associates <I>command</I> with <I>tagName</I> such
that whenever the event sequence given by <I>sequence</I> occurs for an element
with this tag, <I>command</I> will be invoked. The syntax is similar to the <B>bind</B>
command except that it operates on graph elements, rather than widgets.
See the <B>bind</B> manual entry for complete details on <I>sequence</I> and the substitutions
performed on <I>command</I> before invoking it. <P>
If all arguments are specified
then a new binding is created, replacing any existing binding for the
same <I>sequence</I> and <I>tagName</I>. If the first character of <I>command</I> is <I>+</I> then <I>command</I>
augments an existing binding rather than replacing it. If no <I>command</I> argument
is provided then the command currently associated with <I>tagName</I> and <I>sequence</I>
(it's an error occurs if there's no such binding) is returned. If both <I>command</I>
and <I>sequence</I> are missing then a list of all the event sequences for which
bindings have been defined for <I>tagName</I>. </DD>
<DT><I>pathName <B>element cget <I>elemName
<I>option</I></I></B></I> </DT>
<DD>Returns the current value of the element configuration option given
by <I>option</I>. <I>Option</I> may be any of the options described below for the element
<B>configure</B> operation. </DD>
<DT><I>pathName <B>element closest <I>x y</I></B></I> ?<I>option value</I>?... ?<I>elemName</I>?...
</DT>
<DD>Finds the data point representing the bar closest to the window coordinates
<I>x</I> and <I>y</I> in the element <I>elemName</I>. <I>ElemName</I> is the name of an element, which
must be displayed. If no elements are specified, then all displayed elements
are searched. It returns a list containing the name of the closest element,
the index of its closest point, and the graph coordinates of the point.
If no data point within the threshold distance can be found, <I>""</I> is returned.
The following <I>option</I>-<I>value</I> pairs are available. <blockquote></DD>
<DT><B>-halo <I>pixels</I></B> </DT>
<DD>Specifies a
threshold distance where selected data points are ignored. <I>Pixels</I> is a valid
screen distance, such as <I>2</I> or <I>1.2i</I>. If this option isn't specified, then it
defaults to the value of the <B>barchart</B>'s <B>-halo</B> option. </DD>
</DL>
</blockquote>
<DL>
<DT><I>pathName <B>element configure
<I>elemName </I></B></I>?<I>elemName</I>... ?<I>option value</I>?... </DT>
<DD>Queries or modifies the configuration
options for elements. Several elements can be modified at the same time.
If <I>option</I> isn't specified, a list describing all the current options for
<I>elemName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list
describing the option <I>option</I> is returned. If one or more <I>option</I> and <I>value</I>
pairs are specified, then for each pair, the element option <I>option</I> is set
to <I>value</I>. The following options are valid for elements. <blockquote></DD>
<DT><B>-activepen <I>penName</I></B>
</DT>
<DD>Specifies pen to use to draw active element. If <I>penName</I> is <I>""</I>, no active
elements will be drawn. The default is <I>activeLine</I>. </DD>
<DT><B>-bindtags <I>tagList</I></B> </DT>
<DD>Specifies
the binding tags for the element. <I>TagList</I> is a list of binding tag names.
The tags and their order will determine how events for elements. Each
tag in the list matching the current event sequence will have its Tcl command
executed. Implicitly the name of the element is always the first tag in
the list. The default value is <I>all</I>. </DD>
<DT><B>-background <I>color</I></B> </DT>
<DD>Sets the the color
of the border around each bar. The default is <I>white</I>. </DD>
<DT><B>-barwidth <I>value</I></B> </DT>
<DD>Specifies
the width the bars drawn for the element. <I>Value</I> is the width in X-coordinates.
If this option isn't specified, the width of each bar is the value of the
widget's <B>-barwidth</B> option. </DD>
<DT><B>-baseline <I>value</I></B> </DT>
<DD>Specifies the baseline of the bar
segments. This affects how bars are drawn since bars are drawn from their
respective y-coordinate the baseline. By default the baseline is <I>0.0</I>. </DD>
<DT><B>-borderwidth
<I>pixels</I></B> </DT>
<DD>Sets the border width of the 3-D border drawn around the outside
of each bar. The <B>-relief</B> option determines if such a border is drawn. <I>Pixels</I>
must be a valid screen distance like <I>2</I> or <I>0.25i</I>. The default is <I>2</I>. </DD>
<DT><B>-data <I>coordList</I></B>
</DT>
<DD>Specifies the X-Y coordinates of the data. <I>CoordList</I> is a list of numeric
expressions representing the X-Y coordinate pairs of each data point. </DD>
<DT><B>-foreground
<I>color</I></B> </DT>
<DD>Sets the color of the interior of the bars. </DD>
<DT><B>-hide <I>boolean</I></B> </DT>
<DD>Indicates
whether the element is displayed. The default is <I>no</I>. </DD>
<DT><B>-label <I>text</I></B> </DT>
<DD>Sets the
element's label in the legend. If <I>text</I> is <I>""</I>, the element will have no entry
in the legend. The default label is the element's name. </DD>
<DT><B>-mapx <I>xAxis</I></B> </DT>
<DD>Selects
the X-axis to map the element's X-coordinates onto. <I>XAxis</I> must be the name
of an axis. The default is <I>x</I>. </DD>
<DT><B>-mapy <I>yAxis</I></B> </DT>
<DD>Selects the Y-axis to map the element's
Y-coordinates onto. <I>YAxis</I> must be the name of an axis. The default is <I>y</I>. </DD>
<DT><B>-relief
<I>string</I></B> </DT>
<DD>Specifies the 3-D effect desired for bars. <I>Relief</I> indicates how the
interior of the bar should appear relative to the surface of the chart;
for example, <I>raised</I> means the bar should appear to protrude from the surface
of the plotting area. The default is <I>raised</I>. </DD>
<DT><B>-stipple <I>bitmap</I></B> </DT>
<DD>Specifies a
stipple pattern with which to draw the bars. If <I>bitmap</I> is <I>""</I>, then the
bar is drawn in a solid fashion. </DD>
<DT><B>-xdata <I>xVector</I></B> </DT>
<DD>Specifies the x-coordinate
vector of the data. <I>XVector</I> is the name of a BLT vector or a list of numeric
expressions. </DD>
<DT><B>-ydata <I>yVector</I></B> </DT>
<DD>Specifies the y-coordinate vector of the data.
<I>YVector</I> is the name of a BLT vector or a list of numeric expressions.
</DD>
</DL>
<P>
Element configuration options may also be set by the <B>option</B> command. The
resource names in the option database are prefixed by <I>elem</I>. <BR>
<CODE>option add *Barchart.Element.background blue<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>element create <I>elemName</I></B></I> ?<I>option value</I>?... </DT>
<DD>Creates a new element <I>elemName</I>.
Element names must be unique, so an element <I>elemName</I> may not already exist.
If additional arguments are present, they specify any of the element options
valid for element <B>configure</B> operation. </DD>
<DT><I>pathName <B>element deactivate <I>pattern</I></B></I>...
</DT>
<DD>Deactivates all the elements matching <I>pattern</I> for the graph. Elements
whose names match any of the patterns given are redrawn using their normal
colors. </DD>
<DT><I>pathName <B>element delete</B></I> ?<I>pattern</I>?... </DT>
<DD>Deletes all the elements matching
<I>pattern</I> for the graph. Elements whose names match any of the patterns
given are deleted. The graph will be redrawn without the deleted elements.
</DD>
<DT><I>pathName <B>element exists <I>elemName</I></B></I> </DT>
<DD>Returns <I>1</I> if an element <I>elemName</I> currently
exists and <I>0</I> otherwise. </DD>
<DT><I>pathName <B>element names </B></I>?<I>pattern</I>?... </DT>
<DD>Returns the elements
matching one or more pattern. If no <I>pattern</I> is given, the names of all
elements is returned. </DD>
<DT><I>pathName <B>element show</B></I> ?<I>nameList</I>? </DT>
<DD>Queries or modifies
the element display list. The element display list designates the elements
drawn and in what order. <I>NameList</I> is a list of elements to be displayed
in the order they are named. If there is no <I>nameList</I> argument, the current
display list is returned. </DD>
<DT><I>pathName <B>element type</B></I> <I>elemName</I> </DT>
<DD>Returns the type
of <I>elemName</I>. If the element is a bar element, the commands returns the
string <I>"bar"</I>, otherwise it returns <I>"line"</I>. </DD>
</DL>
<H3><A NAME="sect12" HREF="#toc12"></CODE><P>Grid Component</A></H3>
Grid lines extend
from the major and minor ticks of each axis horizontally or vertically
across the plotting area. The following operations are available for grid
lines.
<DL>
<DT><I>pathName <B>grid cget <I>option</I></B></I> </DT>
<DD>Returns the current value of the grid line
configuration option given by <I>option</I>. <I>Option</I> may be any option described
below for the grid <B>configure</B> operation. </DD>
<DT><I>pathName <B>grid configure</B></I> ?<I>option
value</I>?... </DT>
<DD>Queries or modifies the configuration options for grid lines. If
<I>option</I> isn't specified, a list describing all the current grid options for
<I>pathName</I> is returned. If <I>option</I> is specified, but not <I>value</I>, then a list
describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are
specified, then for each pair, the grid line option <I>option</I> is set to <I>value</I>.
The following options are valid for grid lines. <blockquote></DD>
<DT><B>-color <I>color</I></B> </DT>
<DD>Sets the color
of the grid lines. The default is <I>black</I>. </DD>
<DT><B>-dashes <I>dashList</I></B> </DT>
<DD>Sets the dash style
of the grid lines. <I>DashList</I> is a list of up to 11 numbers that alternately
represent the lengths of the dashes and gaps on the grid lines. Each number
must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the grid will be solid lines.
</DD>
<DT><B>-hide <I>boolean</I></B> </DT>
<DD>Indicates whether the grid should be drawn. If <I>boolean</I> is true,
grid lines are not shown. The default is <I>yes</I>. </DD>
<DT><B>-linewidth <I>pixels</I></B> </DT>
<DD>Sets the width
of grid lines. The default width is <I>1</I>. </DD>
<DT><B>-mapx <I>xAxis</I></B> </DT>
<DD>Specifies the X-axis to
display grid lines. <I>XAxis</I> must be the name of an axis or <I>""</I> for no grid
lines. The default is <I>""</I>. </DD>
<DT><B>-mapy <I>yAxis</I></B> </DT>
<DD>Specifies the Y-axis to display grid
lines. <I>YAxis</I> must be the name of an axis or <I>""</I> for no grid lines. The default
is <I>y</I>. </DD>
<DT><B>-minor <I>boolean</I></B> </DT>
<DD>Indicates whether the grid lines should be drawn for
minor ticks. If <I>boolean</I> is true, the lines will appear at minor tick intervals.
The default is <I>1</I>. </DD>
</DL>
<P>
Grid configuration options may also be set by the <B>option</B>
command. The resource name and class are <I>grid</I> and <I>Grid</I> respectively. <BR>
<CODE>option add *Barchart.grid.LineWidth 2<BR>
option add *Barchart.Grid.Color black<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>grid off</B></I> </DT>
<DD>Turns off the display the grid lines. </DD>
<DT><I>pathName <B>grid on</B></I>
</DT>
<DD>Turns on the display the grid lines. </DD>
<DT><I>pathName <B>grid toggle</B></I> </DT>
<DD>Toggles the display
of the grid. </DD>
</DL>
<H3><A NAME="sect13" HREF="#toc13">Legend Component</A></H3>
The legend displays a list of the data elements.
Each entry consists of the element's symbol and label. The legend can appear
in any margin (the default location is in the right margin). It can also
be positioned anywhere within the plotting area. <P>
The following operations
are valid for the legend.
<DL>
<DT><I>pathName <B>legend activate <I>pattern</I></B></I>... </DT>
<DD>Selects legend
entries to be drawn using the active legend colors and relief. All entries
whose element names match <I>pattern</I> are selected. To be selected, the element
name must match only one <I>pattern</I>. </DD>
<DT><I>pathName <B>legend bind <I>tagName</I></B></I> ?<I>sequence</I>?
?<I>command</I>? </DT>
<DD>Associates <I>command</I> with <I>tagName</I> such that whenever the event
sequence given by <I>sequence</I> occurs for a legend entry with this tag, <I>command</I>
will be invoked. Implicitly the element names in the entry are tags. The
syntax is similar to the <B>bind</B> command except that it operates on legend
entries, rather than widgets. See the <B>bind</B> manual entry for complete details
on <I>sequence</I> and the substitutions performed on <I>command</I> before invoking
it. <P>
If all arguments are specified then a new binding is created, replacing
any existing binding for the same <I>sequence</I> and <I>tagName</I>. If the first character
of <I>command</I> is <I>+</I> then <I>command</I> augments an existing binding rather than
replacing it. If no <I>command</I> argument is provided then the command currently
associated with <I>tagName</I> and <I>sequence</I> (it's an error occurs if there's no
such binding) is returned. If both <I>command</I> and <I>sequence</I> are missing then
a list of all the event sequences for which bindings have been defined
for <I>tagName</I>. </DD>
<DT><I>pathName <B>legend cget <I>option</I></B></I> </DT>
<DD>Returns the current value of a
legend configuration option. <I>Option</I> may be any option described below in
the legend <B>configure</B> operation. </DD>
<DT><I>pathName <B>legend configure </B></I>?<I>option value</I>?...
</DT>
<DD>Queries or modifies the configuration options for the legend. If <I>option</I>
isn't specified, a list describing the current legend options for <I>pathName</I>
is returned. If <I>option</I> is specified, but not <I>value</I>, then a list describing
<I>option</I> is returned. If one or more <I>option</I> and <I>value</I> pairs are specified,
then for each pair, the legend option <I>option</I> is set to <I>value</I>. The following
options are valid for the legend. <blockquote></DD>
<DT><B>-activebackground <I>color</I></B> </DT>
<DD>Sets the background
color for active legend entries. All legend entries marked active (see
the legend <B>activate</B> operation) are drawn using this background color. </DD>
<DT><B>-activeborderwidth
<I>pixels</I></B> </DT>
<DD>Sets the width of the 3-D border around the outside edge of the active
legend entries. The default is <I>2</I>. </DD>
<DT><B>-activeforeground <I>color</I></B> </DT>
<DD>Sets the foreground
color for active legend entries. All legend entries marked as active (see
the legend <B>activate</B> operation) are drawn using this foreground color. </DD>
<DT><B>-activerelief
<I>relief</I></B> </DT>
<DD>Specifies the 3-D effect desired for active legend entries. <I>Relief</I>
denotes how the interior of the entry should appear relative to the legend;
for example, <I>raised</I> means the entry should appear to protrude from the
legend, relative to the surface of the legend. The default is <I>flat</I>. </DD>
<DT><B>-anchor
<I>anchor</I></B> </DT>
<DD>Tells how to position the legend relative to the positioning point
for the legend. This is dependent on the value of the <B>-position</B> option.
The default is <I>center</I>. <blockquote></DD>
<DT><I>left</I> or <I>right</I> </DT>
<DD>The anchor describes how to position
the legend vertically. </DD>
<DT><I>top</I> or <I>bottom</I> </DT>
<DD>The anchor describes how to position
the legend horizontally. </DD>
<DT><I>@x,y</I> </DT>
<DD>The anchor specifies how to position the
legend relative to the positioning point. For example, if <I>anchor</I> is <I>center</I>
then the legend is centered on the point; if <I>anchor</I> is <I>n</I> then the legend
will be drawn such that the top center point of the rectangular region
occupied by the legend will be at the positioning point. </DD>
<DT><I>plotarea</I> </DT>
<DD>The anchor
specifies how to position the legend relative to the plotting area. For
example, if <I>anchor</I> is <I>center</I> then the legend is centered in the plotting
area; if <I>anchor</I> is <I>ne</I> then the legend will be drawn such that occupies
the upper right corner of the plotting area. </DD>
</DL>
</blockquote>
<DL>
<DT><B>-background <I>color</I></B> </DT>
<DD>Sets the background
color of the legend. If <I>color</I> is <I>""</I>, the legend background with be transparent.
</DD>
<DT><B>-bindtags <I>tagList</I></B> </DT>
<DD>Specifies the binding tags for legend entries. <I>TagList</I>
is a list of binding tag names. The tags and their order will determine
how events for legend entries. Each tag in the list matching the current
event sequence will have its Tcl command executed. The default value is
<I>all</I>. </DD>
<DT><B>-borderwidth <I>pixels</I></B> </DT>
<DD>Sets the width of the 3-D border around the outside
edge of the legend (if such border is being drawn; the <B>relief</B> option determines
this). The default is <I>2</I> pixels. </DD>
<DT><B>-font <I>fontName</I></B> </DT>
<DD><I>FontName</I> specifies a font
to use when drawing the labels of each element into the legend. The default
is <I>*-Helvetica-Bold-R-Normal-*-12-120-*</I>. </DD>
<DT><B>-foreground <I>color</I></B> </DT>
<DD>Sets the foreground color
of the text drawn for the element's label. The default is <I>black</I>. </DD>
<DT><B>-hide <I>boolean</I></B>
</DT>
<DD>Indicates whether the legend should be displayed. If <I>boolean</I> is true, the
legend will not be draw. The default is <I>no</I>. </DD>
<DT><B>-ipadx <I>pad</I></B> </DT>
<DD>Sets the amount of
internal padding to be added to the width of each legend entry. <I>Pad</I> can
be a list of one or two screen distances. If <I>pad</I> has two elements, the
left side of the legend entry is padded by the first distance and the right
side by the second. If <I>pad</I> is just one distance, both the left and right
sides are padded evenly. The default is <I>2</I>. </DD>
<DT><B>-ipady <I>pad</I></B> </DT>
<DD>Sets an amount of internal
padding to be added to the height of each legend entry. <I>Pad</I> can be a list
of one or two screen distances. If <I>pad</I> has two elements, the top of the
entry is padded by the first distance and the bottom by the second. If
<I>pad</I> is just one distance, both the top and bottom of the entry are padded
evenly. The default is <I>2</I>. </DD>
<DT><B>-padx <I>pad</I></B> </DT>
<DD>Sets the padding to the left and right
exteriors of the legend. <I>Pad</I> can be a list of one or two screen distances.
If <I>pad</I> has two elements, the left side of the legend is padded by the
first distance and the right side by the second. If <I>pad</I> has just one distance,
both the left and right sides are padded evenly. The default is <I>4</I>. </DD>
<DT><B>-pady
<I>pad</I></B> </DT>
<DD>Sets the padding above and below the legend. <I>Pad</I> can be a list of one
or two screen distances. If <I>pad</I> has two elements, the area above the legend
is padded by the first distance and the area below by the second. If <I>pad</I>
is just one distance, both the top and bottom areas are padded evenly.
The default is <I>0</I>. </DD>
<DT><B>-position <I>pos</I></B> </DT>
<DD>Specifies where the legend is drawn. The <B>-anchor</B>
option also affects where the legend is positioned. If <I>pos</I> is <I>left</I>, <I>left</I>,
<I>top</I>, or <I>bottom</I>, the legend is drawn in the specified margin. If <I>pos</I> is
<I>plotarea</I>, then the legend is drawn inside the plotting area at a particular
anchor. If <I>pos</I> is in the form "<I>@x,y</I>", where <I>x</I> and <I>y</I> are the window coordinates,
the legend is drawn in the plotting area at the specified coordinates.
The default is <I>right</I>. </DD>
<DT><B>-raised <I>boolean</I></B> </DT>
<DD>Indicates whether the legend is above
or below the data elements. This matters only if the legend is in the plotting
area. If <I>boolean</I> is true, the legend will be drawn on top of any elements
that may overlap it. The default is <I>no</I>. </DD>
<DT><B>-relief <I>relief</I></B> </DT>
<DD>Specifies the 3-D effect
for the border around the legend. <I>Relief</I> specifies how the interior of the
legend should appear relative to the bar chart; for example, <I>raised</I> means
the legend should appear to protrude from the bar chart, relative to the
surface of the bar chart. The default is <I>sunken</I>. </DD>
</DL>
<P>
Legend configuration options
may also be set by the <B>option</B> command. The resource name and class are
<I>legend</I> and <I>Legend</I> respectively. <BR>
<CODE>option add *Barchart.legend.Foreground blue<BR>
option add *Barchart.Legend.Relief raised<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>legend deactivate <I>pattern</I></B></I>... </DT>
<DD>Selects legend entries to be drawn using
the normal legend colors and relief. All entries whose element names match
<I>pattern</I> are selected. To be selected, the element name must match only
one <I>pattern</I>. </DD>
<DT><I>pathName <B>legend get <I>pos</I></B></I> </DT>
<DD>Returns the name of the element whose
entry is at the screen position <I>pos</I> in the legend. <I>Pos</I> must be in the form
"<I>@x,y</I>", where <I>x</I> and <I>y</I> are window coordinates. If the given coordinates
do not lie over a legend entry, <I>""</I> is returned. </DD>
</DL>
<H3><A NAME="sect14" HREF="#toc14">Pen Components</A></H3>
Pens define
attributes for elements. Pens mirror the configuration options of data elements
that pertain to how symbols and lines are drawn. Data elements use pens
to determine how they are drawn. A data element may use several pens at
once. In this case, the pen used for a particular data point is determined
from each element's weight vector (see the element's <B>-weight</B> and <B>-style</B> options).
<P>
One pen, called <I>activeBar</I>, is automatically created. It's used as the default
active pen for elements. So you can change the active attributes for all
elements by simply reconfiguring this pen. <BR>
<CODE>.g pen configure "activeBar" -fg green -bg green4<BR>
</CODE><P>You can create and use several pens. To create a pen, invoke the pen component
and its create operation. <BR>
<CODE>.g pen create myPen<BR>
</CODE><P>You map pens to a data element using either the element's <B>-pen</B> or <B>-activepen</B>
options. <BR>
<CODE>.g element create "e1" -xdata $x -ydata $tempData \<BR>
-pen myPen<BR>
</CODE><P>An element can use several pens at once. This is done by specifying the
name of the pen in the element's style list (see the <B>-styles</B> option). <BR>
<CODE>.g element configure "e1" -styles { myPen 2.0 3.0 }<BR>
</CODE><P>This says that any data point with a weight between 2.0 and 3.0 is to be
drawn using the pen <I>myPen</I>. All other points are drawn with the element's
default attributes. <P>
The following operations are available for pen components.
<P>
<DL>
<DT><I>pathName <B>pen <B>cget <I>penName <I>option</I></I></B></B></I> </DT>
<DD>Returns the current value of the option
given by <I>option</I> for <I>penName</I>. <I>Option</I> may be any option described below for
the pen <B>configure</B> operation. </DD>
<DT><I>pathName <B>pen <B>configure <I>penName </I></B></B></I>?<I>penName</I>... ?<I>option
value</I>?... </DT>
<DD>Queries or modifies the configuration options of <I>penName</I>. Several
pens can be modified at once. If <I>option</I> isn't specified, a list describing
the current options for <I>penName</I> is returned. If <I>option</I> is specified, but
not <I>value</I>, then a list describing <I>option</I> is returned. If one or more <I>option</I>
and <I>value</I> pairs are specified, then for each pair, the pen option <I>option</I>
is set to <I>value</I>. The following options are valid for pens. <blockquote></DD>
<DT><B>-background <I>color</I></B>
</DT>
<DD>Sets the the color of the border around each bar. The default is <I>white</I>.
</DD>
<DT><B>-borderwidth <I>pixels</I></B> </DT>
<DD>Sets the border width of the 3-D border drawn around
the outside of each bar. The <B>-relief</B> option determines if such a border
is drawn. <I>Pixels</I> must be a valid screen distance like <I>2</I> or <I>0.25i</I>. The default
is <I>2</I>. </DD>
<DT><B>-foreground <I>color</I></B> </DT>
<DD>Sets the color of the interior of the bars. </DD>
<DT><B>-relief
<I>string</I></B> </DT>
<DD>Specifies the 3-D effect desired for bars. <I>Relief</I> indicates how the
interior of the bar should appear relative to the surface of the chart;
for example, <I>raised</I> means the bar should appear to protrude from the bar
chart, relative to the surface of the plotting area. The default is <I>raised</I>.
</DD>
<DT><B>-stipple <I>bitmap</I></B> </DT>
<DD>Specifies a stipple pattern with which to draw the bars.
If <I>bitmap</I> is <I>""</I>, then the bar is drawn in a solid fashion. </DD>
<DT><B>-type <I>elemType</I></B>
</DT>
<DD>Specifies the type of element the pen is to be used with. This option should
only be employed when creating the pen. This is for those that wish to
mix different types of elements (bars and lines) on the same graph. The
default type is "bar". </DD>
</DL>
<P>
Pen configuration options may be also be set by the
<B>option</B> command. The resource class is <I>Pen</I>. The resource names are the names
of the pens. <BR>
<CODE>option add *Barchart.Pen.Foreground<tt> </tt> <tt> </tt> blue<BR>
option add *Barchart.activeBar.foreground green<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>pen <B>create <I>penName </I></B></B></I>?<I>option value</I>?... </DT>
<DD>Creates a new pen by the name
<I>penName</I>. No pen by the same name can already exist. <I>Option</I> and <I>value</I> are
described in above in the pen <B>configure</B> operation. </DD>
<DT><I>pathName <B>pen <B>delete
</B></B></I>?<I>penName</I>?... </DT>
<DD>Deletes the named pens. A pen is not really deleted until it is
not longer in use, so it's safe to delete pens mapped to elements. </DD>
<DT><I>pathName
<B>pen names </B></I>?<I>pattern</I>?... </DT>
<DD>Returns a list of pens matching zero or more patterns.
If no <I>pattern</I> argument is give, the names of all pens are returned. </DD>
</DL>
<H3><A NAME="sect15" HREF="#toc15">PostScript
Component</A></H3>
The barchart can generate encapsulated PostScript output. There
are several configuration options you can specify to control how the plot
will be generated. You can change the page dimensions and borders. The
plot itself can be scaled, centered, or rotated to landscape. The PostScript
output can be written directly to a file or returned through the interpreter.
<P>
The following postscript operations are available.
<DL>
<DT><I>pathName <B>postscript cget
<I>option</I></B></I> </DT>
<DD>Returns the current value of the postscript option given by <I>option</I>.
<I>Option</I> may be any option described below for the postscript <B>configure</B>
operation. </DD>
<DT><I>pathName <B>postscript configure </B></I>?<I>option value</I>?... </DT>
<DD>Queries or modifies
the configuration options for PostScript generation. If <I>option</I> isn't specified,
a list describing the current postscript options for <I>pathName</I> is returned.
If <I>option</I> is specified, but not <I>value</I>, then a list describing <I>option</I> is
returned. If one or more <I>option</I> and <I>value</I> pairs are specified, then for
each pair, the postscript option <I>option</I> is set to <I>value</I>. The following
postscript options are available. <blockquote></DD>
<DT><B>-center <I>boolean</I></B> </DT>
<DD>Indicates whether the plot
should be centered on the PostScript page. If <I>boolean</I> is false, the plot
will be placed in the upper left corner of the page. The default is <I>1</I>. </DD>
<DT><B>-colormap
<I>varName</I></B> </DT>
<DD><I>VarName</I> must be the name of a global array variable that specifies
a color mapping from the X color name to PostScript. Each element of <I>varName</I>
must consist of PostScript code to set a particular color value (e.g. ``<I>1.0
1.0 0.0 setrgbcolor</I>''). When generating color information in PostScript, the
array variable <I>varName</I> is checked if an element of the name as the color
exists. If so, it uses its value as the PostScript command to set the color.
If this option hasn't been specified, or if there isn't an entry in <I>varName</I>
for a given color, then it uses the red, green, and blue intensities from
the X color. </DD>
<DT><B>-colormode <I>mode</I></B> </DT>
<DD>Specifies how to output color information. <I>Mode</I>
must be either <I>color</I> (for full color output), <I>gray</I> (convert all colors
to their gray-scale equivalents) or <I>mono</I> (convert foreground colors to black
and background colors to white). The default mode is <I>color</I>. </DD>
<DT><B>-fontmap <I>varName</I></B>
</DT>
<DD><I>VarName</I> must be the name of a global array variable that specifies a font
mapping from the X font name to PostScript. Each element of <I>varName</I> must
consist of a Tcl list with one or two elements; the name and point size
of a PostScript font. When outputting PostScript commands for a particular
font, the array variable <I>varName</I> is checked to see if an element by the
specified font exists. If there is such an element, then the font information
contained in that element is used in the PostScript output. (If the point
size is omitted from the list, the point size of the X font is used). Otherwise
the X font is examined in an attempt to guess what PostScript font to use.
This works only for fonts whose foundry property is <I>Adobe</I> (such as Times,
Helvetica, Courier, etc.). If all of this fails then the font defaults to
<I>Helvetica-Bold</I>. </DD>
<DT><B>-decorations <I>boolean</I></B> </DT>
<DD>Indicates whether PostScript commands
to generate color backgrounds and 3-D borders will be output. If <I>boolean</I>
is false, the graph will background will be white and no 3-D borders will
be generated. The default is <I>1</I>. </DD>
<DT><B>-height <I>pixels</I></B> </DT>
<DD>Sets the height of the plot.
This lets you print the bar chart with a height different from the one
drawn on the screen. If <I>pixels</I> is 0, the height is the same as the widget's
height. The default is <I>0</I>. </DD>
<DT><B>-landscape <I>boolean</I></B> </DT>
<DD>If <I>boolean</I> is true, this specifies
the printed area is to be rotated 90 degrees. In non-rotated output the
X-axis of the printed area runs along the short dimension of the page (``portrait''
orientation); in rotated output the X-axis runs along the long dimension
of the page (``landscape'' orientation). Defaults to <I>0</I>. </DD>
<DT><B>-maxpect <I>boolean</I></B> </DT>
<DD>Indicates
to scale the plot so that it fills the PostScript page. The aspect ratio
of the barchart is still retained. The default is <I>0</I>. </DD>
<DT><B>-padx <I>pad</I></B> </DT>
<DD>Sets the horizontal
padding for the left and right page borders. The borders are exterior to
the plot. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has
two elements, the left border is padded by the first distance and the right
border by the second. If <I>pad</I> has just one distance, both the left and right
borders are padded evenly. The default is <I>1i</I>. </DD>
<DT><B>-pady <I>pad</I></B> </DT>
<DD>Sets the vertical
padding for the top and bottom page borders. The borders are exterior to
the plot. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has
two elements, the top border is padded by the first distance and the bottom
border by the second. If <I>pad</I> has just one distance, both the top and bottom
borders are padded evenly. The default is <I>1i</I>. </DD>
<DT><B>-paperheight <I>pixels</I></B> </DT>
<DD>Sets the
height of the postscript page. This can be used to select between different
page sizes (letter, A4, etc). The default height is <I>11.0i</I>. </DD>
<DT><B>-paperwidth <I>pixels</I></B>
</DT>
<DD>Sets the width of the postscript page. This can be used to select between
different page sizes (letter, A4, etc). The default width is <I>8.5i</I>. </DD>
<DT><B>-width
<I>pixels</I></B> </DT>
<DD>Sets the width of the plot. This lets you generate a plot of a width
different from that of the widget. If <I>pixels</I> is 0, the width is the same
as the widget's width. The default is <I>0</I>. </DD>
</DL>
<P>
Postscript configuration options
may be also be set by the <B>option</B> command. The resource name and class are
<I>postscript</I> and <I>Postscript</I> respectively. <BR>
<CODE>option add *Barchart.postscript.Decorations false<BR>
option add *Barchart.Postscript.Landscape true<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>postscript output </B></I>?<I>fileName</I>? ?<I>option value</I>?... </DT>
<DD>Outputs a file of
encapsulated PostScript. If a <I>fileName</I> argument isn't present, the command
returns the PostScript. If any <I>option-value</I> pairs are present, they set configuration
options controlling how the PostScript is generated. <I>Option</I> and <I>value</I> can
be anything accepted by the postscript <B>configure</B> operation above. </DD>
</DL>
<H3><A NAME="sect16" HREF="#toc16">Marker
Components</A></H3>
Markers are simple drawing procedures used to annotate or highlight
areas of the graph. Markers have various types: text strings, bitmaps,
images, connected lines, windows, or polygons. They can be associated with
a particular element, so that when the element is hidden or un-hidden, so
is the marker. By default, markers are the last items drawn, so that data
elements will appear in behind them. You can change this by configuring
the <B>-under</B> option. <P>
Markers, in contrast to elements, don't affect the scaling
of the coordinate axes. They can also have <I>elastic</I> coordinates (specified
by <I>-Inf</I> and <I>Inf</I> respectively) that translate into the minimum or maximum
limit of the axis. For example, you can place a marker so it always remains
in the lower left corner of the plotting area, by using the coordinates
<I>-Inf</I>,<I>-Inf</I>. <P>
The following operations are available for markers.
<DL>
<DT><I>pathName <B>marker
after <I>markerId</I></B></I> ?<I>afterId</I>? </DT>
<DD>Changes the order of the markers, drawing the
first marker after the second. If no second <I>afterId</I> argument is specified,
the marker is placed at the end of the display list. This command can be
used to control how markers are displayed since markers are drawn in the
order of this display list. </DD>
<DT><I>pathName <B>marker before <I>markerId</I></B></I> ?<I>beforeId</I>? </DT>
<DD>Changes
the order of the markers, drawing the first marker before the second. If
no second <I>beforeId</I> argument is specified, the marker is placed at the beginning
of the display list. This command can be used to control how markers are
displayed since markers are drawn in the order of this display list. </DD>
<DT><I>pathName
<B>marker bind <I>tagName</I></B></I> ?<I>sequence</I>? ?<I>command</I>? </DT>
<DD>Associates <I>command</I> with <I>tagName</I>
such that whenever the event sequence given by <I>sequence</I> occurs for a marker
with this tag, <I>command</I> will be invoked. The syntax is similar to the <B>bind</B>
command except that it operates on graph markers, rather than widgets.
See the <B>bind</B> manual entry for complete details on <I>sequence</I> and the substitutions
performed on <I>command</I> before invoking it. <P>
If all arguments are specified
then a new binding is created, replacing any existing binding for the
same <I>sequence</I> and <I>tagName</I>. If the first character of <I>command</I> is <I>+</I> then <I>command</I>
augments an existing binding rather than replacing it. If no <I>command</I> argument
is provided then the command currently associated with <I>tagName</I> and <I>sequence</I>
(it's an error occurs if there's no such binding) is returned. If both <I>command</I>
and <I>sequence</I> are missing then a list of all the event sequences for which
bindings have been defined for <I>tagName</I>. </DD>
<DT><I>pathName <B>marker cget <I>option</I></B></I> </DT>
<DD>Returns
the current value of the marker configuration option given by <I>option</I>. <I>Option</I>
may be any option described below in the <B>configure</B> operation. </DD>
<DT><I>pathName <B>marker
configure <I>markerId</I></B></I> ?<I>option value</I>?... </DT>
<DD>Queries or modifies the configuration
options for markers. If <I>option</I> isn't specified, a list describing the current
options for <I>markerId</I> is returned. If <I>option</I> is specified, but not <I>value</I>,
then a list describing <I>option</I> is returned. If one or more <I>option</I> and <I>value</I>
pairs are specified, then for each pair, the marker option <I>option</I> is set
to <I>value</I>. <P>
The following options are valid for all markers. Each type of marker
also has its own type-specific options. They are described in the sections
below. <blockquote></DD>
<DT><B>-bindtags <I>tagList</I></B> </DT>
<DD>Specifies the binding tags for the marker. <I>TagList</I>
is a list of binding tag names. The tags and their order will determine
how events for markers are handled. Each tag in the list matching the
current event sequence will have its Tcl command executed. Implicitly
the name of the marker is always the first tag in the list. The default
value is <I>all</I>. </DD>
<DT><B>-coords <I>coordList</I></B> </DT>
<DD>Specifies the coordinates of the marker.
<I>CoordList</I> is a list of graph coordinates. The number of coordinates required
is dependent on the type of marker. Text, image, and window markers need
only two coordinates (an X-Y coordinate). Bitmap markers can take either
two or four coordinates (if four, they represent the corners of the bitmap).
Line markers need at least four coordinates, polygons at least six. If <I>coordList</I>
is <I>""</I>, the marker will not be displayed. The default is <I>""</I>. </DD>
<DT><B>-element <I>elemName</I></B>
</DT>
<DD>Links the marker with the element <I>elemName</I>. The marker is drawn only if
the element is also currently displayed (see the element's <B>show</B> operation).
If <I>elemName</I> is <I>""</I>, the marker is always drawn. The default is <I>""</I>. </DD>
<DT><B>-hide
<I>boolean</I></B> </DT>
<DD>Indicates whether the marker is drawn. If <I>boolean</I> is true, the
marker is not drawn. The default is <I>no</I>. </DD>
<DT><B>-mapx <I>xAxis</I></B> </DT>
<DD>Specifies the X-axis
to map the marker's X-coordinates onto. <I>XAxis</I> must the name of an axis. The
default is <I>x</I>. </DD>
<DT><B>-mapy <I>yAxis</I></B> </DT>
<DD>Specifies the Y-axis to map the marker's Y-coordinates
onto. <I>YAxis</I> must the name of an axis. The default is <I>y</I>. </DD>
<DT><B>-name <I>markerId</I></B> </DT>
<DD>Changes
the identifier for the marker. The identifier <I>markerId</I> can not already
be used by another marker. If this option isn't specified, the marker's name
is uniquely generated. </DD>
<DT><B>-under <I>boolean</I></B> </DT>
<DD>Indicates whether the marker is drawn
below/above data elements. If <I>boolean</I> is true, the marker is be drawn underneath
the data elements. Otherwise, the marker is drawn on top of the element.
The default is <I>0</I>. </DD>
<DT><B>-xoffset <I>pixels</I></B> </DT>
<DD>Specifies a screen distance to offset
the marker horizontally. <I>Pixels</I> is a valid screen distance, such as <I>2</I> or
<I>1.2i</I>. The default is <I>0</I>. </DD>
<DT><B>-yoffset <I>pixels</I></B> </DT>
<DD>Specifies a screen distance to offset
the markers vertically. <I>Pixels</I> is a valid screen distance, such as <I>2</I> or
<I>1.2i</I>. The default is <I>0</I>. </DD>
</DL>
<P>
Marker configuration options may also be set by the
<B>option</B> command. The resource class is either <I>BitmapMarker</I>, <I>ImageMarker</I>,
<I>LineMarker</I>, <I>PolygonMarker</I>, <I>TextMarker</I>, or <I>WindowMarker</I>, depending on the
type of marker. The resource name is the name of the marker. <BR>
<CODE>option add *Barchart.TextMarker.Foreground white<BR>
option add *Barchart.BitmapMarker.Foreground white<BR>
option add *Barchart.m1.Background blue<BR>
</blockquote>
<DL>
<DT></CODE><P><I>pathName <B>marker create <I>type</I></B></I> ?<I>option value</I>?... </DT>
<DD>Creates a marker of the selected
type. <I>Type</I> may be either <I>text</I>, <I>line</I>, <I>bitmap</I>, <I>image</I>, <I>polygon</I>, or <I>window</I>.
This command returns the marker identifier, used as the <I>markerId</I> argument
in the other marker-related commands. If the <B>-name</B> option is used, this overrides
the normal marker identifier. If the name provided is already used for
another marker, the new marker will replace the old. </DD>
<DT><I>pathName <B>marker delete</B></I>
?<I>name</I>?... </DT>
<DD>Removes one of more markers. The graph will automatically be redrawn
without the marker.. </DD>
<DT><I>pathName <B>marker exists <I>markerId</I></B></I> </DT>
<DD>Returns <I>1</I> if the
marker <I>markerId</I> exists and <I>0</I> otherwise. </DD>
<DT><I>pathName <B>marker names</B></I> ?<I>pattern</I>?
</DT>
<DD>Returns the names of all the markers that currently exist. If <I>pattern</I>
is supplied, only those markers whose names match it will be returned. </DD>
<DT><I>pathName
<B>marker type <I>markerId</I></B></I> </DT>
<DD>Returns the type of the marker given by <I>markerId</I>,
such as <I>line</I> or <I>text</I>. If <I>markerId</I> is not a valid a marker identifier, <I>""</I>
is returned. </DD>
</DL>
<H3><A NAME="sect17" HREF="#toc17">Bitmap Markers</A></H3>
A bitmap marker displays a bitmap. The size of
the bitmap is controlled by the number of coordinates specified. If two
coordinates, they specify the position of the top-left corner of the bitmap.
The bitmap retains its normal width and height. If four coordinates, the
first and second pairs of coordinates represent the corners of the bitmap.
The bitmap will be stretched or reduced as necessary to fit into the bounding
rectangle. <P>
Bitmap markers are created with the marker's <B>create</B> operation
in the form: <BR>
<P>
<CODE><I>pathName <B>marker create bitmap </B></I>?<I>option value</I>?...<BR>
</CODE><P>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration options
for the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's
<B>configure</B> operation. <P>
The following options are specific to bitmap markers:
<DL>
<DT><B>-background <I>color</I></B> </DT>
<DD>Same as the <B>-fill</B> option. </DD>
<DT><B>-bitmap <I>bitmap</I></B> </DT>
<DD>Specifies the bitmap
to be displayed. If <I>bitmap</I> is <I>""</I>, the marker will not be displayed. The
default is <I>""</I>. </DD>
<DT><B>-fill <I>color</I></B> </DT>
<DD>Sets the background color of the bitmap. If <I>color</I>
is the empty string, no background will be transparent. The default background
color is <I>""</I>. </DD>
<DT><B>-foreground <I>color</I></B> </DT>
<DD>Same as the <B>-outline</B> option. </DD>
<DT><B>-mask <I>mask</I></B> </DT>
<DD>Specifies
a mask for the bitmap to be displayed. This mask is a bitmap itself, denoting
the pixels that are transparent. If <I>mask</I> is <I>""</I>, all pixels of the bitmap
will be drawn. The default is <I>""</I>. </DD>
<DT><B>-outline <I>color</I></B> </DT>
<DD>Sets the foreground color
of the bitmap. The default value is <I>black</I>. </DD>
<DT><B>-rotate <I>theta</I></B> </DT>
<DD>Sets the rotation
of the bitmap. <I>Theta</I> is a real number representing the angle of rotation
in degrees. The marker is first rotated and then placed according to its
anchor position. The default rotation is <I>0.0</I>. </DD>
</DL>
<H3><A NAME="sect18" HREF="#toc18">Image Markers</A></H3>
A image marker
displays an image. Image markers are created with the marker's <B>create</B> operation
in the form: <BR>
<P>
<CODE><I>pathName <B>marker create image </B></I>?<I>option value</I>?...<BR>
</CODE><P>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's <B>configure</B>
operation. <P>
The following options are specific to image markers:
<DL>
<DT><B>-anchor <I>anchor</I></B>
</DT>
<DD><I>Anchor</I> tells how to position the image relative to the positioning point
for the image. For example, if <I>anchor</I> is <I>center</I> then the image is centered
on the point; if <I>anchor</I> is <I>n</I> then the image will be drawn such that the
top center point of the rectangular region occupied by the image will be
at the positioning point. This option defaults to <I>center</I>. </DD>
<DT><B>-image <I>image</I></B> </DT>
<DD>Specifies
the image to be drawn. If <I>image</I> is <I>""</I>, the marker will not be drawn. The
default is <I>""</I>. </DD>
</DL>
<H3><A NAME="sect19" HREF="#toc19">Line Markers</A></H3>
A line marker displays one or more connected
line segments. Line markers are created with marker's <B>create</B> operation in
the form: <BR>
<P>
<CODE><I>pathName <B>marker create line </B></I>?<I>option value</I>?...<BR>
</CODE><P>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's <B>configure</B>
operation. <P>
The following options are specific to line markers:
<DL>
<DT><B>-dashes <I>dashList</I></B>
</DT>
<DD>Sets the dash style of the line. <I>DashList</I> is a list of up to 11 numbers
that alternately represent the lengths of the dashes and gaps on the line.
Each number must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the marker line
will be solid. </DD>
<DT><B>-fill <I>color</I></B> </DT>
<DD>Sets the background color of the line. This color
is used with striped lines (see the <B>-fdashesR option). If <I>color</I></B> is the empty
string, no background color is drawn (the line will be dashed, not striped).
The default background color is <I>""</I>. </DD>
<DT><B>-linewidth <I>pixels</I></B> </DT>
<DD>Sets the width of
the lines. The default width is <I>0</I>. </DD>
<DT><B>-outline <I>color</I></B> </DT>
<DD>Sets the foreground color
of the line. The default value is <I>black</I>. </DD>
<DT><B>-stipple <I>bitmap</I></B> </DT>
<DD>Specifies a stipple
pattern used to draw the line, rather than a solid line. <I>Bitmap</I> specifies
a bitmap to use as the stipple pattern. If <I>bitmap</I> is <I>""</I>, then the line
is drawn in a solid fashion. The default is <I>""</I>. </DD>
</DL>
<H3><A NAME="sect20" HREF="#toc20">Polygon Markers</A></H3>
A polygon
marker displays a closed region described as two or more connected line
segments. It is assumed the first and last points are connected. Polygon
markers are created using the marker <B>create</B> operation in the form: <BR>
<P>
<CODE><I>pathName <B>marker create polygon </B></I>?<I>option value</I>?...<BR>
</CODE><P>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
the marker. These same <I>option</I>-<I>value</I> pairs may be used with the <B>marker configure</B>
command to change the marker's configuration. The following options are supported
for polygon markers:
<DL>
<DT><B>-dashes <I>dashList</I></B> </DT>
<DD>Sets the dash style of the outline
of the polygon. <I>DashList</I> is a list of up to 11 numbers that alternately
represent the lengths of the dashes and gaps on the outline. Each number
must be between 1 and 255. If <I>dashList</I> is <I>""</I>, the outline will be a solid
line. </DD>
<DT><B>-fill <I>color</I></B> </DT>
<DD>Sets the fill color of the polygon. If <I>color</I> is <I>""</I>, then
the interior of the polygon is transparent. The default is <I>white</I>. </DD>
<DT><B>-linewidth
<I>pixels</I></B> </DT>
<DD>Sets the width of the outline of the polygon. If <I>pixels</I> is zero,
no outline is drawn. The default is <I>0</I>. </DD>
<DT><B>-outline <I>color</I></B> </DT>
<DD>Sets the color of the
outline of the polygon. If the polygon is stippled (see the <B>-stipple</B> option),
then this represents the foreground color of the stipple. The default is
<I>black</I>. </DD>
<DT><B>-stipple <I>bitmap</I></B> </DT>
<DD>Specifies that the polygon should be drawn with a
stippled pattern rather than a solid color. <I>Bitmap</I> specifies a bitmap to
use as the stipple pattern. If <I>bitmap</I> is <I>""</I>, then the polygon is filled
with a solid color (if the <B>-fill</B> option is set). The default is <I>""</I>. </DD>
</DL>
<H3><A NAME="sect21" HREF="#toc21">Text
Markers</A></H3>
A text marker displays a string of characters on one or more lines
of text. Embedded newlines cause line breaks. They may be used to annotate
regions of the graph. Text markers are created with the <B>create</B> operation
in the form: <BR>
<P>
<CODE><I>pathName <B>marker create text </B></I>?<I>option value</I>?...<BR>
</CODE><P>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option
for the text marker. These same <I>option</I>-<I>value</I> pairs may be used with the
marker's <B>configure</B> operation. <P>
The following options are specific to text
markers:
<DL>
<DT><B>-anchor <I>anchor</I></B> </DT>
<DD><I>Anchor</I> tells how to position the text relative to
the positioning point for the text. For example, if <I>anchor</I> is <I>center</I> then
the text is centered on the point; if <I>anchor</I> is <I>n</I> then the text will be
drawn such that the top center point of the rectangular region occupied
by the text will be at the positioning point. This default is <I>center</I>. </DD>
<DT><B>-background
<I>color</I></B> </DT>
<DD>Same as the <B>-fill</B> option. </DD>
<DT><B>-font <I>fontName</I></B> </DT>
<DD>Specifies the font of the text.
The default is <I>*-Helvetica-Bold-R-Normal-*-120-*</I>. </DD>
<DT><B>-fill <I>color</I></B> </DT>
<DD>Sets the background
color of the text. If <I>color</I> is the empty string, no background will be
transparent. The default background color is <I>""</I>. </DD>
<DT><B>-foreground <I>color</I></B> </DT>
<DD>Same as
the <B>-outline</B> option. </DD>
<DT><B>-justify <I>justify</I></B> </DT>
<DD>Specifies how the text should be justified.
This matters only when the marker contains more than one line of text.
<I>Justify</I> must be <I>left</I>, <I>right</I>, or <I>center</I>. The default is <I>center</I>. </DD>
<DT><B>-outline <I>color</I></B>
</DT>
<DD>Sets the color of the text. The default value is <I>black</I>. </DD>
<DT><B>-padx <I>pad</I></B> </DT>
<DD>Sets the
padding to the left and right exteriors of the text. <I>Pad</I> can be a list of
one or two screen distances. If <I>pad</I> has two elements, the left side of
the text is padded by the first distance and the right side by the second.
If <I>pad</I> has just one distance, both the left and right sides are padded
evenly. The default is <I>4</I>. </DD>
<DT><B>-pady <I>pad</I></B> </DT>
<DD>Sets the padding above and below the
text. <I>Pad</I> can be a list of one or two screen distances. If <I>pad</I> has two
elements, the area above the text is padded by the first distance and the
area below by the second. If <I>pad</I> is just one distance, both the top and
bottom areas are padded evenly. The default is <I>4</I>. </DD>
<DT><B>-rotate <I>theta</I></B> </DT>
<DD>Specifies
the number of degrees to rotate the text. <I>Theta</I> is a real number representing
the angle of rotation. The marker is first rotated along its center and
is then drawn according to its anchor position. The default is <I>0.0</I>. </DD>
<DT><B>-text <I>text</I></B>
</DT>
<DD>Specifies the text of the marker. The exact way the text is displayed may
be affected by other options such as <B>-anchor</B> or <B>-rotate</B>. </DD>
</DL>
<H3><A NAME="sect22" HREF="#toc22">Window Markers</A></H3>
A window
marker displays a widget at a given position. Window markers are created
with the marker's <B>create</B> operation in the form: <BR>
<P>
<CODE><I>pathName <B>marker create window </B></I>?<I>option value</I>?...<BR>
</CODE><P>There may be many <I>option</I>-<I>value</I> pairs, each sets a configuration option for
the marker. These same <I>option</I>-<I>value</I> pairs may be used with the marker's <B>configure</B>
command. <P>
The following options are specific to window markers:
<DL>
<DT><B>-anchor <I>anchor</I></B>
</DT>
<DD><I>Anchor</I> tells how to position the widget relative to the positioning point
for the widget. For example, if <I>anchor</I> is <I>center</I> then the widget is centered
on the point; if <I>anchor</I> is <I>n</I> then the widget will be displayed such that
the top center point of the rectangular region occupied by the widget will
be at the positioning point. This option defaults to <I>center</I>. </DD>
<DT><B>-height <I>pixels</I></B>
</DT>
<DD>Specifies the height to assign to the marker's window. If this option isn't
specified, or if it is specified as <I>""</I>, then the window is given whatever
height the widget requests internally. </DD>
<DT><B>-width <I>pixels</I></B> </DT>
<DD>Specifies the width
to assign to the marker's window. If this option isn't specified, or if it
is specified as <I>""</I>, then the window is given whatever width the widget
requests internally. </DD>
<DT><B>-window <I>pathName</I></B> </DT>
<DD>Specifies the widget to be managed
by the barchart. <I>PathName</I> must be a child of the <B>barchart</B> widget. </DD>
</DL>
<H2><A NAME="sect23" HREF="#toc23">Graph
Component Bindings</A></H2>
Specific barchart components, such as elements, markers
and legend entries, can have a command trigger when event occurs in them,
much like canvas items in Tk's canvas widget. Not all event sequences are
valid. The only binding events that may be specified are those related
to the mouse and keyboard (such as <B>Enter</B>, <B>Leave</B>, <B>ButtonPress</B>, <B>Motion</B>, and
<B>KeyPress</B>). <P>
Only one element or marker can be picked during an event. This
means, that if the mouse is directly over both an element and a marker,
only the uppermost component is selected. This isn't true for legend entries.
Both a legend entry and an element (or marker) binding commands will
be invoked if both items are picked. <P>
It is possible for multiple bindings
to match a particular event. This could occur, for example, if one binding
is associated with the element name and another is associated with one
of the element's tags (see the <B>-bindtags</B> option). When this occurs, all of
the matching bindings are invoked. A binding associated with the element
name is invoked first, followed by one binding for each of the element's
bindtags. If there are multiple matching bindings for a single tag, then
only the most specific binding is invoked. A continue command in a binding
script terminates that script, and a break command terminates that script
and skips any remaining scripts for the event, just as for the bind command.
<P>
The <B>-bindtags</B> option for these components controls addition tag names which
can be matched. Implicitly elements and markers always have tags matching
their names. Setting the value of the <B>-bindtags</B> option doesn't change this.
<H2><A NAME="sect24" HREF="#toc24">C Language API</A></H2>
You can manipulate data elements from the C language. There
may be situations where it is too expensive to translate the data values
from ASCII strings. Or you might want to read data in a special file format.
<P>
Data can manipulated from the C language using BLT vectors. You specify
the X-Y data coordinates of an element as vectors and manipulate the vector
from C. The barchart will be redrawn automatically after the vectors are
updated. <P>
From Tcl, create the vectors and configure the element to use them.
<BR>
<CODE>vector X Y<BR>
.g element configure line1 -xdata X -ydata Y<BR>
</CODE><P>To set data points from C, you pass the values as arrays of doubles using
the <B>Blt_ResetVector</B> call. The vector is reset with the new data and at
the next idle point (when Tk re-enters its event loop), the graph will be
redrawn automatically. <BR>
<CODE>#include <tcl.h><BR>
#include <blt.h><BR>
<P>
register int i;<BR>
Blt_Vector *xVec, *yVec;<BR>
double x[50], y[50];<BR>
<P>
/* Get the BLT vectors "X" and "Y" (created above from Tcl) */<BR>
if ((Blt_GetVector(interp, "X", 50, &xVec) != TCL_OK) ||<BR>
(Blt_GetVector(interp, "Y", 50, &yVec) != TCL_OK)) {<BR>
return TCL_ERROR;<BR>
}<BR>
<P>
for (i = 0; i < 50; i++) {<BR>
x[i] = i * 0.02;<BR>
y[i] = sin(x[i]);<BR>
}<tt> </tt> <tt> </tt> <BR>
<P>
/* Put the data into BLT vectors */<BR>
if ((Blt_ResetVector(xVec, x, 50, 50, TCL_VOLATILE) != TCL_OK) ||<BR>
(Blt_ResetVector(yVec, y, 50, 50, TCL_VOLATILE) != TCL_OK)) {<BR>
return TCL_ERROR;<BR>
}<BR>
</CODE><P>See the <B>vector</B> manual page for more details.
<H2><A NAME="sect25" HREF="#toc25">Speed Tips</A></H2>
There may be cases
where the bar chart needs to be drawn and updated as quickly as possible.
If drawing speed becomes a big problem, here are a few tips to speed up
displays.
<UL>
·<LI>Try to minimize the number of data points. The more data points
looked at, the more work the bar chart must do. </LI>·<LI>If your data is generated
as floating point values, the time required to convert the data values
to and from ASCII strings can be significant, especially when there any
many data points. You can avoid the redundant string-to-decimal conversions
using the C API to BLT vectors. </LI>·<LI>Don't stipple or dash the element. Solid
bars are much faster. </LI>·<LI>If you update data elements frequently, try turning
off the widget's <B>-bufferelements</B> option. When the bar chart is first displayed,
it draws data elements into an internal pixmap. The pixmap acts as a cache,
so that when the bar chart needs to be redrawn again, and the data elements
or coordinate axes haven't changed, the pixmap is simply copied to the screen.
This is especially useful when you are using markers to highlight points
and regions on the bar chart. But if the bar chart is updated frequently,
changing either the element data or coordinate axes, the buffering becomes
redundant. </LI>
</UL>
<H2><A NAME="sect26" HREF="#toc26">Limitations</A></H2>
Auto-scale routines do not use requested min/max limits
as boundaries when the axis is logarithmically scaled. <P>
The PostScript
output generated for polygons with more than 1500 points may exceed the
limits of some printers (See PostScript Language Reference Manual, page
568). The work-around is to break the polygon into separate pieces.
<H2><A NAME="sect27" HREF="#toc27">Keywords</A></H2>
bar
chart, widget <P>
<HR><P>
<A NAME="toc"><B>Table of Contents</B></A><P>
<UL>
<LI><A NAME="toc0" HREF="#sect0">Name</A></LI>
<LI><A NAME="toc1" HREF="#sect1">Synopsis</A></LI>
<LI><A NAME="toc2" HREF="#sect2">Description</A></LI>
<LI><A NAME="toc3" HREF="#sect3">Introduction</A></LI>
<LI><A NAME="toc4" HREF="#sect4">Syntax</A></LI>
<LI><A NAME="toc5" HREF="#sect5">Example</A></LI>
<LI><A NAME="toc6" HREF="#sect6">Syntax</A></LI>
<LI><A NAME="toc7" HREF="#sect7">Barchart Operations</A></LI>
<LI><A NAME="toc8" HREF="#sect8">Barchart Components</A></LI>
<UL>
<LI><A NAME="toc9" HREF="#sect9">Axis Components</A></LI>
<LI><A NAME="toc10" HREF="#sect10">Crosshairs Component</A></LI>
</UL>
<LI><A NAME="toc11" HREF="#sect11">Elements</A></LI>
<UL>
<LI><A NAME="toc12" HREF="#sect12">Grid Component</A></LI>
<LI><A NAME="toc13" HREF="#sect13">Legend Component</A></LI>
<LI><A NAME="toc14" HREF="#sect14">Pen Components</A></LI>
<LI><A NAME="toc15" HREF="#sect15">PostScript Component</A></LI>
<LI><A NAME="toc16" HREF="#sect16">Marker Components</A></LI>
<LI><A NAME="toc17" HREF="#sect17">Bitmap Markers</A></LI>
<LI><A NAME="toc18" HREF="#sect18">Image Markers</A></LI>
<LI><A NAME="toc19" HREF="#sect19">Line Markers</A></LI>
<LI><A NAME="toc20" HREF="#sect20">Polygon Markers</A></LI>
<LI><A NAME="toc21" HREF="#sect21">Text Markers</A></LI>
<LI><A NAME="toc22" HREF="#sect22">Window Markers</A></LI>
</UL>
<LI><A NAME="toc23" HREF="#sect23">Graph Component Bindings</A></LI>
<LI><A NAME="toc24" HREF="#sect24">C Language API</A></LI>
<LI><A NAME="toc25" HREF="#sect25">Speed Tips</A></LI>
<LI><A NAME="toc26" HREF="#sect26">Limitations</A></LI>
<LI><A NAME="toc27" HREF="#sect27">Keywords</A></LI>
</UL>
</BODY></HTML>
|