/usr/share/pyshared/z3c/rml/chart.py is in python-z3c.rml 2.0.0-0ubuntu3.
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 | ##############################################################################
#
# Copyright (c) 2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Chart Element Processing
$Id: chart.py 128763 2012-12-18 21:44:52Z srichter $
"""
__docformat__ = "reStructuredText"
import reportlab.lib.formatters
from reportlab.graphics import shapes
from reportlab.graphics.charts import barcharts, lineplots, piecharts
from reportlab.graphics.charts import spider, doughnut
from z3c.rml import attr, directive, interfaces, occurence
# Patches against Reportlab 2.0
lineplots.Formatter = reportlab.lib.formatters.Formatter
class PropertyItem(directive.RMLDirective):
def process(self):
attrs = dict(self.getAttributeValues())
self.parent.dataList.append(attrs)
class PropertyCollection(directive.RMLDirective):
propertyName = None
def processAttributes(self):
prop = getattr(self.parent.context, self.propertyName)
# Get global properties
for name, value in self.getAttributeValues():
setattr(prop, name, value)
def process(self):
self.processAttributes()
# Get item specific properties
prop = getattr(self.parent.context, self.propertyName)
self.dataList = []
self.processSubDirectives()
for index, data in enumerate(self.dataList):
for name, value in data.items():
setattr(prop[index], name, value)
class IText(interfaces.IRMLDirectiveSignature):
"""Draw a text on the chart."""
x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'text.'),
required=True)
y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'text.'),
required=True)
angle = attr.Float(
title=u'Rotation Angle',
description=(u'The angle about which the text will be rotated.'),
required=False)
text = attr.TextNode(
title=u'Text',
description=u'The text to be printed.',
required=True)
fontName = attr.String(
title=u'Font Name',
description=u'The name of the font.',
required=False)
fontSize = attr.Measurement(
title=u'Font Size',
description=u'The font size for the text.',
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=u'The color in which the text will appear.',
required=False)
textAnchor = attr.Choice(
title=u'Text Anchor',
description=u'The position in the text to which the coordinates refer.',
choices=('start', 'middle', 'end', 'boxauto'),
required=False)
class Text(directive.RMLDirective):
signature = IText
def process(self):
attrs = dict(self.getAttributeValues())
string = shapes.String(
attrs.pop('x'), attrs.pop('y'), attrs.pop('text'))
angle = attrs.pop('angle', 0)
for name, value in attrs.items():
setattr(string, name, value)
group = shapes.Group(string)
group.translate(0,0)
group.rotate(angle)
self.parent.parent.drawing.add(group)
class ITexts(interfaces.IRMLDirectiveSignature):
"""A set of texts drawn on the chart."""
occurence.containing(
occurence.ZeroOrMore('text', IText)
)
class Texts(directive.RMLDirective):
signature = ITexts
factories = {'text': Text}
class Series(directive.RMLDirective):
def process(self):
attrs = self.getAttributeValues(valuesOnly=True)
self.parent.data.append(attrs[0])
class Data(directive.RMLDirective):
series = None
def process(self):
self.data = []
self.factories = {'series': self.series}
self.processSubDirectives()
self.parent.context.data = self.data
class ISeries1D(interfaces.IRMLDirectiveSignature):
"""A one-dimensional series."""
values = attr.TextNodeSequence(
title=u'Values',
description=u"Numerical values representing the series' data.",
value_type=attr.Float(),
required=True)
class Series1D(Series):
signature = ISeries1D
class IData1D(interfaces.IRMLDirectiveSignature):
"""A 1-D data set."""
occurence.containing(
occurence.OneOrMore('series', ISeries1D)
)
class Data1D(Data):
signature = IData1D
series = Series1D
class ISingleData1D(interfaces.IRMLDirectiveSignature):
"""A 1-D data set."""
occurence.containing(
occurence.One('series', ISeries1D)
)
class SingleData1D(Data1D):
signature = ISingleData1D
def process(self):
self.data = []
self.factories = {'series': self.series}
self.processSubDirectives()
self.parent.context.data = self.data[0]
class ISeries2D(interfaces.IRMLDirectiveSignature):
"""A two-dimensional series."""
values = attr.TextNodeGrid(
title=u'Values',
description=u"Numerical values representing the series' data.",
value_type=attr.Float(),
columns=2,
required=True)
class Series2D(Series):
signature = ISeries2D
class IData2D(interfaces.IRMLDirectiveSignature):
"""A 2-D data set."""
occurence.containing(
occurence.OneOrMore('series', ISeries2D)
)
class Data2D(Data):
signature = IData2D
series = Series2D
class IBar(interfaces.IRMLDirectiveSignature):
"""Define the look of a bar."""
strokeColor = attr.Color(
title=u'Stroke Color',
description=u'The color in which the bar border is drawn.',
required=False)
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of the bar border line.',
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=u'The color with which the bar is filled.',
required=False)
class Bar(PropertyItem):
signature = IBar
class IBars(IBar):
"""Collection of bar subscriptions."""
occurence.containing(
occurence.ZeroOrMore('bar', IBar)
)
class Bars(PropertyCollection):
signature = IBars
propertyName = 'bars'
factories = {'bar': Bar}
class ILabelBase(interfaces.IRMLDirectiveSignature):
dx = attr.Measurement(
title=u'Horizontal Extension',
description=(u'The width of the label.'),
required=False)
dy = attr.Measurement(
title=u'Vertical Extension',
description=(u'The height of the label.'),
required=False)
angle = attr.Float(
title=u'Angle',
description=(u'The angle to rotate the label.'),
required=False)
boxAnchor = attr.Choice(
title=u'Box Anchor',
description=(u'The position relative to the label.'),
choices=('nw','n','ne','w','c','e','sw','s','se', 'autox', 'autoy'),
required=False)
boxStrokeColor = attr.Color(
title=u'Box Stroke Color',
description=(u'The color of the box border line.'),
required=False)
boxStrokeWidth = attr.Measurement(
title=u'Box Stroke Width',
description=u'The width of the box border line.',
required=False)
boxFillColor = attr.Color(
title=u'Box Fill Color',
description=(u'The color in which the box is filled.'),
required=False)
boxTarget = attr.Text(
title=u'Box Target',
description=u'The box target.',
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=(u'The color in which the label is filled.'),
required=False)
strokeColor = attr.Color(
title=u'Stroke Color',
description=(u'The color of the label.'),
required=False)
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of the label line.',
required=False)
fontName = attr.String(
title=u'Font Name',
description=u'The font used to print the value.',
required=False)
fontSize = attr.Measurement(
title=u'Font Size',
description=u'The size of the value text.',
required=False)
leading = attr.Measurement(
title=u'Leading',
description=(u'The height of a single text line. It includes '
u'character height.'),
required=False)
width = attr.Measurement(
title=u'Width',
description=u'The width the label.',
required=False)
maxWidth = attr.Measurement(
title=u'Maximum Width',
description=u'The maximum width the label.',
required=False)
height = attr.Measurement(
title=u'Height',
description=u'The height the label.',
required=False)
textAnchor = attr.Choice(
title=u'Text Anchor',
description=u'The position in the text to which the coordinates refer.',
choices=('start', 'middle', 'end', 'boxauto'),
required=False)
visible = attr.Boolean(
title=u'Visible',
description=u'A flag making the label text visible.',
required=False)
leftPadding = attr.Measurement(
title=u'Left Padding',
description=u'The size of the padding on the left side.',
required=False)
rightPadding = attr.Measurement(
title=u'Right Padding',
description=u'The size of the padding on the right side.',
required=False)
topPadding = attr.Measurement(
title=u'Top Padding',
description=u'The size of the padding on the top.',
required=False)
bottomPadding = attr.Measurement(
title=u'Bottom Padding',
description=u'The size of the padding on the bottom.',
required=False)
class IPositionLabelBase(ILabelBase):
x = attr.Measurement(
title=u'X-Coordinate',
description=(u'The X-coordinate of the lower-left position of the '
u'label.'),
required=False)
y = attr.Measurement(
title=u'Y-Coordinate',
description=(u'The Y-coordinate of the lower-left position of the '
u'label.'),
required=False)
class ILabel(IPositionLabelBase):
"""A label for the chart on an axis."""
text = attr.TextNode(
title=u'Text',
description=u'The label text to be displayed.',
required=True)
class Label(PropertyItem):
signature = ILabel
class IBarLabels(ILabelBase):
"""A set of labels for a bar chart"""
occurence.containing(
occurence.ZeroOrMore('label', ILabel)
)
class BarLabels(PropertyCollection):
signature = IBarLabels
propertyName = 'barLabels'
factories = {'label': Label}
name = 'barLabels'
class ILabels(IPositionLabelBase):
"""A set of labels of an axis."""
occurence.containing(
occurence.ZeroOrMore('label', ILabel)
)
class Labels(PropertyCollection):
signature = ILabels
propertyName = 'labels'
factories = {'label': Label}
class IAxis(interfaces.IRMLDirectiveSignature):
occurence.containing(
occurence.ZeroOrMore('labels', ILabels)
)
visible = attr.Boolean(
title=u'Visible',
description=u'When true, draw the entire axis with all details.',
required=False)
visibleAxis = attr.Boolean(
title=u'Visible Axis',
description=u'When true, draw the axis line.',
required=False)
visibleTicks = attr.Boolean(
title=u'Visible Ticks',
description=u'When true, draw the axis ticks on the line.',
required=False)
visibleLabels = attr.Boolean(
title=u'Visible Labels',
description=u'When true, draw the axis labels.',
required=False)
visibleGrid = attr.Boolean(
title=u'Visible Grid',
description=u'When true, draw the grid lines for the axis.',
required=False)
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of axis line and ticks.',
required=False)
strokeColor = attr.Color(
title=u'Stroke Color',
description=u'The color in which the axis line and ticks are drawn.',
required=False)
strokeDashArray = attr.Sequence(
title=u'Stroke Dash Array',
description=u'The dash array that is used for the axis line and ticks.',
value_type=attr.Float(),
required=False)
gridStrokeWidth = attr.Measurement(
title=u'Grid Stroke Width',
description=u'The width of the grid lines.',
required=False)
gridStrokeColor = attr.Color(
title=u'Grid Stroke Color',
description=u'The color in which the grid lines are drawn.',
required=False)
gridStrokeDashArray = attr.Sequence(
title=u'Grid Stroke Dash Array',
description=u'The dash array that is used for the grid lines.',
value_type=attr.Float(),
required=False)
gridStart = attr.Measurement(
title=u'Grid Start',
description=(u'The start of the grid lines with respect to the '
u'axis origin.'),
required=False)
gridEnd = attr.Measurement(
title=u'Grid End',
description=(u'The end of the grid lines with respect to the '
u'axis origin.'),
required=False)
style = attr.Choice(
title=u'Style',
description=u'The plot style of the common categories.',
choices=('parallel', 'stacked', 'parallel_3d'),
required=False)
class Axis(directive.RMLDirective):
signature = IAxis
name = ''
factories = {'labels': Labels}
def process(self):
self.context = axis = getattr(self.parent.context, self.name)
for name, value in self.getAttributeValues():
setattr(axis, name, value)
self.processSubDirectives()
class IName(interfaces.IRMLDirectiveSignature):
"""A category name"""
text = attr.TextNode(
title=u'Text',
description=u'The text value that is the name.',
required=True)
class Name(directive.RMLDirective):
signature = IName
def process(self):
text = self.getAttributeValues(valuesOnly=True)[0]
self.parent.names.append(text)
class ICategoryNames(interfaces.IRMLDirectiveSignature):
"""A list of category names."""
occurence.containing(
occurence.OneOrMore('name', IName),
)
class CategoryNames(directive.RMLDirective):
signature = ICategoryNames
factories = {'name': Name}
def process(self):
self.names = []
self.processSubDirectives()
self.parent.context.categoryNames = self.names
class ICategoryAxis(IAxis):
"""An axis displaying categories (instead of numerical values)."""
occurence.containing(
occurence.ZeroOrOne('categoryNames', ICategoryNames),
*IAxis.queryTaggedValue('directives', ())
)
categoryNames = attr.Sequence(
title=u'Category Names',
description=u'A simple list of category names.',
value_type=attr.Text(),
required=False)
joinAxis = attr.Boolean(
title=u'Join Axis',
description=u'When true, both axes join together.',
required=False)
joinAxisPos = attr.Measurement(
title=u'Join Axis Position',
description=u'The position at which the axes should join together.',
required=False)
reverseDirection = attr.Boolean(
title=u'Reverse Direction',
description=u'A flag to reverse the direction of category names.',
required=False)
labelAxisMode = attr.Choice(
title=u'Label Axis Mode',
description=u'Defines the relative position of the axis labels.',
choices=('high', 'low', 'axis'),
required=False)
tickShift = attr.Boolean(
title=u'Tick Shift',
description=(u'When true, place the ticks in the center of a '
u'category instead the beginning and end.'),
required=False)
class CategoryAxis(Axis):
signature = ICategoryAxis
name = 'categoryAxis'
factories = Axis.factories.copy()
factories.update({
'categoryNames': CategoryNames,
})
class IXCategoryAxis(ICategoryAxis):
"""X-Category Axis"""
tickUp = attr.Measurement(
title=u'Tick Up',
description=u'Length of tick above the axis line.',
required=False)
tickDown = attr.Measurement(
title=u'Tick Down',
description=u'Length of tick below the axis line.',
required=False)
joinAxisMode = attr.Choice(
title=u'Join Axis Mode',
description=u'Mode for connecting axes.',
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
class XCategoryAxis(CategoryAxis):
signature = IXCategoryAxis
class IYCategoryAxis(ICategoryAxis):
"""Y-Category Axis"""
tickLeft = attr.Measurement(
title=u'Tick Left',
description=u'Length of tick left to the axis line.',
required=False)
tickRight = attr.Measurement(
title=u'Tick Right',
description=u'Length of tick right to the axis line.',
required=False)
joinAxisMode = attr.Choice(
title=u'Join Axis Mode',
description=u'Mode for connecting axes.',
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
class YCategoryAxis(CategoryAxis):
signature = IYCategoryAxis
class IValueAxis(IAxis):
forceZero = attr.Boolean(
title=u'Force Zero',
description=u'When set, the range will contain the origin.',
required=False)
minimumTickSpacing = attr.Measurement(
title=u'Minimum Tick Spacing',
description=u'The minimum distance between ticks.',
required=False)
maximumTicks = attr.Integer(
title=u'Maximum Ticks',
description=u'The maximum number of ticks to be shown.',
required=False)
labelTextFormat = attr.String(
title=u'Label Text Format',
description=u'Formatting string for axis labels.',
required=False)
labelTextPostFormat = attr.Text(
title=u'Label Text Post Format',
description=u'An additional formatting string.',
required=False)
labelTextScale = attr.Float(
title=u'Label Text Scale',
description=u'The sclaing factor for the label tick values.',
required=False)
valueMin = attr.Float(
title=u'Minimum Value',
description=u'The smallest value on the axis.',
required=False)
valueMax = attr.Float(
title=u'Maximum Value',
description=u'The largest value on the axis.',
required=False)
valueStep = attr.Float(
title=u'Value Step',
description=u'The step size between ticks',
required=False)
valueSteps = attr.Sequence(
title=u'Step Sizes',
description=u'List of step sizes between ticks.',
value_type = attr.Float(),
required=False)
rangeRound = attr.Choice(
title=u'Range Round',
description=u'Method to be used to round the range values.',
choices=('none', 'both', 'ceiling', 'floor'),
required=False)
zrangePref = attr.Float(
title=u'Zero Range Preference',
description=u'Zero range axis limit preference.',
required=False)
class ValueAxis(Axis):
signature = IValueAxis
name = 'valueAxis'
class IXValueAxis(IValueAxis):
"""X-Value Axis"""
tickUp = attr.Measurement(
title=u'Tick Up',
description=u'Length of tick above the axis line.',
required=False)
tickDown = attr.Measurement(
title=u'Tick Down',
description=u'Length of tick below the axis line.',
required=False)
joinAxis = attr.Boolean(
title=u'Join Axis',
description=u'Whether to join the axes.',
required=False)
joinAxisMode = attr.Choice(
title=u'Join Axis Mode',
description=u'Mode for connecting axes.',
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
joinAxisPos = attr.Measurement(
title=u'Join Axis Position',
description=u'The position in the plot at which to join the axes.',
required=False)
class XValueAxis(ValueAxis):
signature = IXValueAxis
class LineXValueAxis(XValueAxis):
name = 'xValueAxis'
class IYValueAxis(IValueAxis):
"""Y-Value Axis"""
tickLeft = attr.Measurement(
title=u'Tick Left',
description=u'Length of tick left to the axis line.',
required=False)
tickRight = attr.Measurement(
title=u'Tick Right',
description=u'Length of tick right to the axis line.',
required=False)
joinAxis = attr.Boolean(
title=u'Join Axis',
description=u'Whether to join the axes.',
required=False)
joinAxisMode = attr.Choice(
title=u'Join Axis Mode',
description=u'Mode for connecting axes.',
choices=('bottom', 'top', 'value', 'points', 'None'),
required=False)
joinAxisPos = attr.Measurement(
title=u'Join Axis Position',
description=u'The position in the plot at which to join the axes.',
required=False)
class YValueAxis(ValueAxis):
signature = IYValueAxis
class LineYValueAxis(YValueAxis):
name = 'yValueAxis'
class ILineLabels(IPositionLabelBase):
"""A set of labels of an axis."""
occurence.containing(
occurence.ZeroOrMore('label', ILabel)
)
class LineLabels(PropertyCollection):
signature = ILineLabels
propertyName = 'lineLabels'
factories = {'label': Label}
class ILineBase(interfaces.IRMLDirectiveSignature):
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The width of the plot line.',
required=False)
strokeColor = attr.Color(
title=u'Stroke Color',
description=u'The color of the plot line.',
required=False)
strokeDashArray = attr.Sequence(
title=u'Stroke Dash Array',
description=u'The dash array of the plot line.',
value_type = attr.Float(),
required=False)
symbol = attr.Symbol(
title=u'Symbol',
description=u'The symbol to be used for every data point in the plot.',
required=False)
class ILine(ILineBase):
"""A line description of a series of a line plot."""
name = attr.Text(
title=u'Name',
description=u'The name of the line.',
required=False)
class Line(PropertyItem):
signature = ILine
class ILines(ILineBase):
"""The set of all line descriptions in the line plot."""
occurence.containing(
occurence.OneOrMore('line', ILine),
)
class Lines(PropertyCollection):
signature = ILines
propertyName = 'lines'
factories = {'line': Line}
class ISliceLabel(ILabelBase):
"""The label of a slice within a bar chart."""
text = attr.TextNode(
title=u'Text',
description=u'The label text to be displayed.',
required=True)
class SliceLabel(Label):
signature = ISliceLabel
def process(self):
for name, value in self.getAttributeValues():
self.parent.context['label_'+name] = value
# Now we do not have simple labels anymore
self.parent.parent.parent.context.simpleLabels = False
class ISlicePointer(interfaces.IRMLDirectiveSignature):
"""A pointer to a slice in a pie chart."""
strokeColor = attr.Color(
title=u'Stroke Color',
description=u'The color of the pointer line.',
required=False)
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The wodth of the pointer line.',
required=False)
elbowLength = attr.Measurement(
title=u'Elbow Length',
description=u'The length of the final segment of the pointer.',
required=False)
edgePad = attr.Measurement(
title=u'Edge Padding',
description=u'The padding between between the pointer label and box.',
required=False)
piePad = attr.Measurement(
title=u'Pie Padding',
description=u'The padding between between the pointer label and chart.',
required=False)
class SlicePointer(directive.RMLDirective):
signature = ISlicePointer
def process(self):
for name, value in self.getAttributeValues():
self.parent.context['label_pointer_'+name] = value
class ISliceBase(interfaces.IRMLDirectiveSignature):
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The wodth of the slice line.',
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=u'The fill color of the slice.',
required=False)
strokeColor = attr.Color(
title=u'Stroke Color',
description=u'The color of the pointer line.',
required=False)
strokeDashArray = attr.Sequence(
title=u'Stroke Dash Array',
description=u'Teh dash array of the slice borderline.',
value_type=attr.Float(),
required=False)
popout = attr.Measurement(
title=u'Popout',
description=u'The distance of how much the slice should be popped out.',
required=False)
fontName = attr.String(
title=u'Font Name',
description=u'The font name of the label.',
required=False)
fontSize = attr.Measurement(
title=u'Font Size',
description=u'The font size of the label.',
required=False)
labelRadius = attr.Measurement(
title=u'Label Radius',
description=(u'The radius at which the label should be placed around '
u'the pie.'),
required=False)
class ISlice(ISliceBase):
"""A slice in a pie chart."""
occurence.containing(
occurence.ZeroOrOne('label', ISliceLabel),
occurence.ZeroOrOne('pointer', ISlicePointer),
)
swatchMarker = attr.Symbol(
required=False)
class Slice(directive.RMLDirective):
signature = ISlice
factories = {
'label': SliceLabel,
'pointer': SlicePointer}
def process(self):
self.context = attrs = dict(self.getAttributeValues())
self.processSubDirectives()
self.parent.context.append(attrs)
class ISlice3D(ISlice):
"""A 3-D slice of a 3-D pie chart."""
fillColorShaded = attr.Color(
title=u'Fill Color Shade',
description=u'The shade used for the fill color.',
required=False)
class Slice3D(Slice):
signature = ISlice3D
factories = {}
# Sigh, the 3-D Pie does not support advanced slice labels. :-(
# 'label': SliceLabel}
class ISlices(ISliceBase):
"""The collection of all 2-D slice descriptions."""
occurence.containing(
occurence.OneOrMore('slice', ISlice),
)
class Slices(directive.RMLDirective):
signature = ISlices
factories = {'slice': Slice}
def process(self):
# Get global slice properties
for name, value in self.getAttributeValues():
setattr(self.parent.context.slices, name, value)
# Get slice specific properties
self.context = slicesData = []
self.processSubDirectives()
for index, sliceData in enumerate(slicesData):
for name, value in sliceData.items():
setattr(self.parent.context.slices[index], name, value)
class ISlices3D(ISliceBase):
"""The collection of all 3-D slice descriptions."""
occurence.containing(
occurence.OneOrMore('slice', ISlice3D),
)
fillColorShaded = attr.Color(
required=False)
class Slices3D(Slices):
signature = ISlices3D
factories = {'slice': Slice3D}
class ISimpleLabel(IName):
"""A simple label"""
class SimpleLabel(Name):
signature = ISimpleLabel
class ISimpleLabels(interfaces.IRMLDirectiveSignature):
"""A set of simple labels for a chart."""
occurence.containing(
occurence.OneOrMore('label', ISimpleLabel),
)
class SimpleLabels(directive.RMLDirective):
signature = ISimpleLabels
factories = {'label': Name}
def process(self):
self.names = []
self.processSubDirectives()
self.parent.context.labels = self.names
class IStrandBase(interfaces.IRMLDirectiveSignature):
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'The line width of the strand.',
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=u'The fill color of the strand area.',
required=False)
strokeColor= attr.Color(
title=u'Stroke Color',
description=u'The color of the strand line.',
required=False)
strokeDashArray = attr.Sequence(
title=u'Stroke Dash Array',
description=u'The dash array of the strand line.',
value_type=attr.Float(),
required=False)
symbol = attr.Symbol(
title=u'Symbol',
description=u'The symbol to use to mark the strand.',
required=False)
symbolSize = attr.Measurement(
title=u'Symbol Size',
description=u'The size of the strand symbol.',
required=False)
class IStrand(IStrandBase):
"""A strand in the spider diagram"""
name = attr.Text(
title=u'Name',
description=u'The name of the strand.',
required=False)
class Strand(PropertyItem):
signature = IStrand
class IStrands(IStrand):
"""A collection of strands."""
occurence.containing(
occurence.OneOrMore('strand', IStrand)
)
class Strands(PropertyCollection):
signature = IStrands
propertyName = 'strands'
attrs = IStrandBase
factories = {'strand': Strand}
class IStrandLabelBase(ILabelBase):
_text = attr.TextNode(
title=u'Text',
description=u'The label text of the strand.',
required=False)
row = attr.Integer(
title=u'Row',
description=u'The row of the strand label',
required=False)
col = attr.Integer(
title=u'Column',
description=u'The column of the strand label.',
required=False)
format = attr.String(
title=u'Format',
description=u'The format string for the label.',
required=False)
class IStrandLabel(IStrandLabelBase):
"""A label for a strand."""
dR = attr.Float(
title=u'Radial Shift',
description=u'The radial shift of the label.',
required=False)
class StrandLabel(Label):
signature = IStrandLabel
class IStrandLabels(IStrandLabelBase):
"""A set of strand labels."""
occurence.containing(
occurence.OneOrMore('label', IStrandLabel)
)
class StrandLabels(PropertyCollection):
signature = IStrandLabels
propertyName = 'strandLabels'
factories = {'label': StrandLabel}
def process(self):
self.processAttributes()
# Get item specific properties
prop = getattr(self.parent.context, self.propertyName)
self.dataList = []
self.processSubDirectives()
for data in self.dataList:
row = data.pop('row')
col = data.pop('col')
for name, value in data.items():
setattr(prop[row, col], name, value)
class ISpoke(interfaces.IRMLDirectiveSignature):
"""A spoke in the spider diagram."""
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u"The width of the spoke's line.",
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=u"The fill color of the spoke's area.",
required=False)
strokeColor= attr.Color(
title=u'Stroke Color',
description=u'The color of the spoke line.',
required=False)
strokeDashArray = attr.Sequence(
title=u'Stroke Dash Array',
description=u'The dash array of the spoke line.',
value_type=attr.Float(),
required=False)
labelRadius = attr.Measurement(
title=u'Label Radius',
description=u'The radius of the label arouns the spoke.',
required=False)
visible = attr.Boolean(
title=u'Visible',
description=u'When true, the spoke line is drawn.',
required=False)
class Spoke(PropertyItem):
signature = ISpoke
class ISpokes(ISpoke):
"""A collection of spokes."""
occurence.containing(
occurence.OneOrMore('spoke', ISpoke)
)
class Spokes(PropertyCollection):
signature = ISpokes
propertyName = 'spokes'
factories = {'spoke': Spoke}
class ISpokeLabelBase(ILabelBase):
pass
class ISpokeLabel(ISpokeLabelBase):
"""A label for a spoke."""
_text = attr.TextNode(
title=u'Text',
description=u'The text of the spoke (label).',
required=False)
class SpokeLabel(Label):
signature = ISpokeLabel
class ISpokeLabels(ISpokeLabelBase):
"""A set of spoke labels."""
occurence.containing(
occurence.OneOrMore('label', ISpokeLabel)
)
class SpokeLabels(PropertyCollection):
signature = ISpokeLabels
propertyName = 'spokeLabels'
factories = {'label': SpokeLabel}
class IChart(interfaces.IRMLDirectiveSignature):
occurence.containing(
occurence.ZeroOrOne('texts', ITexts),
)
# Drawing Options
dx = attr.Measurement(
title=u'Drawing X-Position',
description=u'The x-position of the entire drawing on the canvas.',
required=False)
dy = attr.Measurement(
title=u'Drawing Y-Position',
description=u'The y-position of the entire drawing on the canvas.',
required=False)
dwidth = attr.Measurement(
title=u'Drawing Width',
description=u'The width of the entire drawing',
required=False)
dheight = attr.Measurement(
title=u'Drawing Height',
description=u'The height of the entire drawing',
required=False)
angle = attr.Float(
title=u'Angle',
description=u'The orientation of the drawing as an angle in degrees.',
required=False)
# Plot Area Options
x = attr.Measurement(
title=u'Chart X-Position',
description=u'The x-position of the chart within the drawing.',
required=False)
y = attr.Measurement(
title=u'Chart Y-Position',
description=u'The y-position of the chart within the drawing.',
required=False)
width = attr.Measurement(
title=u'Chart Width',
description=u'The width of the chart.',
required=False)
height = attr.Measurement(
title=u'Chart Height',
description=u'The height of the chart.',
required=False)
strokeColor = attr.Color(
title=u'Stroke Color',
description=u'Color of the chart border.',
required=False)
strokeWidth = attr.Measurement(
title=u'Stroke Width',
description=u'Width of the chart border.',
required=False)
fillColor = attr.Color(
title=u'Fill Color',
description=u'Color of the chart interior.',
required=False)
debug = attr.Boolean(
title=u'Debugging',
description=u'A flag that when set to True turns on debug messages.',
required=False)
class Chart(directive.RMLDirective):
signature = IChart
factories = {
'texts': Texts
}
attrMapping = {}
def createChart(self, attributes):
raise NotImplementedError
def process(self):
attrs = dict(self.getAttributeValues(attrMapping=self.attrMapping))
angle = attrs.pop('angle', 0)
x, y = attrs.pop('dx'), attrs.pop('dy')
self.drawing = shapes.Drawing(attrs.pop('dwidth'), attrs.pop('dheight'))
self.context = chart = self.createChart(attrs)
self.processSubDirectives()
group = shapes.Group(chart)
group.translate(0,0)
group.rotate(angle)
self.drawing.add(group)
manager = attr.getManager(self, interfaces.ICanvasManager)
self.drawing.drawOn(manager.canvas, x, y)
class IBarChart(IChart):
"""Creates a two-dimensional bar chart."""
occurence.containing(
occurence.One('data', IData1D),
occurence.ZeroOrOne('bars', IBars),
occurence.ZeroOrOne('categoryAxis', ICategoryAxis),
occurence.ZeroOrOne('valueAxis', IValueAxis),
occurence.ZeroOrOne('barLabels', IBarLabels),
*IChart.queryTaggedValue('directives', ())
)
direction = attr.Choice(
title=u'Direction',
description=u'The direction of the bars within the chart.',
choices=('horizontal', 'vertical'),
default='horizontal',
required=False)
useAbsolute = attr.Boolean(
title=u'Use Absolute Spacing',
description=u'Flag to use absolute spacing values.',
default=False,
required=False)
barWidth = attr.Measurement(
title=u'Bar Width',
description=u'The width of an individual bar.',
default=10,
required=False)
groupSpacing = attr.Measurement(
title=u'Group Spacing',
description=u'Width between groups of bars.',
default=5,
required=False)
barSpacing = attr.Measurement(
title=u'Bar Spacing',
description=u'Width between individual bars.',
default=0,
required=False)
barLabelFormat = attr.String(
title=u'Bar Label Text Format',
description=u'Formatting string for bar labels.',
required=False)
class BarChart(Chart):
signature = IBarChart
nameBase = 'BarChart'
factories = Chart.factories.copy()
factories.update({
'data': Data1D,
'bars': Bars,
'barLabels': BarLabels,
})
def createChart(self, attrs):
direction = attrs.pop('direction')
# Setup sub-elements based on direction
if direction == 'horizontal':
self.factories['categoryAxis'] = YCategoryAxis
self.factories['valueAxis'] = XValueAxis
else:
self.factories['categoryAxis'] = XCategoryAxis
self.factories['valueAxis'] = YValueAxis
# Generate the chart
chart = getattr(
barcharts, direction.capitalize()+self.nameBase)()
for name, value in attrs.items():
setattr(chart, name, value)
return chart
class IBarChart3D(IBarChart):
"""Creates a three-dimensional bar chart."""
occurence.containing(
*IBarChart.queryTaggedValue('directives', ())
)
thetaX = attr.Float(
title=u'Theta-X',
description=u'Fraction of dx/dz.',
required=False)
thetaY = attr.Float(
title=u'Theta-Y',
description=u'Fraction of dy/dz.',
required=False)
zDepth = attr.Measurement(
title=u'Z-Depth',
description=u'Depth of an individual series/bar.',
required=False)
zSpace = attr.Measurement(
title=u'Z-Space',
description=u'Z-Gap around a series/bar.',
required=False)
class BarChart3D(BarChart):
signature = IBarChart3D
nameBase = 'BarChart3D'
attrMapping = {'thetaX': 'theta_x', 'thetaY': 'theta_y'}
class ILinePlot(IChart):
"""A line plot."""
occurence.containing(
occurence.One('data', IData2D),
occurence.ZeroOrOne('lines', ILines),
occurence.ZeroOrOne('xValueAxis', IXValueAxis),
occurence.ZeroOrOne('yValueAxis', IYValueAxis),
occurence.ZeroOrOne('lineLabels', ILineLabels),
*IChart.queryTaggedValue('directives', ())
)
reversePlotOrder = attr.Boolean(
title=u'Reverse Plot Order',
description=u'When true, the coordinate system is reversed.',
required=False)
lineLabelNudge = attr.Measurement(
title=u'Line Label Nudge',
description=u'The distance between the data point and its label.',
required=False)
lineLabelFormat = attr.String(
title=u'Line Label Format',
description=u'Formatting string for data point labels.',
required=False)
joinedLines = attr.Boolean(
title=u'Joined Lines',
description=u'When true, connect all data points with lines.',
required=False)
class LinePlot(Chart):
signature = ILinePlot
factories = Chart.factories.copy()
factories.update({
'data': Data2D,
'lines': Lines,
'xValueAxis': LineXValueAxis,
'yValueAxis': LineYValueAxis,
'lineLabels': LineLabels,
})
def createChart(self, attrs):
# Generate the chart
chart = lineplots.LinePlot()
for name, value in attrs.items():
setattr(chart, name, value)
return chart
class ILinePlot3D(ILinePlot):
"""Creates a three-dimensional line plot."""
occurence.containing(
*ILinePlot.queryTaggedValue('directives', ())
)
thetaX = attr.Float(
title=u'Theta-X',
description=u'Fraction of dx/dz.',
required=False)
thetaY = attr.Float(
title=u'Theta-Y',
description=u'Fraction of dy/dz.',
required=False)
zDepth = attr.Measurement(
title=u'Z-Depth',
description=u'Depth of an individual series/bar.',
required=False)
zSpace = attr.Measurement(
title=u'Z-Space',
description=u'Z-Gap around a series/bar.',
required=False)
class LinePlot3D(LinePlot):
signature = ILinePlot3D
nameBase = 'LinePlot3D'
attrMapping = {'thetaX': 'theta_x', 'thetaY': 'theta_y'}
def createChart(self, attrs):
# Generate the chart
chart = lineplots.LinePlot3D()
for name, value in attrs.items():
setattr(chart,name, value)
return chart
class IPieChart(IChart):
"""A pie chart."""
occurence.containing(
occurence.One('data', ISingleData1D),
occurence.ZeroOrOne('slices', ISlices),
occurence.ZeroOrOne('labels', ISimpleLabels),
*IChart.queryTaggedValue('directives', ())
)
startAngle = attr.Integer(
title=u'Start Angle',
description=u'The start angle in the chart of the first slice '
u'in degrees.',
required=False)
direction = attr.Choice(
title=u'Direction',
description=u'The direction in which the pie chart will be built.',
choices=('clockwise', 'anticlockwise'),
required=False)
checkLabelOverlap = attr.Boolean(
title=u'Check Label Overlap',
description=(u'When true, check and attempt to fix standard '
u'label overlaps'),
required=False)
pointerLabelMode = attr.Choice(
title=u'Pointer Label Mode',
description=(u'The location relative to the slace the label should '
u'be placed.'),
choices={'none': None,
'leftright': 'LeftRight',
'leftandright': 'LeftAndRight'},
required=False)
sameRadii = attr.Boolean(
title=u'Same Radii',
description=u'When true, make x/y radii the same.',
required=False)
orderMode = attr.Choice(
title=u'Order Mode',
description=u'',
choices=('fixed', 'alternate'),
required=False)
xradius = attr.Measurement(
title=u'X-Radius',
description=u'The radius of the X-directions',
required=False)
yradius = attr.Measurement(
title=u'Y-Radius',
description=u'The radius of the Y-directions',
required=False)
class PieChart(Chart):
signature = IPieChart
chartClass = piecharts.Pie
factories = Chart.factories.copy()
factories.update({
'data': SingleData1D,
'slices': Slices,
'labels': SimpleLabels,
})
def createChart(self, attrs):
# Generate the chart
chart = self.chartClass()
for name, value in attrs.items():
setattr(chart, name, value)
return chart
class IPieChart3D(IPieChart):
"""A 3-D pie chart."""
occurence.containing(
occurence.One('slices', ISlices3D),
*IChart.queryTaggedValue('directives', ())
)
perspective = attr.Float(
title=u'Perspsective',
description=u'The flattening parameter.',
required=False)
depth_3d = attr.Measurement(
title=u'3-D Depth',
description=u'The depth of the pie.',
required=False)
angle_3d = attr.Float(
title=u'3-D Angle',
description=u'The view angle in the Z-coordinate.',
required=False)
class PieChart3D(PieChart):
signature = IPieChart3D
chartClass = piecharts.Pie3d
factories = PieChart.factories.copy()
factories.update({
'slices': Slices3D,
})
class ISpiderChart(IChart):
"""A spider chart."""
occurence.containing(
occurence.One('data', IData1D),
occurence.ZeroOrOne('strands', IStrands),
occurence.ZeroOrOne('strandLabels', IStrandLabels),
occurence.ZeroOrOne('spokes', ISpokes),
occurence.ZeroOrOne('spokeLabels', ISpokeLabels),
occurence.ZeroOrOne('labels', ISimpleLabels),
*IChart.queryTaggedValue('directives', ())
)
startAngle = attr.Integer(
title=u'Start Angle',
description=u'The start angle in the chart of the first strand '
u'in degrees.',
required=False)
direction = attr.Choice(
title=u'Direction',
description=u'The direction in which the spider chart will be built.',
choices=('clockwise', 'anticlockwise'),
required=False)
class SpiderChart(Chart):
signature = ISpiderChart
factories = Chart.factories.copy()
factories.update({
'data': Data1D,
'strands': Strands,
'strandLabels': StrandLabels,
'spokes': Spokes,
'spokeLabels': SpokeLabels,
'labels': SimpleLabels,
})
def createChart(self, attrs):
# Generate the chart
chart = spider.SpiderChart()
for name, value in attrs.items():
setattr(chart, name, value)
return chart
|