Package muntjac :: Package addon :: Package invient :: Module invient_charts_config
[hide private]
[frames] | no frames]

Source Code for Module muntjac.addon.invient.invient_charts_config

   1  # @INVIENT_COPYRIGHT@ 
   2  #  
   3  # Licensed under the Apache License, Version 2.0 (the "License");  
   4  # you may not use this file except in compliance with the License.  
   5  # You may obtain a copy of the License at  
   6  #  
   7  #     http://www.apache.org/licenses/LICENSE-2.0  
   8  #  
   9  # Unless required by applicable law or agreed to in writing, software  
  10  # distributed under the License is distributed on an "AS IS" BASIS,  
  11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
  12  # See the License for the specific language governing permissions and  
  13  # limitations under the License. 
  14   
  15  try: 
  16      from collections import OrderedDict 
  17  except ImportError: 
  18      from ordereddict import OrderedDict 
  19   
  20  from muntjac.addon.invient.paint \ 
  21      import IPaint 
  22   
  23  from muntjac.util \ 
  24      import OrderedSet 
25 26 27 -class InvientChartsConfig(object):
28 """This class encapsulates a number of configuration options for the 29 InvientChars. These configuration options are L{Title}, L{SubTitle} 30 , L{GeneralChartConfig}, L{Credit}, L{Legend}, L{Tooltip} 31 , L{ChartLabel}, L{SeriesConfig}, L{XAxis} and L{YAxis} 32 33 All configuration properties which are of object type are initialized 34 with an object instance. 35 36 These configuration options are static and generally set once. After a 37 chart (L{InvientCharts}) created, any changes made to the configuration 38 options will not reflect in the chart. You would have to create a new 39 chart L{InvientCharts} 40 41 For some APIs, the description has been taken from 42 U{http://www.highcharts.com/ref/} 43 44 @author: Invient 45 @author: Richard Lincoln 46 """ 47
48 - def __init__(self):
49 self._title = Title() 50 self._subtitle = SubTitle() 51 self._generalChartConfig = GeneralChartConfig() 52 self._credit = Credit() 53 self._legend = Legend() 54 self._tooltip = Tooltip() 55 self._chartLabel = ChartLabel() 56 self._seriesTypeConfig = OrderedDict() 57 self._xAxes = OrderedSet() 58 self._yAxes = OrderedSet() 59 self._invientCharts = None
60 61
62 - def getInvientCharts(self):
63 return self._invientCharts
64 65
66 - def setInvientCharts(self, invientCharts):
67 self._invientCharts = invientCharts
68 69
70 - def getChartLabel(self):
71 """@return: The L{ChartLabel} object representing labels at arbitrary 72 position in the chart. 73 """ 74 return self._chartLabel
75 76
77 - def setChartLabel(self, chartLabel):
78 """Sets the argument L{ChartLabel} object only if it is non-null 79 80 @param chartLabel: 81 """ 82 if chartLabel is not None: 83 self._chartLabel = chartLabel
84 85
86 - def getXAxes(self):
87 """@return: Returns a collection of x-axis.""" 88 return self._xAxes
89 90
91 - def setXAxes(self, xAxes):
92 """Sets a collection of x-axis for the chart. The collection of x-axis 93 is set only if argument xAxes is non-null. 94 95 @param xAxes: 96 """ 97 if xAxes is not None: 98 self._xAxes = xAxes
99 100
101 - def addXAxes(self, xAxis):
102 """Adds specified x-axis to the collection of x-axis. 103 104 @param xAxis: 105 @return: Returns true if the x-axis is added successfully otherwise 106 false 107 """ 108 return self._xAxes.add(xAxis)
109 110
111 - def getYAxes(self):
112 """@return: Returns a collection of y-axis.""" 113 return self._yAxes
114 115
116 - def setYAxes(self, yAxes):
117 """Sets a collection of y-axis for the chart. The collection of y-axis 118 is set only if argument yAxes is non-null 119 120 @param yAxes: 121 """ 122 if yAxes is not None: 123 self._yAxes = yAxes
124 125
126 - def addYAxes(self, yAxis):
127 """Adds specified y-axis to the collection of y-axis. 128 129 @param yAxis: 130 @return: Returns true if the y-axis is added successfully otherwise 131 false 132 """ 133 return self._yAxes.add(yAxis)
134 135
136 - def getTitle(self):
137 """@return: Returns L{Title} object""" 138 return self._title
139 140
141 - def setTitle(self, title):
142 """Sets the argument title only if the argument title is non-null 143 144 @param title: 145 """ 146 if title is not None: 147 self._title = title
148 149
150 - def getSubtitle(self):
151 """@return: Returns subtitle""" 152 return self._subtitle
153 154
155 - def setSubtitle(self, subtitle):
156 """Sets the argument subtitle only if the argument is non-null 157 158 @param subtitle: 159 """ 160 if subtitle is not None: 161 self._subtitle = subtitle
162 163
164 - def getTooltip(self):
165 """@return: Returns tooltip object associated with this class""" 166 return self._tooltip
167 168
169 - def setTooltip(self, tooltip):
170 """Sets L{Tooltip} object only if the argument tooltip is non-null 171 172 @param tooltip: 173 """ 174 if tooltip is not None: 175 self._tooltip = tooltip
176 177
178 - def getLegend(self):
179 """@return: Returns legend object of the chart""" 180 return self._legend
181 182
183 - def setLegend(self, legend):
184 """Sets L{Legend} object only if the argument legend is non-null 185 186 @param legend: 187 """ 188 if legend is not None: 189 self._legend = legend
190 191
192 - def getCredit(self):
193 """@return: Returns credit object of the chart""" 194 return self._credit
195 196
197 - def setCredit(self, credit):
198 """Sets the L{Credit} object only if the argument credit is non-null 199 200 @param credit: 201 """ 202 if credit is not None: 203 self._credit = credit
204 205
206 - def getGeneralChartConfig(self):
207 """@return: Returns L{GeneralChartConfig} object""" 208 return self._generalChartConfig
209 210
211 - def setGeneralChartConfig(self, generalChartConfig):
212 """Sets L{GeneralChartConfig} object only if the argument is non-null 213 214 @param generalChartConfig: 215 """ 216 if generalChartConfig is not None: 217 self._generalChartConfig = generalChartConfig
218 219
220 - def getSeriesConfig(self):
221 return self._seriesTypeConfig
222 223
224 - def setSeriesConfig(self, seriesConfigs):
225 """Sets a set of {@link SeriesConfig} objects only if the argument is 226 non-null. 227 228 @param seriesConfigs: 229 """ 230 if self._seriesTypeConfig is not None: 231 self._seriesTypeConfig.clear() 232 for config in seriesConfigs: 233 self.addSeriesConfig(config)
234 235
236 - def addSeriesConfig(self, seriesConfig):
237 """Adds the specified argument only if it is non-null. 238 239 @param seriesConfig: 240 @raise ValueError: 241 if the argument is null 242 """ 243 if seriesConfig is None: 244 raise ValueError, 'Argument SeriesConfig cannot be null.' 245 self._seriesTypeConfig[self.getSeriesType(seriesConfig)] = seriesConfig
246 247 248 @classmethod
249 - def getSeriesType(cls, seriesConfig):
250 """@param seriesConfig: 251 @return: 252 """ 253 from muntjac.addon.invient.invient_charts import SeriesType 254 255 seriesType = SeriesType.COMMONSERIES 256 if LineConfig == seriesConfig.__class__: 257 seriesType = SeriesType.LINE 258 elif SplineConfig == seriesConfig.__class__: 259 seriesType = SeriesType.SPLINE 260 elif ScatterConfig == seriesConfig.__class__: 261 seriesType = SeriesType.SCATTER 262 elif AreaConfig == seriesConfig.__class__: 263 seriesType = SeriesType.AREA 264 elif AreaSplineConfig == seriesConfig.__class__: 265 seriesType = SeriesType.AREASPLINE 266 elif BarConfig == seriesConfig.__class__: 267 seriesType = SeriesType.BAR 268 elif ColumnConfig == seriesConfig.__class__: 269 seriesType = SeriesType.COLUMN 270 elif PieConfig == seriesConfig.__class__: 271 seriesType = SeriesType.PIE 272 return seriesType
273
274 275 -class ChartLabel(object):
276 """The L{ChartLabel} class represents a set of labels which an be 277 placed at arbitrary position in the chart. 278 279 @author: Invient 280 @author: Richard Lincoln 281 """ 282
283 - def __init__(self):
284 self._style = None 285 self._labels = list()
286 287
288 - def getStyle(self):
289 """@return: Returns css style.""" 290 return self._style
291 292
293 - def setStyle(self, style):
294 """Sets css style for all labels in this class 295 296 @param style: 297 css style string 298 """ 299 self._style = style
300 301
302 - def getLabels(self):
303 """@return: Returns a list of L{ChartLabelItem} objects""" 304 return self._labels
305 306
307 - def setLabels(self, labels):
308 """Sets a list of L{ChartLabelItem} objects 309 310 @param labels: 311 """ 312 if labels is not None: 313 self._labels = labels
314 315
316 - def addLabel(self, label):
317 """Appends the specified element at the end of L{ChartLabelItem} 318 list. 319 320 @param label: 321 element to be appended 322 """ 323 self._labels.append(label)
324 325
326 - def removeLabel(self, label):
327 """Removes the specified element from the list of L{ChartLabelItem} 328 329 @param label: 330 """ 331 self._labels.remove(label)
332
333 334 -class ChartLabelItem(object):
335 """This class represents a label placed at arbitrary location in the 336 chart. The label can have html text and it can be styled using 337 css-style. 338 339 @author: Invient 340 @author: Richard Lincoln 341 """ 342
343 - def __init__(self, html, style):
344 """Creates a new instance with specified html and style arguments. 345 346 @param html: 347 @param style: 348 """ 349 super(ChartLabelItem, self).__init__() 350 self._html = html 351 self._style = style
352 353
354 - def getHtml(self):
355 """@return Returns html of this label""" 356 return self._html
357 358
359 - def setHtml(self, html):
360 """Sets html for this label 361 362 @param html: 363 It can be plain or html string. 364 """ 365 self._html = html
366 367
368 - def getStyle(self):
369 """@return: Returns css-style of this label""" 370 return self._style
371 372
373 - def setStyle(self, style):
374 """Sets css style for this label 375 376 @param style: 377 """ 378 self._style = style
379
380 381 -class GeneralChartConfig(object):
382 """This class contains configuration properties at a chart level. 383 384 @author: Invient 385 @author: Richard Lincoln 386 """ 387
388 - def __init__(self):
389 from muntjac.addon.invient.invient_charts import SeriesType 390 391 self._backgroundColor = None 392 self._borderColor = None 393 self._borderRadius = None 394 self._borderWidth = None 395 self._height = None 396 self._width = None 397 self._ignoreHiddenSeries = None 398 self._inverted = None 399 self._margin = None 400 self._spacing = None 401 self._showAxes = None 402 self._type = SeriesType.LINE 403 self._zoomType = ZoomType.NONE 404 self._clientZoom = True 405 self._alignTicks = None 406 self._animation = None 407 self._className = None 408 self._reflow = None 409 self._shadow = None 410 self._plot = None 411 self._style = None
412 413
414 - def getAlignTicks(self):
415 """@return: align ticks""" 416 return self._alignTicks
417 418
419 - def setAlignTicks(self, alignTicks):
420 """When using multiple axis, the ticks of two or more opposite axes 421 will automatically be aligned by adding ticks to the axis or axes with 422 the least ticks. This can be prevented by setting alignTicks to false. 423 424 @param alignTicks: 425 """ 426 self._alignTicks = alignTicks
427 428
429 - def getAnimation(self):
430 """@return: animation""" 431 return self._animation
432 433
434 - def setAnimation(self, animation):
435 """Set the overall animation for all chart updating. 436 437 @param animation: 438 """ 439 self._animation = animation
440 441
442 - def getClassName(self):
443 """@return""" 444 return self._className
445 446
447 - def setClassName(self, className):
448 """A CSS class name to apply to the charts container 449 450 @param className: 451 """ 452 self._className = className
453
454 - def getPlot(self):
455 """@return: Returns plot object representing chart's drawing area""" 456 return self._plot
457 458
459 - def setPlot(self, plot):
460 """Sets plot object 461 462 @param plot: 463 """ 464 self._plot = plot
465 466
467 - def getReflow(self):
468 """@return:""" 469 return self._reflow
470 471
472 - def setReflow(self, reflow):
473 """A value of true indicates that the chart will fit the width of the 474 charts container otherwise not. 475 476 @param reflow: 477 """ 478 self._reflow = reflow
479 480
481 - def getShadow(self):
482 """@return:""" 483 return self._shadow
484 485
486 - def setShadow(self, shadow):
487 """A value of true indicates that the drop shadow will apply to the 488 outer chart area otherwise not. 489 490 @param shadow: 491 """ 492 self._shadow = shadow
493 494
495 - def getStyle(self):
496 """@return:""" 497 return self._style
498 499
500 - def setStyle(self, style):
501 """A CSS string to apply to the charts container 502 503 @param style: 504 """ 505 self._style = style
506 507
508 - def getBackgroundColor(self):
509 """@return:""" 510 return self._backgroundColor
511 512
513 - def setBackgroundColor(self, backgroundColor):
514 """Sets the background color for the outer chart area 515 516 @param backgroundColor 517 """ 518 self._backgroundColor = backgroundColor
519 520
521 - def getBorderColor(self):
522 """@return""" 523 return self._borderColor
524 525
526 - def setBorderColor(self, borderColor):
527 """Sets the border color for the outer chart border 528 529 @param borderColor 530 """ 531 self._borderColor = borderColor
532 533
534 - def getBorderRadius(self):
535 """@return""" 536 return self._borderRadius
537 538
539 - def setBorderRadius(self, borderRadius):
540 """Sets radius for the outer chart border 541 542 @param borderRadius 543 """ 544 self._borderRadius = borderRadius
545 546
547 - def getBorderWidth(self):
548 """@return""" 549 return self._borderWidth
550 551
552 - def setBorderWidth(self, borderWidth):
553 """Sets pixel width of the outer chart border 554 555 @param borderWidth 556 """ 557 self._borderWidth = borderWidth
558 559
560 - def getHeight(self):
561 """@return""" 562 return self._height
563 564
565 - def setHeight(self, height):
566 """Sets height for the chart 567 568 @param height 569 """ 570 self._height = height
571 572
573 - def getWidth(self):
574 """@return""" 575 return self._width
576 577
578 - def setWidth(self, width):
579 """Sets width for the chart 580 581 @param width 582 """ 583 self._width = width
584 585
586 - def getIgnoreHiddenSeries(self):
587 """@return""" 588 return self._ignoreHiddenSeries
589 590
591 - def setIgnoreHiddenSeries(self, ignoreHiddenSeries):
592 """If the argument is true, the axes will scale to the remaining 593 visible series once one series is hidden. If the argument is false, 594 hiding and showing a series will not affect the axes or the other 595 series. 596 597 @param ignoreHiddenSeries 598 """ 599 self._ignoreHiddenSeries = ignoreHiddenSeries
600 601
602 - def getInverted(self):
603 """@return""" 604 return self._inverted
605 606
607 - def setInverted(self, inverted):
608 """If the argument is true then the x-axis is reversed. If a bar 609 plot is present, it will be inverted automatically. 610 611 @param inverted 612 """ 613 self._inverted = inverted
614 615
616 - def getMargin(self):
617 """@return""" 618 return self._margin
619 620
621 - def setMargin(self, margin):
622 """@param margin""" 623 self._margin = margin
624 625
626 - def getShowAxes(self):
627 """@return""" 628 return self._showAxes
629 630
631 - def setShowAxes(self, showAxes):
632 """If the argument is true then the axes will be shown initially. 633 This is useful when the chart is empty and axes must be shown. 634 635 @param showAxes 636 """ 637 self._showAxes = showAxes
638 639
640 - def getSpacing(self):
641 """@return""" 642 return self._spacing
643 644
645 - def setSpacing(self, spacing):
646 """@param spacing""" 647 self._spacing = spacing
648 649
650 - def getType(self):
651 """@return""" 652 return self._type
653 654
655 - def setType(self, typ):
656 """Sets series type to one of line, spline, scatter, area, 657 areaspline, pie, bar and column. 658 659 @param typ 660 """ 661 self._type = typ
662 663
664 - def getZoomType(self):
665 """@return""" 666 return self._zoomType
667 668
669 - def setZoomType(self, zoomType):
670 """Sets zoom type. It decides how a chart can be zoomed by 671 dragging the mouse. 672 673 @param zoomType 674 """ 675 self._zoomType = zoomType
676 677
678 - def isClientZoom(self):
679 """@return""" 680 return self._clientZoom
681 682
683 - def setClientZoom(self, clientZoom):
684 """If the argument is true then the scaling will happen on client. If 685 the argument is false then the chart will not scale. In any case, the 686 server will receive event notification if registered. 687 688 @param clientZoom 689 """ 690 self._clientZoom = clientZoom
691 692
693 - def __str__(self):
694 return ('Chart [backgroundColor=' + str(self._backgroundColor) 695 + ', borderColor=' + str(self._borderColor) 696 + ', borderRadius=' + str(self._borderRadius) 697 + ', borderWidth=' + str(self._borderWidth) 698 + ', height=' + str(self._height) 699 + ', width=' + str(self._width) 700 + ', ignoreHiddenSeries=' + str(self._ignoreHiddenSeries) 701 + ', inverted=' + str(self._inverted) 702 + ', margin=' + str(self._margin) 703 + ', spacing=' + str(self._spacing) 704 + ', showAxes=' + str(self._showAxes) 705 + ', type=' + str(self._type) 706 + ', zoomType=' + str(self._zoomType) 707 + ', alignTicks=' + str(self._alignTicks) 708 + ', animation=' + str(self._animation) 709 + ', className=' + str(self._className) 710 + ', reflow=' + str(self._reflow) 711 + ', shadow=' + str(self._shadow) 712 + ', plot=' + str(self._plot) 713 + ', style=' + str(self._style) + ']')
714
715 716 -class Plot(object):
717 """This class represents drawing area of the chart and contains methods 718 specific to it. 719 720 @author chirag: 721 """ 722
723 - def __init__(self):
724 self._backgroundColor = None 725 self._backgroundImage = None 726 self._borderColor = None 727 self._borderWidth = None 728 self._shadow = None
729
730 - def getBackgroundColor(self):
731 return self._backgroundColor
732
733 - def setBackgroundColor(self, backgroundColor):
734 self._backgroundColor = backgroundColor
735
736 - def getBackgroundImage(self):
737 return self._backgroundImage
738
739 - def setBackgroundImage(self, backgroundImage):
740 self._backgroundImage = backgroundImage
741
742 - def getBorderColor(self):
743 return self._borderColor
744
745 - def setBorderColor(self, borderColor):
746 self._borderColor = borderColor
747
748 - def getBorderWidth(self):
749 return self._borderWidth
750
751 - def setBorderWidth(self, borderWidth):
752 self._borderWidth = borderWidth
753
754 - def getShadow(self):
755 return self._shadow
756
757 - def setShadow(self, shadow):
758 self._shadow = shadow
759
760 - def __str__(self):
761 return ('Plot [backgroundColor=' + str(self._backgroundColor) 762 + ', backgroundImage=' + str(self._backgroundImage) 763 + ', borderColor=' + str(self._borderColor) 764 + ', borderWidth=' + str(self._borderWidth) 765 + ', shadow=' + str(self._shadow) + ']')
766
767 768 -class Spacing(object):
769 """This class represents space around the chart. The boundary of the 770 chart includes axis, axis labels, legend, chart title and subtitle. 771 772 @author: Invient 773 @author: Richard Lincoln 774 """
775 - def __init__(self):
776 self._left = None 777 self._top = None 778 self._right = None 779 self._bottom = None
780
781 - def getLeft(self):
782 return self._left
783
784 - def setLeft(self, left):
785 self._left = left
786
787 - def getTop(self):
788 return self._top
789
790 - def setTop(self, top):
791 self._top = top
792
793 - def getRight(self):
794 return self._right
795
796 - def setRight(self, right):
797 self._right = right
798
799 - def getBottom(self):
800 return self._bottom
801
802 - def setBottom(self, bottom):
803 self._bottom = bottom
804
805 - def __str__(self):
806 return ('Spacing [left=' + str(self._left) 807 + ', top=' + str(self._top) 808 + ', right=' + str(self._right) 809 + ', bottom=' + str(self._bottom) 810 + ']')
811
812 813 -class Margin(object):
814 """This class represents margin between the outer edge of the chart 815 and the plot area. 816 817 @author: Invient 818 @author: Richard Lincoln 819 """ 820
821 - def __init__(self, top=None, right=None, bottom=None, left=None):
822 self._top = top 823 self._right = right 824 self._bottom = bottom 825 self._left = left
826
827 - def getLeft(self):
828 return self._left
829
830 - def setLeft(self, left):
831 self._left = left
832
833 - def getTop(self):
834 return self._top
835
836 - def setTop(self, top):
837 self._top = top
838
839 - def getRight(self):
840 return self._right
841
842 - def setRight(self, right):
843 self._right = right
844
845 - def getBottom(self):
846 return self._bottom
847
848 - def setBottom(self, bottom):
849 self._bottom = bottom
850
851 - def __str__(self):
852 return ('Margin [left=' + str(self._left) 853 + ', top=' + str(self._top) 854 + ', right=' + str(self._right) 855 + ', bottom=' + str(self._bottom) 856 + ']')
857
858 859 -class ZoomType(object):
860 """The value L{ZoomType.X} represents horizontal zoom. The value 861 L{ZoomType.Y} represents vertical zoom. The value 862 L{ZoomType.XY} represents horizontal as well as vertical zoom. 863 864 @author: Invient 865 @author: Richard Lincoln 866 """ 867 X = None 868 Y = None 869 XY = None 870 NONE = None 871
872 - def __init__(self, typ):
873 self._type = typ
874
875 - def getName(self):
876 return self._type
877 878 @classmethod
879 - def values(cls):
880 return [cls.X, cls.Y, cls.XY, cls.NONE]
881 882 883 ZoomType.X = ZoomType('x') 884 ZoomType.Y = ZoomType('y') 885 ZoomType.XY = ZoomType('xy') 886 ZoomType.NONE = ZoomType('')
887 888 889 -class SeriesConfig(object):
890 """This class contains general configuration options for all series 891 types such as line, area and pie. 892 893 @author: Invient 894 @author: Richard Lincoln 895 """ 896
897 - def __init__(self):
898 self._allowPointSelect = None 899 self._animation = None 900 self._enableMouseTracking = None 901 self._showInLegend = None 902 self._cursor = None 903 # No impact in case of Pie chart 904 self._stacking = None 905 self._showCheckbox = None 906 # private Boolean selected; 907 self._visible = None 908 # NA for pie 909 self._shadow = None 910 # NA for pie and scatter 911 self._hoverState = None 912 self._dataLabel = None 913 self._color = None
914 915
916 - def getAllowPointSelect(self):
917 """@return""" 918 return self._allowPointSelect
919 920
921 - def setAllowPointSelect(self, allowPointSelect):
922 """If the argument is true then the points of a can be selected 923 otherwise not. Defaults to false, The point on a chart will toggle. 924 Also, whenever a point is selected or deselected, the registered 925 event listeners will be triggered. 926 927 @param allowPointSelect 928 """ 929 self._allowPointSelect = allowPointSelect
930 931
932 - def getAnimation(self):
933 return self._animation
934 935
936 - def setAnimation(self, animation):
937 """If the argument is true then animation will be enabled when a 938 series will be displayed otherwise not. Defaults to false. 939 940 @param animation 941 """ 942 self._animation = animation
943 944
945 - def getEnableMouseTracking(self):
946 """@return""" 947 return self._enableMouseTracking
948 949
950 - def setEnableMouseTracking(self, enableMouseTracking):
951 """If the argument is true then the mouse tracking will be enabled 952 for a series otherwise not. Defaults to true. 953 954 @param enableMouseTracking 955 """ 956 self._enableMouseTracking = enableMouseTracking
957 958
959 - def getShowInLegend(self):
960 """@return""" 961 return self._showInLegend
962 963
964 - def setShowInLegend(self, showInLegend):
965 """If the argument is true then a series will be displayed in the 966 legend otherwise not. Defaults to true. 967 968 @param showInLegend 969 """ 970 self._showInLegend = showInLegend
971 972
973 - def getCursor(self):
974 """@return""" 975 return self._cursor
976 977
978 - def setCursor(self, cursor):
979 """Sets the cursor style. E.g. cursor can be set to css cursor style 980 'pointer', 'hand' or any other. Defaults to null. 981 982 @param cursor 983 """ 984 self._cursor = cursor
985 986
987 - def getStacking(self):
988 """@return""" 989 return self._stacking
990 991
992 - def setStacking(self, stacking):
993 """Specifies whether the values of each series should be stacked on 994 top of each other or not. Defaults to null. If the argument is null 995 then the values of each series are not stacked. 996 997 @param stacking 998 """ 999 self._stacking = stacking
1000 1001
1002 - def getShowCheckbox(self):
1003 """@return""" 1004 return self._showCheckbox
1005 1006
1007 - def setShowCheckbox(self, showCheckbox):
1008 """If the argument is true then a checkbox is displayed next to the 1009 legend item in the legend area. Defaults to false 1010 1011 @param showCheckbox 1012 """ 1013 self._showCheckbox = showCheckbox
1014 1015
1016 - def getVisible(self):
1017 """@return""" 1018 return self._visible
1019 1020
1021 - def setVisible(self, visible):
1022 """If the argument is true then the series is visible otherwise not 1023 when a chart is rendered initially. Defaults to true However, this 1024 is not applicable for series related to Pie chart. 1025 1026 @param visible 1027 @raise NotImplementedError: 1028 If this method is invoked on L{PieConfig} 1029 """ 1030 self._visible = visible
1031 1032
1033 - def getShadow(self):
1034 """@return""" 1035 return self._shadow
1036 1037
1038 - def setShadow(self, shadow):
1039 """If the argument is true then a shadow will be shown to the graph 1040 line otherwise not. Defaults to true. 1041 1042 @param shadow: 1043 @raise NotImplementedError: 1044 If this method is invoked on L{PieConfig} 1045 """ 1046 self._shadow = shadow
1047 1048
1049 - def getHoverState(self):
1050 """@return""" 1051 return self._hoverState
1052 1053
1054 - def setHoverState(self, state):
1055 """Sets attributes which should be applied to a series when series 1056 is hovered. 1057 1058 @param state 1059 """ 1060 self._hoverState = state
1061 1062
1063 - def getDataLabel(self):
1064 """@return""" 1065 return self._dataLabel
1066 1067
1068 - def setDataLabel(self, dataLabel):
1069 """Sets how point value should be formatted and displayed for each 1070 point. 1071 1072 @param dataLabel 1073 """ 1074 self._dataLabel = dataLabel
1075 1076
1077 - def getColor(self):
1078 """@return""" 1079 return self._color
1080 1081
1082 - def setColor(self, color):
1083 """Sets color for the series. 1084 1085 @param color 1086 """ 1087 self._color = color
1088
1089 1090 -class DataLabel(object):
1091 """This class contains various attributes to format data labels. The 1092 data labels are displayed along with points and axis. 1093 1094 @author: Invient 1095 @author: Richard Lincoln 1096 """ 1097
1098 - def __init__(self, enabled=True):
1099 """If the argument is true then the datalabels will be displayed 1100 otherwise not. 1101 1102 @param enabled 1103 """ 1104 self._align = None 1105 # NA for pie 1106 self._enabled = True 1107 self._formatterJsFunc = None 1108 self._rotation = None 1109 self._style = None 1110 self._x = None 1111 self._y = None 1112 self._color = None
1113 1114
1115 - def getAlign(self):
1116 """@return""" 1117 return self._align
1118 1119
1120 - def setAlign(self, align):
1121 """@param align""" 1122 self._align = align
1123 1124
1125 - def getEnabled(self):
1126 """@return""" 1127 return self._enabled
1128 1129
1130 - def setEnabled(self, enabled):
1131 """If the argument is true then the datalabels will be displayed 1132 otherwise not. 1133 1134 @param enabled 1135 """ 1136 self._enabled = enabled
1137 1138
1139 - def getFormatterJsFunc(self):
1140 """@return""" 1141 return self._formatterJsFunc
1142 1143
1144 - def setFormatterJsFunc(self, formatterJsFunc):
1145 """Sets the argument string JavaScript function. This function will 1146 be called to format the data label. Refer to highchart documentation 1147 for more details on this 1148 U{http://www.highcharts.com/ref/#plotOptions-series-dataLabels} 1149 1150 @param formatterJsFunc 1151 """ 1152 self._formatterJsFunc = formatterJsFunc
1153 1154
1155 - def getRotation(self):
1156 """@return""" 1157 return self._rotation
1158 1159
1160 - def setRotation(self, rotation):
1161 """Sets text rotation in degrees 1162 1163 @param rotation 1164 """ 1165 self._rotation = rotation
1166 1167
1168 - def getStyle(self):
1169 """@return""" 1170 return self._style
1171 1172
1173 - def setStyle(self, style):
1174 """Sets css style for the data label 1175 1176 @param style 1177 """ 1178 self._style = style
1179 1180
1181 - def getX(self):
1182 """@return""" 1183 return self._x
1184 1185
1186 - def setX(self, x):
1187 """Sets the x position offset of the label relative to the point. 1188 Defaults to 0. 1189 1190 @param x 1191 """ 1192 self._x = x
1193 1194
1195 - def getY(self):
1196 """@return""" 1197 return self._y
1198 1199
1200 - def setY(self, y):
1201 """Sets the y position offset of the label relative to the point. 1202 Defaults to -6. 1203 1204 @param y 1205 """ 1206 self._y = y
1207 1208
1209 - def getColor(self):
1210 """@return""" 1211 return self._color
1212 1213
1214 - def setColor(self, color):
1215 """Sets color for the data labels. e.g. if the color is blue then in 1216 case of line series, for each point, the data label will be displayed 1217 in blue color. 1218 1219 @param color 1220 """ 1221 self._color = color
1222 1223
1224 - def __str__(self):
1225 return ('DataLabel [align=' + str(self._align) 1226 + ', enabled=' + str(self._enabled) 1227 + ', formatter=' + str(self._formatterJsFunc) 1228 + ', rotation=' + str(self._rotation) 1229 + ', style=' + str(self._style) 1230 + ', x=' + str(self._x) 1231 + ', y=' + str(self._y) + ']')
1232
1233 1234 -class PieDataLabel(DataLabel):
1235 """This class contains configuration attributes of data labels specific 1236 to Pie series. 1237 1238 @author: Invient 1239 @author: Richard Lincoln 1240 """ 1241
1242 - def __init__(self, enabled=False):
1243 """If the argument is true then the datalabels will be displayed 1244 otherwise not. 1245 1246 @param enabled 1247 """ 1248 self._connectorWidth = None 1249 self._connectorColor = None 1250 self._connectorPadding = None 1251 self._distance = None 1252 1253 super(PieDataLabel, self).__init__(enabled)
1254 1255
1256 - def getConnectorWidth(self):
1257 """@return""" 1258 return self._connectorWidth
1259 1260
1261 - def setConnectorWidth(self, connectorWidth):
1262 """Sets width (in pixel) of the line connecting the data label to 1263 the pie slice. Defaults to 1. 1264 1265 @param connectorWidth 1266 """ 1267 self._connectorWidth = connectorWidth
1268 1269
1270 - def getConnectorColor(self):
1271 """@return""" 1272 return self._connectorColor
1273 1274
1275 - def setConnectorColor(self, connectorColor):
1276 """Sets the color of the line connecting the data label to the pie 1277 slice. 1278 1279 @param connectorColor 1280 """ 1281 self._connectorColor = connectorColor
1282 1283
1284 - def getConnectorPadding(self):
1285 """@return""" 1286 return self._connectorPadding
1287 1288
1289 - def setConnectorPadding(self, connectorPadding):
1290 """Sets the distance (in pixel) from the data label to the connector. 1291 Defaults to 5. 1292 1293 @param connectorPadding 1294 """ 1295 self._connectorPadding = connectorPadding
1296 1297
1298 - def getDistance(self):
1299 """@return""" 1300 return self._distance
1301 1302
1303 - def setDistance(self, distance):
1304 """Sets the distance (in pixel) of the data label from the pie's edge. 1305 1306 @param distance 1307 """ 1308 self._distance = distance
1309 1310
1311 - def __str__(self):
1312 return ('PieDataLabel [connectorWidth=' + str(self._connectorWidth) 1313 + ', connectorColor=' + str(self._connectorColor) 1314 + ', connectorPadding=' + str(self._connectorPadding) 1315 + ', distance=' + str(self._distance) 1316 + ', getAlign()=' + str(self.getAlign()) 1317 + ', getEnabled()=' + str(self.getEnabled()) 1318 + ', getFormatter()=' + str(self.getFormatterJsFunc()) 1319 + ', getRotation()=' + str(self.getRotation()) 1320 + ', getStyle()=' + str(self.getStyle()) 1321 + ', getX()=' + str(self.getX()) 1322 + ', getY()=' + str(self.getY()) 1323 + ', __str__()=' + super(PieDataLabel, self).__str__() 1324 + ', __class__=' + self.__class__ 1325 + ', __hash__()=' + self.__hash__() + ']')
1326
1327 1328 -class AxisDataLabel(DataLabel):
1329 """This class contains configuration properties for axis labels. The axis 1330 labels are the one which are displayed for each tick. 1331 1332 @author: Invient 1333 @author: Richard Lincoln 1334 """ 1335
1336 - def __init__(self, enabled=False):
1337 """If the argument is true then the data labels will be displayed 1338 otherwise not. 1339 1340 @param enabled 1341 """ 1342 self._step = None 1343 1344 super(AxisDataLabel, self).__init__(enabled)
1345 1346
1347 - def getStep(self):
1348 """@return""" 1349 return self._step
1350 1351
1352 - def setStep(self, step):
1353 """Sets at what interval the labels on the axis should be displayed. 1354 Setting the step to 2 shows every other label. Defaults to null 1355 1356 @param step 1357 """ 1358 self._step = step
1359
1360 1361 -class XAxisDataLabel(AxisDataLabel):
1362 """This class contains configuration properties specifically for x-axis 1363 labels. 1364 1365 @author: Invient 1366 @author: Richard Lincoln 1367 """ 1368
1369 - def __init__(self, enabled=False):
1370 """If the argument is true then the data labels will be displayed 1371 otherwise not. 1372 1373 @param enabled 1374 """ 1375 self._staggerLines = None 1376 1377 super(XAxisDataLabel, self).__init__(enabled)
1378 1379
1380 - def getStaggerLines(self):
1381 """@return""" 1382 return self._staggerLines
1383 1384
1385 - def setStaggerLines(self, staggerLines):
1386 """Sets number of lines to spread the labels over to make room or 1387 tighter labels. 1388 1389 @param staggerLines 1390 """ 1391 self._staggerLines = staggerLines
1392
1393 1394 -class YAxisDataLabel(AxisDataLabel):
1395 """This class contains configuration properties specifically for x-axis 1396 labels. 1397 1398 @author: Invient 1399 @author: Richard Lincoln 1400 """ 1401
1402 - def __init__(self, enabled=False):
1403 """If the argument is true then the data labels will be displayed 1404 otherwise not. 1405 1406 @param enabled 1407 """ 1408 super(YAxisDataLabel, self).__init__(enabled)
1409
1410 1411 -class BaseLineConfig(SeriesConfig):
1412 """This class contains configuration options for line series such as 1413 line and area but not column series. 1414 1415 @author: Invient 1416 @author: Richard Lincoln 1417 """ 1418
1419 - def __init__(self):
1420 super(BaseLineConfig, self).__init__() 1421 1422 self._pointStart = None 1423 self._pointInterval = None 1424 self._stickyTracking = None 1425 self._marker = None 1426 self._dashStyle = None 1427 self._lineWidth = None
1428 1429
1430 - def getPointStart(self):
1431 """@return""" 1432 return self._pointStart
1433 1434
1435 - def setPointStart(self, pointStart):
1436 """If no x values are given for the points in a series, the argument 1437 pointStart defines on what value to start. Defaults to 0. e.g. if a 1438 series contains values higher than 2 m $ then sets pointStart to 1439 2,000,000 1440 1441 @param pointStart 1442 """ 1443 self._pointStart = pointStart
1444 1445
1446 - def getPointInterval(self):
1447 """@return""" 1448 return self._pointInterval
1449 1450
1451 - def setPointInterval(self, pointInterval):
1452 """If no x values are given for the points in a series, the argument 1453 pointInterval defines the interval of the x values. For example, if 1454 a series contains one value every day then set pointInterval to 1455 24 * 3600 * 1000 1456 1457 @param pointInterval 1458 """ 1459 self._pointInterval = pointInterval
1460 1461
1462 - def getStickyTracking(self):
1463 """@return""" 1464 return self._stickyTracking
1465 1466
1467 - def setStickyTracking(self, stickyTracking):
1468 """If the argument is true then the mouseout event on a series is not 1469 triggered until mouse moves over another series or comes out of the 1470 plot area. If the argument is true then the mouseout event occurs as 1471 soon as mouse leaves area near to the point or marker 1472 1473 @param stickyTracking 1474 """ 1475 self._stickyTracking = stickyTracking
1476 1477
1478 - def getMarker(self):
1479 """@return""" 1480 return self._marker
1481 1482
1483 - def setMarker(self, marker):
1484 """Sets marker for points of a series 1485 1486 @param marker 1487 """ 1488 self._marker = marker
1489 1490
1491 - def getDashStyle(self):
1492 """@return""" 1493 return self._dashStyle
1494 1495
1496 - def setDashStyle(self, dashStyle):
1497 """Sets dash style to use when drawing a series. 1498 1499 @param dashStyle 1500 """ 1501 self._dashStyle = dashStyle
1502 1503
1504 - def getLineWidth(self):
1505 """@return""" 1506 return self._lineWidth
1507 1508
1509 - def setLineWidth(self, lineWidth):
1510 """Sets width of a line 1511 1512 @param lineWidth 1513 """ 1514 self._lineWidth = lineWidth
1515
1516 1517 -class DashStyle(object):
1518 1519 SOLID = None 1520 SHORT_DASH = None 1521 SHORT_DOT = None 1522 SHORT_DASH_DOT = None 1523 SHORT_DASH_DOT_DOT = None 1524 DOT = None 1525 DASH = None 1526 LONG_DASH = None 1527 DASH_DOT = None 1528 LONG_DASH_DOT = None 1529 LONG_DASH_DOT_DOT = None 1530
1531 - def __init__(self, name):
1532 self._name = name
1533
1534 - def getName(self):
1535 return self._name
1536 1537 @classmethod
1538 - def values(cls):
1539 return [cls.SOLID, cls.SHORT_DASH, cls.SHORT_DOT, cls.SHORT_DASH_DOT, 1540 cls.SHORT_DASH_DOT_DOT, cls.DOT, cls.DASH, cls.LONG_DASH, 1541 cls.DASH_DOT, cls.LONG_DASH_DOT, cls.LONG_DASH_DOT_DOT]
1542 1543 DashStyle.SOLID = DashStyle('Solid') 1544 DashStyle.SHORT_DASH = DashStyle('ShortDash') 1545 DashStyle.SHORT_DOT = DashStyle('ShortDot') 1546 DashStyle.SHORT_DASH_DOT = DashStyle('ShortDashDot') 1547 DashStyle.SHORT_DASH_DOT_DOT = DashStyle('ShortDashDotDot') 1548 DashStyle.DOT = DashStyle('Dot') 1549 DashStyle.DASH = DashStyle('Dash') 1550 DashStyle.LONG_DASH = DashStyle('LongDash') 1551 DashStyle.DASH_DOT = DashStyle('DashDot') 1552 DashStyle.LONG_DASH_DOT = DashStyle('LongDashDot') 1553 DashStyle.LONG_DASH_DOT_DOT = DashStyle('LongDashDotDot')
1554 1555 1556 -class AreaConfig(BaseLineConfig):
1557 """This class contains configuration options for area series, area and 1558 areaspline. 1559 1560 @author: Invient 1561 @author: Richard Lincoln 1562 """ 1563
1564 - def __init__(self):
1565 super(AreaConfig, self).__init__() 1566 1567 self._fillColor = None 1568 self._lineColor = None 1569 self._fillOpacity = None 1570 self._threshold = None
1571 1572
1573 - def getFillColor(self):
1574 """@return Returns fill color of the area.""" 1575 return self._fillColor
1576 1577
1578 - def setFillColor(self, fillColor):
1579 """Sets fill gradient for the area 1580 1581 @param fillColor 1582 """ 1583 self._fillColor = fillColor
1584 1585
1586 - def getLineColor(self):
1587 """@return: Returns color of a line drawing above the area""" 1588 return self._lineColor
1589 1590
1591 - def setLineColor(self, lineColor):
1592 """Sets line color for the line of an area. 1593 1594 @param lineColor 1595 """ 1596 self._lineColor = lineColor
1597 1598
1599 - def getFillOpacity(self):
1600 """@return: Returns opacity (transparency) which will be used when 1601 the area is filled with the fill color""" 1602 return self._fillOpacity
1603 1604
1605 - def setFillOpacity(self, fillOpacity):
1606 """Sets opacity for the area 1607 1608 @param fillOpacity 1609 """ 1610 self._fillOpacity = fillOpacity
1611 1612
1613 - def getThreshold(self):
1614 """@return: Returns threadshold of the area""" 1615 return self._threshold
1616 1617
1618 - def setThreshold(self, threshold):
1619 """Sets threshold value which servers as the base for the area, for 1620 distinguishing between values above and below a threshold. Defaults 1621 to 0. 1622 1623 @param threshold 1624 """ 1625 self._threshold = threshold
1626
1627 1628 -class AreaSplineConfig(AreaConfig):
1629 """This class contains configuration options for areaspline series 1630 1631 @author: Invient 1632 @author: Richard Lincoln 1633 """ 1634 pass
1635
1636 1637 -class LineConfig(BaseLineConfig):
1638 """This class contains configuration options for line series 1639 1640 @author: Invient 1641 @author: Richard Lincoln 1642 """
1643 - def __init__(self):
1644 super(LineConfig, self).__init__() 1645 self._step = None
1646 1647
1648 - def getStep(self):
1649 """@return: Returns true if the line should be drawn using steps 1650 otherwise false.""" 1651 return self._step
1652 1653
1654 - def setStep(self, step):
1655 """If the argument is true then line will be drawn using steps 1656 otherwise not. Defaults to false. 1657 1658 @param step 1659 """ 1660 self._step = step
1661
1662 1663 -class ScatterConfig(BaseLineConfig):
1664 """This class contains configuration options for scatter series 1665 1666 @author: Invient 1667 @author: Richard Lincoln 1668 """ 1669
1670 - def setShadow(self, shadow):
1671 """@param shadow: 1672 @raise NotImplementedError: 1673 Scatter series does not support shadow so this method 1674 throws an exception if invoked. 1675 """ 1676 raise NotImplementedError, 'Scatter chart does not support shadow.'
1677 1678
1679 - def getShadow(self):
1680 """@return: Returns null as scatter series does not have shadow.""" 1681 return None
1682
1683 1684 -class SplineConfig(BaseLineConfig):
1685 """This class contains configuration options for spline series 1686 1687 @author: Invient 1688 @author: Richard Lincoln 1689 """ 1690 pass
1691
1692 1693 -class PieConfig(SeriesConfig):
1694 """This class contains configuration options for pie series. 1695 1696 @author: Invient 1697 @author: Richard Lincoln 1698 """ 1699
1700 - def __init__(self):
1701 super(PieConfig, self).__init__() 1702 1703 self._centerX = None 1704 self._centerY = None 1705 self._borderColor = None 1706 self._borderWidth = None 1707 self._innerSize = None 1708 self._size = None 1709 self._slicedOffset = None
1710 1711
1712 - def getCenterX(self):
1713 """@return: Returns x position (in pixel) of the center of the pie 1714 chart relative to the plot area. 1715 """ 1716 return self._centerX
1717 1718
1719 - def setCenterX(self, centerX):
1720 """Sets x position (in pixel) of the center of the pie chart relative 1721 to the plot area. 1722 1723 @param centerX 1724 """ 1725 self._centerX = centerX
1726 1727
1728 - def getCenterY(self):
1729 """@return: Returns y position (in pixel) of the center of the pie 1730 chart relative to the plot area. 1731 """ 1732 return self._centerY
1733 1734
1735 - def setCenterY(self, centerY):
1736 """Sets y position (in pixel) of the center of the pie chart relative 1737 to the plot area. 1738 1739 @param centerY 1740 """ 1741 self._centerY = centerY
1742 1743
1744 - def getBorderColor(self):
1745 """@return: Returns color of border surrounding each slice.""" 1746 return self._borderColor
1747 1748
1749 - def setBorderColor(self, borderColor):
1750 """Sets color of border surrounding each slice. 1751 1752 @param borderColor 1753 """ 1754 self._borderColor = borderColor
1755 1756
1757 - def getBorderWidth(self):
1758 """@return: Returns width of the border surrounding each slice.""" 1759 return self._borderWidth
1760 1761
1762 - def setBorderWidth(self, borderWidth):
1763 """Sets width of border surrounding each slice. 1764 1765 @param borderWidth 1766 """ 1767 self._borderWidth = borderWidth
1768 1769
1770 - def getInnerSize(self):
1771 """@return: Returns size of the inner diameter of the pie.""" 1772 return self._innerSize
1773 1774
1775 - def setInnerSize(self, innerSize):
1776 """Sets the size of the inner diameter for the pie. Any value greater 1777 than 0 renders a donut chart. 1778 1779 @param innerSize 1780 """ 1781 self._innerSize = innerSize
1782 1783
1784 - def getSize(self):
1785 """@return: Returns size of diameter of the pie relative to the plot 1786 area.""" 1787 return self._size
1788 1789
1790 - def setSize(self, size):
1791 """Sets size of diameter of the pie relative to the plot area. 1792 1793 @param size 1794 """ 1795 self._size = size
1796 1797
1798 - def getSlicedOffset(self):
1799 """@return: Returns offset in pixel by which a slice should be moved 1800 out from the center. 1801 """ 1802 return self._slicedOffset
1803 1804
1805 - def setSlicedOffset(self, slicedOffset):
1806 """Sets offset in pixel by which a slice should be moved out from the 1807 center. 1808 1809 @param slicedOffset 1810 """ 1811 self._slicedOffset = slicedOffset
1812 1813
1814 - def setVisible(self, visible):
1815 """@raise NotimplementedError: 1816 Pie chart does not support visible property so this 1817 method throws an exception if invoked. 1818 """ 1819 raise NotImplementedError('Pie chart does not support visible property.')
1820 1821
1822 - def setShadow(self, shadow):
1823 """@raise NotImplementedError: 1824 Pie chart does not support shadow property so this 1825 method throws an exception if invoked. 1826 """ 1827 raise NotImplementedError('Pie chart does not support shadow.')
1828 1829
1830 - def getVisible(self):
1831 """@return: Returns null as pie does not support toggle (show/hide 1832 pie) feature.""" 1833 return None
1834 1835
1836 - def getShadow(self):
1837 """@return: Returns null as pie series does not support shadow.""" 1838 return None
1839 1840
1841 - def setDataLabel(self, dataLabel):
1842 """Sets an object of L{PieDataLabel} which contains configuration 1843 for formatting data labels. 1844 1845 @param dataLabel 1846 """ 1847 super(PieConfig, self).setDataLabel(dataLabel)
1848 1849
1850 - def getDataLabel(self):
1851 return super(PieConfig, self).getDataLabel()
1852 1853
1854 - def setHoverState(self, state):
1855 """Sets state which should be applied to a slice when a mouse is 1856 over the slice 1857 1858 @param state 1859 """ 1860 super(PieConfig, self).setHoverState(state)
1861 1862
1863 - def getHoverState(self):
1864 if (isinstance(super(PieConfig, self).getHoverState(), 1865 NonLinearSeriesState)): 1866 return super(PieConfig, self).getHoverState() 1867 return None
1868
1869 1870 -class BaseBarConfig(SeriesConfig):
1871 """This class contains configuration options for bar and column series. 1872 1873 @author: Invient 1874 @author: Richard Lincoln 1875 """ 1876
1877 - def __init__(self):
1878 super(BaseBarConfig, self).__init__() 1879 1880 self._borderColor = None 1881 self._borderRadius = None 1882 self._borderWidth = None 1883 self._colorByPoint = None 1884 self._groupPadding = None 1885 self._minPointLength = None 1886 self._pointPadding = None 1887 self._pointWidth = None
1888 1889
1890 - def getBorderColor(self):
1891 """@return""" 1892 return self._borderColor
1893 1894
1895 - def setBorderColor(self, borderColor):
1896 """Sets the color of the border surronding each column or bar. 1897 1898 @param borderColor 1899 """ 1900 self._borderColor = borderColor
1901 1902
1903 - def getBorderRadius(self):
1904 """@return""" 1905 return self._borderRadius
1906 1907
1908 - def setBorderRadius(self, borderRadius):
1909 """Sets corner radius of the border surronding each column or bar. 1910 1911 @param borderRadius 1912 """ 1913 self._borderRadius = borderRadius
1914 1915
1916 - def getBorderWidth(self):
1917 """@return""" 1918 return self._borderWidth
1919 1920
1921 - def setBorderWidth(self, borderWidth):
1922 """Sets width of the border surronding each column or bar. 1923 1924 @param borderWidth 1925 """ 1926 self._borderWidth = borderWidth
1927 1928
1929 - def getColorByPoint(self):
1930 """@return""" 1931 return self._colorByPoint
1932 1933
1934 - def setColorByPoint(self, colorByPoint):
1935 """If the argument is true then each point (bar or column in a series 1936 will have a different color otherwise all points (bars/columns) of a 1937 series will have same color. 1938 1939 @param colorByPoint 1940 """ 1941 self._colorByPoint = colorByPoint
1942 1943
1944 - def getGroupPadding(self):
1945 """@return""" 1946 return self._groupPadding
1947 1948
1949 - def setGroupPadding(self, groupPadding):
1950 """Sets padding between each value groups, in x axis units. Defaults 1951 to 0.2. 1952 1953 @param groupPadding 1954 """ 1955 self._groupPadding = groupPadding
1956 1957
1958 - def getMinPointLength(self):
1959 """@return""" 1960 return self._minPointLength
1961 1962
1963 - def setMinPointLength(self, minPointLength):
1964 """Sets the minimal height for a column or width for a bar. By default, 1965 0 values are not shown. To visualize a 0 (or close to zero) point, 1966 set the minimal point length to a pixel value like 3. In stacked 1967 column charts, minPointLength might not be respected for tightly 1968 packed values. Defaults to 0. (For detail, refer to 1969 U{http://www.highcharts.com/ref/#plotOptions-bar}); 1970 1971 @param minPointLength 1972 """ 1973 self._minPointLength = minPointLength
1974 1975
1976 - def getPointPadding(self):
1977 """@return""" 1978 return self._pointPadding
1979 1980
1981 - def setPointPadding(self, pointPadding):
1982 """Sets padding between each column or bar, in x axis units. 1983 1984 @param pointPadding 1985 """ 1986 self._pointPadding = pointPadding
1987 1988
1989 - def getPointWidth(self):
1990 """@return""" 1991 return self._pointWidth
1992 1993
1994 - def setPointWidth(self, pointWidth):
1995 """Sets width of each bar or column in pixel. 1996 1997 @param pointWidth 1998 """ 1999 self._pointWidth = pointWidth
2000 2001
2002 - def setHoverState(self, state):
2003 """Sets state which should be applied to a bar or column when a 2004 mouse is over the bar or column 2005 2006 @param state 2007 """ 2008 super(BaseBarConfig, self).setHoverState(state)
2009 2010
2011 - def getHoverState(self):
2012 if (isinstance(super(BaseBarConfig, self).getHoverState(), 2013 NonLinearSeriesState)): 2014 return super(BaseBarConfig, self).getHoverState() 2015 return None
2016
2017 2018 -class ColumnConfig(BaseBarConfig):
2019 """This class contains configuration options for column series. 2020 2021 @author: Invient 2022 @author: Richard Lincoln 2023 """ 2024 pass
2025
2026 2027 -class BarConfig(BaseBarConfig):
2028 """This class contains configuration options for bar series. 2029 2030 @author: Invient 2031 @author: Richard Lincoln 2032 """ 2033 pass
2034
2035 2036 -class Stacking(object):
2037 """Defines ways in which series of a chart can be stacked. 2038 2039 Stacking.Normal - represents that the values of each series are stacked. 2040 2041 Stacking.Percent - represents that the the values of each series are 2042 stacked based on percentage of sum of total value, where total value is 2043 sum of values of all points on a particular tick of an axis. 2044 2045 @author Invient 2046 """ 2047 NORMAL = None 2048 PERCENT = None 2049
2050 - def __init__(self, stacking):
2051 self._stacking = stacking
2052
2053 - def getName(self):
2054 return self._stacking
2055 2056 @classmethod
2057 - def values(cls):
2058 return [cls.NORMAL, cls.PERCENT]
2059 2060 Stacking.NORMAL = Stacking('normal') 2061 Stacking.PERCENT = Stacking('percent')
2062 2063 2064 -class PointConfig(object):
2065 """Defines configuration per point in a series. It is possible to assign 2066 each point a different color and marker. 2067 2068 @author: Invient 2069 @author: Richard Lincoln 2070 """ 2071
2072 - def __init__(self, sliced_or_color_or_marker, selected=None, color=None, 2073 marker=None):
2074 """Creates an instance of this class with specified argument. The 2075 sliced attribute has meaning only for Pie chart/series. 2076 2077 @param sliced_or_color_or_marker: 2078 - If true then the slice of a pie will be at an offset 2079 from the center of the pie. Applicable only for Pie 2080 chart/series. 2081 @param selected: 2082 - If true then the point, to which this object is 2083 associated, will be shown as selected otherwise not. 2084 @param color: 2085 - Specifies individual color for a point, to which this 2086 object is associated. 2087 @param marker: 2088 - Specifies marker for a point, to which this object is 2089 associated. 2090 @see: L{Marker} 2091 @see: L{Color} 2092 """ 2093 if selected is None: 2094 if isinstance(sliced_or_color_or_marker, Marker): 2095 marker = sliced_or_color_or_marker 2096 sliced = selected = color = None 2097 elif isinstance(sliced_or_color_or_marker, IPaint): 2098 color = sliced_or_color_or_marker 2099 sliced = selected = marker = None 2100 else: 2101 sliced = selected = sliced_or_color_or_marker 2102 marker = color = None 2103 2104 super(PointConfig, self).__init__() 2105 self._sliced = sliced 2106 self._selected = selected 2107 self._color = color 2108 self._marker = marker
2109 2110
2111 - def getSliced(self):
2112 """@return""" 2113 return self._sliced
2114 2115
2116 - def setSliced(self, sliced):
2117 """@param sliced""" 2118 self._sliced = sliced
2119 2120
2121 - def getSelected(self):
2122 """@return""" 2123 return self._selected
2124 2125
2126 - def setSelected(self, selected):
2127 """@param selected""" 2128 self._selected = selected
2129 2130
2131 - def getColor(self):
2132 """@return""" 2133 return self._color
2134 2135
2136 - def setColor(self, color):
2137 """@param color""" 2138 self._color = color
2139 2140
2141 - def getMarker(self):
2142 """@return""" 2143 return self._marker
2144 2145
2146 - def setMarker(self, marker):
2147 """@param marker""" 2148 self._marker = marker
2149 2150
2151 - def __str__(self):
2152 """@return: Returns string representation of this object.""" 2153 return ('PointConfig [sliced=' + str(self._sliced) 2154 + ', selected=' + str(self._selected) 2155 + ', color=' + str(self._color) 2156 + ', marker=' + str(self._marker) 2157 + ']')
2158
2159 2160 -class TitleBase(object):
2161 """A chart has a title and a subtitle. This class defines attributes 2162 which are common to both. 2163 2164 The text of a title can be plain text or html text containing html 2165 elements. It is also possible to apply css to the title. The css must 2166 be valid css string e.g. { color: 'red' } 2167 2168 @author: Invient 2169 @author: Richard Lincoln 2170 2171 @see: L{Title} 2172 @see: L{SubTitle} 2173 @see: L{HorzAlign} 2174 @see: L{VertAlign} 2175 """ 2176
2177 - def __init__(self):
2178 self._align = None 2179 self._vertAlign = None 2180 self._floating = None 2181 self._text = None 2182 self._x = None 2183 self._y = None 2184 self._style = None
2185 2186
2187 - def getAlign(self):
2188 return self._align
2189 2190
2191 - def setAlign(self, align):
2192 """Sets horizontal alignment of the title. Defaults to HorzAlign.CENTER 2193 """ 2194 self._align = align
2195 2196
2197 - def getVertAlign(self):
2198 return self._vertAlign
2199 2200
2201 - def setVertAlign(self, vertAlign):
2202 """Sets horizontal alignment of the title. Defaults to VertAlign.TOP 2203 """ 2204 self._vertAlign = vertAlign
2205 2206
2207 - def getFloating(self):
2208 return self._floating
2209 2210
2211 - def setFloating(self, floating):
2212 """If the argument is true then the plot area will not move to make 2213 space for the chart title. Defaults to false. 2214 """ 2215 self._floating = floating
2216 2217
2218 - def getText(self):
2219 return self._text
2220 2221
2222 - def setText(self, text):
2223 """Sets text for the chart's title. The text can be plain or html 2224 string. 2225 """ 2226 self._text = text
2227 2228
2229 - def getX(self):
2230 return self._x
2231 2232
2233 - def setX(self, x):
2234 """Sets x position (in pixel) of the title relative to the alignment 2235 within Spacing.left and Spacing.right. Defaults to 0 2236 """ 2237 self._x = x
2238 2239
2240 - def getY(self):
2241 return self._y
2242 2243
2244 - def setY(self, y):
2245 """Sets y position (in pixel) of the title relative to the alignment 2246 within Spacing.top and Spacing.bottom. Defaults to 0 2247 """ 2248 self._y = y
2249 2250
2251 - def getStyle(self):
2252 return self._style
2253 2254
2255 - def setStyle(self, style):
2256 """Sets css for the title. The css must be a valid css object. e.g. css 2257 string "{ color:'red' }" is valid but "{ color: 'red'" is invalid. 2258 """ 2259 self._style = style
2260
2261 2262 -class Title(TitleBase):
2263 """Defines attributes of chart title. 2264 2265 @author: Invient 2266 @author: Richard Lincoln 2267 """ 2268
2269 - def __init__(self):
2270 super(Title, self).__init__() 2271 self._margin = None
2272 2273
2274 - def getMargin(self):
2275 return self._margin
2276 2277
2278 - def setMargin(self, margin):
2279 """Sets margin (in pixel) between the chart title and subtitle, if any. 2280 If chart subtitle doesn't exist then it indicates the margin between 2281 subtitle and plotarea. Defaults to 15 2282 """ 2283 self._margin = margin
2284
2285 2286 -class SubTitle(TitleBase):
2287 """Defines attributes of chart subtitle. 2288 2289 @author: Invient 2290 @author: Richard Lincoln 2291 """ 2292 pass
2293
2294 2295 -class HorzAlign(object):
2296 2297 LEFT = None 2298 CENTER = None 2299 RIGHT = None 2300
2301 - def __init__(self, align):
2302 self._align = align
2303
2304 - def getName(self):
2305 return self._align
2306 2307 @classmethod
2308 - def values(cls):
2309 return [cls.LEFT, cls.CENTER, cls.RIGHT]
2310 2311 HorzAlign.LEFT = HorzAlign('left') 2312 HorzAlign.CENTER = HorzAlign('center') 2313 HorzAlign.RIGHT = HorzAlign('right')
2314 2315 2316 -class VertAlign(object):
2317 2318 TOP = None 2319 MIDDLE = None 2320 BOTTOM = None 2321
2322 - def __init__(self, align):
2323 self._align = align
2324
2325 - def getName(self):
2326 return self._align
2327 2328 @classmethod
2329 - def values(cls):
2330 return [cls.TOP, cls.MIDDLE, cls.BOTTOM]
2331 2332 VertAlign.TOP = VertAlign('top') 2333 VertAlign.MIDDLE = VertAlign('middle') 2334 VertAlign.BOTTOM = VertAlign('bottom')
2335 2336 2337 -class State(object):
2338 """Defines state for a series and point. A series can be in hover state. 2339 A point can be in hover and select state. In each state, a series and a 2340 point can have different visual clues. This is achived by setting some 2341 attributes of a seires and point. 2342 2343 @author: Invient 2344 @author: Richard Lincoln 2345 2346 @see: L{SeriesState} 2347 """ 2348
2349 - def getEnabled(self):
2350 pass
2351
2352 2353 -class SeriesState(State):
2354 """Defines a set of attributes which will be applied to a series upon 2355 hover. The attributes linWidth is not applicable for Pie, Scatter, Bar 2356 and Column series. 2357 2358 @author: Invient 2359 @author: Richard Lincoln 2360 """ 2361
2362 - def __init__(self):
2363 self._enabled = None 2364 self._lineWidth = None
2365 2366
2367 - def getEnabled(self):
2368 return self._enabled
2369 2370
2371 - def setEnabled(self, enabled):
2372 """If the argument is true then the other properties of this class 2373 have impact on visual rendering of the series when a series is hovered 2374 or when a mouse is over the legend. Enabling this has a performance 2375 penalty. 2376 2377 Defaults to false. 2378 """ 2379 self._enabled = enabled
2380 2381
2382 - def getLineWidth(self):
2383 return self._lineWidth
2384 2385
2386 - def setLineWidth(self, lineWidth):
2387 """Sets width of a line in pixel. Defaults to 2. 2388 """ 2389 self._lineWidth = lineWidth
2390
2391 2392 -class NonLinearSeriesState(SeriesState):
2393 """Defines a set of attributes which are meaningful for bar and colum 2394 series. 2395 2396 @author: Invient 2397 @author: Richard Lincoln 2398 """
2399 - def __init__(self):
2400 self._brightness = None
2401 2402
2403 - def getBrightness(self):
2404 return self._brightness
2405 2406
2407 - def setBrightness(self, brightness):
2408 """Sets intensity of brightness for a point. This applies only to 2409 bar and column series/chart 2410 2411 Defaults to 0.1 2412 """ 2413 self._brightness = brightness
2414
2415 2416 -class MarkerAttribute(object):
2417 """Defines a collection of attributes which makes a marker. Markers 2418 are generally used to annotate a graph points. 2419 2420 @author: Invient 2421 @author: Richard Lincoln 2422 """ 2423
2424 - def __init__(self):
2425 self._enabled = None 2426 self._fillColor = None 2427 self._lineColor = None 2428 self._lineWidth = None 2429 self._radius = None
2430
2431 - def getEnabled(self):
2432 return self._enabled
2433
2434 - def setEnabled(self, enabled):
2435 self._enabled = enabled
2436
2437 - def getFillColor(self):
2438 return self._fillColor
2439
2440 - def setFillColor(self, fillColor):
2441 self._fillColor = fillColor
2442
2443 - def getLineColor(self):
2444 return self._lineColor
2445
2446 - def setLineColor(self, lineColor):
2447 self._lineColor = lineColor
2448
2449 - def getLineWidth(self):
2450 return self._lineWidth
2451
2452 - def setLineWidth(self, lineWidth):
2453 self._lineWidth = lineWidth
2454
2455 - def getRadius(self):
2456 return self._radius
2457
2458 - def setRadius(self, radius):
2459 self._radius = radius
2460
2461 - def __str__(self):
2462 return ('MarkerStateAttribute [enabled=' + str(self._enabled) 2463 + ', fillColor=' + str(self._fillColor) 2464 + ', lineColor=' + str(self._lineColor) 2465 + ', lineWidth=' + str(self._lineWidth) 2466 + ', radius=' + str(self._radius) 2467 + ']')
2468
2469 2470 -class MarkerState(State):
2471 """Defines a set of attributes which gets applied to a point when a point 2472 is selected or hovered. By default, markers are enabled so when a mouse is 2473 over a point marker gets applied. To turn off marker, set flag enabled to 2474 false. 2475 2476 A point marker is useful only if the marker is not an image. 2477 2478 @author: Invient 2479 @author: Richard Lincoln 2480 2481 @see: L{ImageMarker} 2482 @see: L{SymbolMarker} 2483 """ 2484
2485 - def __init__(self, enabled=True):
2486 """Creates this marker with specified argument. If enabled = false 2487 then the marker will not be applied to a point on hover or select 2488 state. 2489 """ 2490 self._markerAttribute = MarkerAttribute() 2491 2492 self._markerAttribute.setEnabled(True)
2493 2494
2495 - def getEnabled(self):
2496 return self._markerAttribute.getEnabled()
2497 2498
2499 - def setEnabled(self, enabled):
2500 """If enabled = false then the marker will not be applied to a point 2501 on hover or select state. Defaults to true 2502 """ 2503 self._markerAttribute.setEnabled(enabled)
2504 2505
2506 - def getFillColor(self):
2507 return self._markerAttribute.getFillColor()
2508 2509
2510 - def setFillColor(self, fillColor):
2511 """Sets fill color for the marker. When not specified it takes color 2512 of a series or point. 2513 """ 2514 self._markerAttribute.setFillColor(fillColor)
2515 2516
2517 - def getLineColor(self):
2518 return self._markerAttribute.getLineColor()
2519 2520
2521 - def setLineColor(self, lineColor):
2522 """Sets color of the point marker's outline. When not specified it 2523 takes color of a series or point. 2524 """ 2525 self._markerAttribute.setLineColor(lineColor)
2526 2527
2528 - def getLineWidth(self):
2529 return self._markerAttribute.getLineWidth()
2530 2531
2532 - def setLineWidth(self, lineWidth):
2533 """Sets width of the point marker's outline. Defaults to 0. 2534 """ 2535 self._markerAttribute.setLineWidth(lineWidth)
2536 2537
2538 - def getRadius(self):
2539 return self._markerAttribute.getRadius()
2540 2541
2542 - def setRadius(self, radius):
2543 """Sets radius of the point marker. Defaults to 0. 2544 """ 2545 self._markerAttribute.setRadius(radius)
2546 2547
2548 - def __str__(self):
2549 return ('MarkerState [enabled=' + str(self.getEnabled()) 2550 + ', fillColor=' + str(self.getFillColor()) 2551 + ', lineColor=' + str(self.getLineColor()) 2552 + ', lineWidth=' + str(self.getLineWidth()) 2553 + ', radius=' + str(self.getRadius()) 2554 + ']')
2555
2556 2557 -class Marker(object):
2558 """Defines a marker for a point. Markers are applied to a point of 2559 chart's series. The marker can be applied at the time of drawing the 2560 chart or when a point is selcted or hovered. 2561 2562 There are two types of marker. 2563 * L{SymbolMarker} 2564 * L{ImageMarker} 2565 2566 @author: Invient 2567 @author: Richard Lincoln 2568 2569 @see: L{SymbolMarker} 2570 @see: L{ImageMarker} 2571 """ 2572
2573 - def getEnabled(self):
2574 raise NotImplementedError
2575
2576 - def setEnabled(self, enabled):
2577 raise NotImplementedError
2578
2579 2580 -class AbstractMarker(Marker):
2581 """Defines attributes for a marker. 2582 2583 @author: Invient 2584 @author: Richard Lincoln 2585 2586 @see: L{SymbolMarker} 2587 @see: L{ImageMarker} 2588 """ 2589
2590 - def __init__(self, enabled=True):
2591 self._markerAttribute = MarkerAttribute() 2592 self._markerAttribute.setEnabled(enabled)
2593
2594 - def getLineColor(self):
2595 return self._markerAttribute.getLineColor()
2596
2597 - def setLineColor(self, lineColor):
2598 self._markerAttribute.setLineColor(lineColor)
2599
2600 - def getFillColor(self):
2601 return self._markerAttribute.getFillColor()
2602
2603 - def setFillColor(self, fillColor):
2604 self._markerAttribute.setFillColor(fillColor)
2605
2606 - def getLineWidth(self):
2607 return self._markerAttribute.getLineWidth()
2608
2609 - def setLineWidth(self, lineWidth):
2610 self._markerAttribute.setLineWidth(lineWidth)
2611
2612 - def getRadius(self):
2613 return self._markerAttribute.getRadius()
2614
2615 - def setRadius(self, radius):
2616 self._markerAttribute.setRadius(radius)
2617
2618 - def getEnabled(self):
2619 return self._markerAttribute.getEnabled()
2620
2621 - def setEnabled(self, enabled):
2622 self._markerAttribute.setEnabled(enabled)
2623
2624 2625 -class ImageMarker(AbstractMarker):
2626 """This marker can take url of an image which will be used as a marker 2627 for a point or all points of a series. 2628 2629 The url of an image must be with respect to root of the web application. 2630 2631 @author: Invient 2632 @author: Richard Lincoln 2633 """ 2634
2635 - def __init__(self, imageURL, enabled=True):
2636 """Creates this marker with specified arguments. 2637 2638 @param imageURL: 2639 - URL of an image 2640 @param enabled: 2641 - If false then this marker will not be applied to a 2642 point. What this means is that the data points of a line 2643 chart will not stand out. 2644 """ 2645 super(ImageMarker, self).__init__(enabled) 2646 self._imageURL = imageURL
2647 2648
2649 - def getImageURL(self):
2650 return self._imageURL
2651 2652
2653 - def setImageURL(self, imageURL):
2654 self._imageURL = imageURL
2655 2656
2657 - def __str__(self):
2658 return ('ImageMarker [imageURL=' + str(self._imageURL) 2659 + ', enabled' + str(self.getEnabled()) 2660 + ']')
2661
2662 2663 -class SymbolMarker(AbstractMarker):
2664 """This marker has predefined shape which cannot be changed. However, 2665 marker attributes can be set. 2666 2667 @author: Invient 2668 @author: Richard Lincoln 2669 """ 2670
2671 - def __init__(self, *args):
2672 """Creates this marker with enabled = true 2673 --- 2674 Creates this marker with specified arguments. 2675 2676 @param enabled 2677 If false then this marker will not be applied to a point. 2678 What this means is that the data points of a line chart 2679 will not stand out. 2680 --- 2681 Creates this marker with specified arguments. 2682 2683 @param lineColor 2684 - Color of the point marker's outline 2685 --- 2686 Creates this marker with specified arguments. 2687 2688 @param radius 2689 Radius of the point marker. 2690 --- 2691 Creates this marker with specified arguments. 2692 2693 @param symbol 2694 It must be one of the predefine symbol such as 2695 Symbol.CIRCLE or Symbol.DIAMOND 2696 --- 2697 Creates this marker with specified arguments. 2698 2699 @param lineColor 2700 Color of the point marker's outline 2701 @param radius 2702 Radius of the point marker. 2703 --- 2704 Creates this marker with specified arguments. 2705 2706 @param lineColor 2707 - Color of the point marker's outline 2708 @param radius 2709 Radius of the point marker. 2710 @param symbol 2711 It must be one of the predefine symbol such as 2712 Symbol.CIRCLE or Symbol.DIAMOND 2713 """ 2714 self._symbol = None 2715 self._hoverState = None 2716 self._selectState = None 2717 2718 nargs = len(args) 2719 if nargs == 0: 2720 super(SymbolMarker, self).__init__(True) 2721 elif nargs == 1: 2722 if isinstance(args[0], IPaint): 2723 lineColor, = args 2724 super(SymbolMarker, self).__init__(True) 2725 super(SymbolMarker, self).setLineColor(lineColor) 2726 elif isinstance(args[0], bool): 2727 enabled, = args 2728 super(SymbolMarker, self).__init__(enabled) 2729 elif isinstance(args[0], int): 2730 radius, = args 2731 super(SymbolMarker, self).__init__(True) 2732 self.setRadius(radius) 2733 else: 2734 symbol, = args 2735 super(SymbolMarker, self).__init__(True) 2736 self._symbol = symbol 2737 elif nargs == 2: 2738 lineColor, radius = args 2739 super(SymbolMarker, self).__init__(True) 2740 super(SymbolMarker, self).setLineColor(lineColor) 2741 super(SymbolMarker, self).setRadius(radius) 2742 elif nargs == 3: 2743 lineColor, radius, symbol = args 2744 super(SymbolMarker, self).__init__(True) 2745 super(SymbolMarker, self).setLineColor(lineColor) 2746 super(SymbolMarker, self).setRadius(radius) 2747 self._symbol = symbol 2748 else: 2749 raise ValueError
2750 2751
2752 - def getLineColor(self):
2753 return super(SymbolMarker, self).getLineColor()
2754 2755
2756 - def setLineColor(self, lineColor):
2757 """Sets color of the point marker's outline 2758 """ 2759 super(SymbolMarker, self).setLineColor(lineColor)
2760 2761
2762 - def getFillColor(self):
2763 return super(SymbolMarker, self).getFillColor()
2764 2765
2766 - def setFillColor(self, fillColor):
2767 """Sets color of the point marker 2768 """ 2769 super(SymbolMarker, self).setFillColor(fillColor)
2770 2771
2772 - def getLineWidth(self):
2773 return super(SymbolMarker, self).getLineWidth()
2774 2775
2776 - def setLineWidth(self, lineWidth):
2777 """Sets width of the point marker outline 2778 """ 2779 super(SymbolMarker, self).setLineWidth(lineWidth)
2780 2781
2782 - def getRadius(self):
2783 return super(SymbolMarker, self).getRadius()
2784 2785
2786 - def setRadius(self, radius):
2787 """Sets radius of the point marker 2788 """ 2789 super(SymbolMarker, self).setRadius(radius)
2790 2791
2792 - def getSymbol(self):
2793 return self._symbol
2794 2795
2796 - def setSymbol(self, symbol):
2797 """Sets symbol for the point marker. It must be one of the predefine 2798 symbol such as Symbol.CIRCLE or Symbol.DIAMOND 2799 """ 2800 self._symbol = symbol
2801 2802
2803 - def getHoverState(self):
2804 return self._hoverState
2805 2806
2807 - def setHoverState(self, hoverState):
2808 """Sets marker to be applied to a point when it is hovered. 2809 """ 2810 self._hoverState = hoverState
2811 2812
2813 - def getSelectState(self):
2814 return self._selectState
2815 2816
2817 - def setSelectState(self, selectState):
2818 """Sets marker to be applied to a point when it is selected. 2819 """ 2820 self._selectState = selectState
2821 2822
2823 - def __str__(self):
2824 return ('SymbolMarker [symbol=' + str(self._symbol) 2825 + ', hoverState=' + str(self._hoverState) 2826 + ', selectState=' + str(self._selectState) 2827 + ', getLineColor()=' + str(self.getLineColor()) 2828 + ', getFillColor()=' + str(self.getFillColor()) 2829 + ', getLineWidth()=' + str(self.getLineWidth()) 2830 + ', getRadius()=' + str(self.getRadius()) 2831 + ', getSymbol()=' + str(self.getSymbol()) 2832 + ', getHoverState()=' + str(self.getHoverState()) 2833 + ', getSelectState()=' + str(self.getSelectState()) 2834 + ']')
2835
2836 2837 -class Symbol(object):
2838 """Defines predefined marker shapes to be used along with 2839 L{SymbolMarker} 2840 2841 @author: Invient 2842 @author: Richard Lincoln 2843 2844 @see: L{SymbolMarker} 2845 """ 2846 2847 CIRCLE = None 2848 DIAMOND = None 2849 SQUARE = None 2850 TRIANGLE = None 2851 TRIANGLE_DOWN = None 2852
2853 - def __init__(self, symbol):
2854 self._symbol = symbol
2855
2856 - def getName(self):
2857 return self._symbol
2858 2859 @classmethod
2860 - def values(cls):
2861 return [cls.CIRCLE, cls.DIAMOND, cls.SQUARE, 2862 cls.TRIANGLE, cls.TRIANGLE_DOWN]
2863 2864 Symbol.CIRCLE = Symbol('circle') 2865 Symbol.DIAMOND = Symbol('diamond') 2866 Symbol.SQUARE = Symbol('square') 2867 Symbol.TRIANGLE = Symbol('triangle') 2868 Symbol.TRIANGLE_DOWN = Symbol('triangle-down')
2869 2870 2871 -class Axis(object):
2872
2873 - def getId(self):
2874 pass
2875
2876 - def setId(self, Id):
2877 pass
2878
2879 - def getTick(self):
2880 pass
2881
2882 - def setTick(self, tick):
2883 pass
2884
2885 - def getMaxZoom(self):
2886 pass
2887
2888 - def setMaxZoom(self, maxZoom):
2889 pass
2890
2891 - def getReversed(self):
2892 pass
2893
2894 - def setReversed(self, r):
2895 pass
2896
2897 - def getOpposite(self):
2898 pass
2899
2900 - def setOpposite(self, opposite):
2901 pass
2902
2903 - def getType(self):
2904 pass
2905
2906 - def getTitle(self):
2907 pass
2908
2909 - def setTitle(self, title):
2910 pass
2911
2912 - def getAlternateGridColor(self):
2913 pass
2914
2915 - def setAlternateGridColor(self, alternateGridColor):
2916 pass
2917
2918 - def getEndOnTick(self):
2919 pass
2920
2921 - def setEndOnTick(self, endOnTick):
2922 pass
2923
2924 - def getGrid(self):
2925 pass
2926
2927 - def setGrid(self, grid):
2928 pass
2929
2930 - def getLineColor(self):
2931 pass
2932
2933 - def setLineColor(self, lineColor):
2934 pass
2935
2936 - def getLineWidth(self):
2937 pass
2938
2939 - def setLineWidth(self, lineWidth):
2940 pass
2941
2942 - def getLinkedTo(self):
2943 pass
2944
2945 - def setLinkedTo(self, linkedTo):
2946 pass
2947
2948 - def getMaxPadding(self):
2949 pass
2950
2951 - def setMaxPadding(self, maxPadding):
2952 pass
2953
2954 - def getMinPadding(self):
2955 pass
2956
2957 - def setMinPadding(self, minPadding):
2958 pass
2959
2960 - def getMinorGrid(self):
2961 pass
2962
2963 - def setMinorGrid(self, minorGrid):
2964 pass
2965
2966 - def getMinorTick(self):
2967 pass
2968
2969 - def setMinorTick(self, minorTick):
2970 pass
2971
2972 - def getOffset(self):
2973 pass
2974
2975 - def setOffset(self, offset):
2976 pass
2977
2978 - def getShowFirstLabel(self):
2979 pass
2980
2981 - def setShowFirstLabel(self, showFirstLabel):
2982 pass
2983
2984 - def getShowLastLabel(self):
2985 pass
2986
2987 - def setShowLastLabel(self, showLastLabel):
2988 pass
2989
2990 - def getStartOfWeek(self):
2991 pass
2992
2993 - def setStartOfWeek(self, startOfWeek):
2994 pass
2995
2996 - def getStartOnTick(self):
2997 pass
2998
2999 - def setStartOnTick(self, startOnTick):
3000 pass
3001
3002 3003 -class XAxis(Axis):
3004 pass
3005
3006 3007 -class YAxis(Axis):
3008 pass
3009
3010 3011 -class AxisBase(Axis):
3012 """This class defines attributes common to X axis and Y axis. A chart can 3013 have one or more axis of each type. 3014 3015 @author: chirag 3016 @author: Richard Lincoln 3017 3018 @see: L{XAxis} 3019 @see: L{YAxis} 3020 """ 3021
3022 - def __init__(self):
3023 super(AxisBase, self).__init__() 3024 3025 self._id = None 3026 self._type = AxisType.LINEAR 3027 self._title = None 3028 self._label = None 3029 self._plotBands = OrderedSet() 3030 self._plotLines = OrderedSet() 3031 self._alternateGridColor = None 3032 self._endOnTick = None 3033 self._grid = None 3034 self._lineColor = None 3035 self._lineWidth = None 3036 self._linkedTo = None 3037 self._maxPadding = None 3038 self._maxZoom = None 3039 # private Double max; 3040 # private Double min; 3041 self._minPadding = None 3042 self._tick = None 3043 self._minorGrid = None 3044 self._minorTick = None 3045 self._offset = None 3046 self._opposite = None 3047 self._reversed = None 3048 self._showFirstLabel = None 3049 self._showLastLabel = None 3050 self._startOfWeek = None 3051 self._startOnTick = None
3052 3053
3054 - def getAllPlotBands(self):
3055 return self._plotBands
3056 3057
3058 - def setAllPlotBands(self, plotBands):
3059 if plotBands is not None: 3060 self._plotBands = plotBands
3061 3062
3063 - def addPlotBand(self, plotBand):
3064 self._plotBands.add(plotBand)
3065 3066
3067 - def removePlotBand(self, plotBand_or_id):
3068 """Removes a plotband with given id. 3069 """ 3070 if isinstance(plotBand_or_id, PlotBand): 3071 plotBand = plotBand_or_id 3072 self._plotBands.remove(plotBand) 3073 else: 3074 Id = plotBand_or_id 3075 for pb in set(self._plotBands): 3076 if pb.getId() == Id: 3077 self._plotBands.remove(pb) 3078 break
3079 3080
3081 - def getAllPlotLines(self):
3082 return self._plotLines
3083 3084
3085 - def setAllPlotLines(self, plotLines):
3086 if plotLines is not None: 3087 self._plotLines = plotLines
3088 3089
3090 - def addPlotLine(self, plotLine):
3091 self._plotLines.add(plotLine)
3092 3093
3094 - def removePlotLine(self, plotLine_or_id):
3095 if isinstance(plotLine_or_id, PlotLine): 3096 plotLine = plotLine_or_id 3097 self._plotLines.remove(plotLine) 3098 else: 3099 Id = plotLine_or_id 3100 for i, pl in enumerate(self._plotLines[:]): 3101 if pl.getId() == Id: 3102 del self._plotLines[i] 3103 break
3104 3105
3106 - def getId(self):
3107 return self._id
3108 3109
3110 - def setId(self, Id):
3111 """Sets an id for the axis""" 3112 self._id = Id
3113 3114
3115 - def getTick(self):
3116 return self._tick
3117 3118
3119 - def setTick(self, tick):
3120 """Sets tick for the axis""" 3121 self._tick = tick
3122 3123
3124 - def getMaxZoom(self):
3125 return self._maxZoom
3126 3127
3128 - def setMaxZoom(self, maxZoom):
3129 """Sets maximum amount of zoom for this axis. For datetime axis, the 3130 maxZoom must be specified in milliseconds. For example, for a 3131 datetime axis the main unit is milliseconds. If maxZoom is set to 3132 3600000, you can't zoom in more than to one hour. (Above example is 3133 taken from Highcharts documentation) 3134 """ 3135 self._maxZoom = maxZoom
3136 3137
3138 - def getReversed(self):
3139 return self._reversed
3140 3141
3142 - def setReversed(self, r):
3143 """If the argument it true then this axis will be reversed. Defaults 3144 to false. 3145 """ 3146 self._reversed = r
3147 3148
3149 - def getOpposite(self):
3150 return self._opposite
3151 3152
3153 - def setOpposite(self, opposite):
3154 """If the argument is true then another axis on the opposite side of 3155 this axis will be displayed. The normal axis is on left side for 3156 vertical axes and bottom for horzontal axes. 3157 """ 3158 self._opposite = opposite
3159 3160
3161 - def getType(self):
3162 return self._type
3163 3164
3165 - def setType(self, typ):
3166 """Sets type of this axis. Used by subclasses 3167 3168 @see: L{NumberXAxis} 3169 @see: L{NumberYAxis} 3170 @see: L{DateTimeAxis} 3171 """ 3172 self._type = typ
3173 3174
3175 - def getTitle(self):
3176 return self._title
3177 3178
3179 - def setTitle(self, title):
3180 """Sets title for the axis 3181 3182 @see: L{AxisTitle} 3183 """ 3184 self._title = title
3185 3186
3187 - def getLabel(self):
3188 return self._label
3189 3190
3191 - def setLabel(self, label):
3192 self._label = label
3193 3194
3195 - def getAlternateGridColor(self):
3196 return self._alternateGridColor
3197 3198
3199 - def setAlternateGridColor(self, alternateGridColor):
3200 """Sets a color to be used for alternate grids of the chart""" 3201 self._alternateGridColor = alternateGridColor
3202 3203
3204 - def getEndOnTick(self):
3205 return self._endOnTick
3206 3207
3208 - def setEndOnTick(self, endOnTick):
3209 """If the argument is true then this axis will end on a tick.""" 3210 self._endOnTick = endOnTick
3211 3212
3213 - def getGrid(self):
3214 return self._grid
3215 3216
3217 - def setGrid(self, grid):
3218 """Sets grid for this axis 3219 3220 @see: L{Grid} 3221 """ 3222 self._grid = grid
3223 3224
3225 - def getLineColor(self):
3226 return self._lineColor
3227 3228
3229 - def setLineColor(self, lineColor):
3230 """Sets a color for line of this axis. This line indicate this axis""" 3231 self._lineColor = lineColor
3232 3233
3234 - def getLineWidth(self):
3235 return self._lineWidth
3236 3237
3238 - def setLineWidth(self, lineWidth):
3239 """Sets width of this axis line""" 3240 self._lineWidth = lineWidth
3241 3242
3243 - def getLinkedTo(self):
3244 return self._linkedTo
3245 3246
3247 - def setLinkedTo(self, linkedTo):
3248 """Sets another axis which is linked with this axis. The following 3249 description is copied from Highcharts API documentation 3250 U{http://www.highcharts.com/ref/#xAxis}. 3251 3252 When an axis is linked to a master axis, it will take the same 3253 extremes as the master, but as assigned by min or max or by 3254 setExtremes. It can be used to show additional info, or to ease 3255 reading the chart by duplicating the scales. Defaults to null. 3256 """ 3257 if linkedTo is not self: 3258 self._linkedTo = linkedTo
3259 3260
3261 - def getMaxPadding(self):
3262 return self._maxPadding
3263 3264
3265 - def setMaxPadding(self, maxPadding):
3266 self._maxPadding = maxPadding
3267 3268
3269 - def getMinPadding(self):
3270 return self._minPadding
3271 3272
3273 - def setMinPadding(self, minPadding):
3274 self._minPadding = minPadding
3275 3276
3277 - def getMinorGrid(self):
3278 return self._minorGrid
3279 3280
3281 - def setMinorGrid(self, minorGrid):
3282 self._minorGrid = minorGrid
3283 3284
3285 - def getMinorTick(self):
3286 return self._minorTick
3287 3288
3289 - def setMinorTick(self, minorTick):
3290 self._minorTick = minorTick
3291 3292
3293 - def getOffset(self):
3294 return self._offset
3295 3296
3297 - def setOffset(self, offset):
3298 """Sets distance of this axis from the plot area""" 3299 self._offset = offset
3300 3301
3302 - def getShowFirstLabel(self):
3303 return self._showFirstLabel
3304 3305
3306 - def setShowFirstLabel(self, showFirstLabel):
3307 """If the argument is true then the label of this axis' first tick 3308 will be displayed. Defaults to true. 3309 """ 3310 self._showFirstLabel = showFirstLabel
3311 3312
3313 - def getShowLastLabel(self):
3314 return self._showLastLabel
3315 3316
3317 - def setShowLastLabel(self, showLastLabel):
3318 """If the argument is true then the label of this axis' last tick 3319 will be displayed. Defaults to false 3320 """ 3321 self._showLastLabel = showLastLabel
3322 3323
3324 - def getStartOfWeek(self):
3325 return self._startOfWeek
3326 3327
3328 - def setStartOfWeek(self, startOfWeek):
3329 """Sets a day to be considered as start of the week. For datetime axis, 3330 this decides where to put tick. e.g. if startOfWeek = THURSDAY then 3331 tick will be placed on every thursday. 3332 """ 3333 self._startOfWeek = startOfWeek
3334 3335
3336 - def getStartOnTick(self):
3337 return self._startOnTick
3338 3339
3340 - def setStartOnTick(self, startOnTick):
3341 """If the argument is true then this axis must start on a tick. 3342 Defaults to false. 3343 """ 3344 self._startOnTick = startOnTick
3345
3346 3347 -class MinorTick(object):
3348 """Defines attributes of a minor tick. The minor ticks do not have a 3349 label. By default, minor ticks are not shown. To display minor ticks, 3350 set interval property. 3351 3352 @author: Invient 3353 @author: Richard Lincoln 3354 3355 @see: L{Tick} 3356 """ 3357
3358 - def __init__(self):
3359 self._color = None 3360 self._interval = None 3361 self._length = None 3362 self._position = None 3363 self._width = None
3364 3365
3366 - def getColor(self):
3367 return self._color
3368 3369
3370 - def setColor(self, color):
3371 self._color = color
3372 3373
3374 - def getInterval(self):
3375 return self._interval
3376 3377
3378 - def setInterval(self, interval):
3379 """Sets interval for the minor tick. The interval must be specified 3380 in the axis unit. e.g. If an axis has tick interval of 50 units 3381 then setting minortick interval to 10 will show 5 minor ticks. 3382 """ 3383 self._interval = interval
3384 3385
3386 - def getLength(self):
3387 return self._length
3388 3389
3390 - def setLength(self, length):
3391 """Sets length of the minorticks in pixel 3392 """ 3393 self._length = length
3394 3395
3396 - def getPosition(self):
3397 return self._position
3398 3399
3400 - def setPosition(self, position):
3401 self._position = position
3402 3403
3404 - def getWidth(self):
3405 return self._width
3406 3407
3408 - def setWidth(self, width):
3409 """Sets width of the minorticks in pixel 3410 """ 3411 self._width = width
3412 3413
3414 - def __str__(self):
3415 return ('MinorTick [color=' + str(self._color) 3416 + ', length=' + str(self._length) 3417 + ', position=' + str(self._position) 3418 + ', width=' + str(self._width) 3419 + ']')
3420
3421 3422 -class Tick(MinorTick):
3423 """Defines attributes of a tick marks. The interval of the tick marks 3424 must be specified in axis unit. For datetime axis, the interval must 3425 be in millisecond. 3426 3427 The default tick interval is 1. 3428 3429 @author: Invient 3430 @author: Richard Lincoln 3431 3432 @see: L{MinorTick} 3433 @see: L{TickmarkPlacement} 3434 """ 3435
3436 - def __init__(self):
3437 super(Tick, self).__init__() 3438 self._placement = None 3439 self._pixelInterval = None
3440 3441
3442 - def getPlacement(self):
3443 return self._placement
3444 3445
3446 - def setPlacement(self, placement):
3447 """Sets placement of the tick marks. 3448 """ 3449 self._placement = placement
3450 3451
3452 - def getPixelInterval(self):
3453 return self._pixelInterval
3454 3455
3456 - def setPixelInterval(self, pixelInterval):
3457 """Sets pixel interval of the tick marks 3458 """ 3459 self._pixelInterval = pixelInterval
3460 3461
3462 - def __str__(self):
3463 return ('Tick [placement=' + str(self._placement) 3464 + ', pixelInterval=' + str(self._pixelInterval) 3465 + ', getColor()=' + str(self.getColor()) 3466 + ', getLength()=' + str(self.getLength()) 3467 + ', getPosition()=' + str(self.getPosition()) 3468 + ', getWidth()=' + str(self.getWidth()) 3469 + ']')
3470
3471 3472 -class MinorGrid(object):
3473 """Defines attributes of minor grid lines of the chart. In order to show 3474 minor grid lines, you must specify set MinorTick for the axis also. 3475 3476 @author: Invient 3477 @author: Richard Lincoln 3478 3479 @see: L{MinorTick} 3480 @see: L{Grid} 3481 """ 3482
3483 - def __init__(self):
3484 self._lineColor = None 3485 self._lineDashStyle = None 3486 self._lineWidth = None
3487 3488
3489 - def getLineColor(self):
3490 return self._lineColor
3491 3492
3493 - def setLineColor(self, lineColor):
3494 """Sets color of the minor grid lines 3495 """ 3496 self._lineColor = lineColor
3497 3498
3499 - def getLineDashStyle(self):
3500 """@return""" 3501 return self._lineDashStyle
3502 3503
3504 - def setLineDashStyle(self, lineDashStyle):
3505 """Sets dash or dot style of the minor grid lines. Defaults to 3506 DashStyle.SOLID 3507 3508 @see: L{DashStyle} 3509 """ 3510 self._lineDashStyle = lineDashStyle
3511 3512
3513 - def getLineWidth(self):
3514 """@return""" 3515 return self._lineWidth
3516 3517
3518 - def setLineWidth(self, lineWidth):
3519 """Sets width (in pixel) of the minor grid lines. Defaults to 1 3520 """ 3521 self._lineWidth = lineWidth
3522 3523
3524 - def __str__(self):
3525 return ('MinorGrid [lineColor=' + str(self._lineColor) 3526 + ', lineDashStyle=' + str(self._lineDashStyle) 3527 + ', lineWidth=' + str(self._lineWidth) 3528 + ']')
3529
3530 3531 -class Grid(MinorGrid):
3532 """Defines attributes of grid lines of the chart. By default, the grid 3533 lines are shown. To hide them set property lineWidth to 0. 3534 3535 @author: Invient 3536 @author: Richard Lincoln 3537 """ 3538 pass
3539
3540 3541 -class WeekDay(object):
3542 3543 SUNDAY = 'SUNDAY' 3544 MONDAY = 'MONDAY' 3545 TUESDAY = 'TUESDAY' 3546 WEDNESDAY = 'WEDNESDAY' 3547 THURSDAY = 'THURSDAY' 3548 FRIDAY = 'FRIDAY' 3549 SATURDAY = 'SATURDAY' 3550 3551 _values = [SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY] 3552 3553 @classmethod
3554 - def values(cls):
3555 return cls._values[:]
3556
3557 3558 -class TickmarkPlacement(object):
3559 """Defines position of the tick marks with respect to the axis 3560 categories. It is applicable only for categorized axes. 3561 3562 TickmarkPlacement.ON - tick mark is placed in the center of the 3563 category 3564 3565 TickmarkPlacement.BETWEEN - tick mark is placed between categories 3566 3567 @author: Invient 3568 @author: Richard Lincoln 3569 """ 3570 3571 ON = None 3572 BETWEEN = None 3573
3574 - def __init__(self, name):
3575 self._name = name
3576
3577 - def getName(self):
3578 return self._name
3579 3580 @classmethod
3581 - def values(cls):
3582 return [cls.ON, cls.BETWEEN]
3583 3584 TickmarkPlacement.ON = TickmarkPlacement('on') 3585 TickmarkPlacement.BETWEEN = TickmarkPlacement('between')
3586 3587 3588 -class TickPosition(object):
3589 """Defines position of the axis ticks with respect to the axis line 3590 3591 @author: Invient 3592 @author: Richard Lincoln 3593 """ 3594 3595 OUTSIDE = None 3596 INSIDE = None 3597
3598 - def __init__(self, name):
3599 self._name = name
3600
3601 - def getName(self):
3602 return self._name
3603 3604 @classmethod
3605 - def values(cls):
3606 return [cls.OUTSIDE, cls.INSIDE]
3607 3608 TickPosition.OUTSIDE = TickPosition('outside') 3609 TickPosition.INSIDE = TickPosition('inside')
3610 3611 3612 -class AxisType(object):
3613 """Defines axis types. 3614 3615 AxisType.LINEAR - 3616 3617 AxisType.DATETIME - For datetime axis, the values are given in date 3618 except for L{BaseLineConfig.pointStart} and L{BaseLineConfig.pointInterval} 3619 properties, which are specified in milliseconds. 3620 3621 @author: Invient 3622 @author: Richard Lincoln 3623 3624 @see: L{NumberXAxis} 3625 @see: L{NumberYAxis} 3626 @see: L{DateTimeAxis} 3627 """ 3628 3629 LINEAR = None 3630 DATETIME = None 3631
3632 - def __init__(self, typ):
3633 self._type = typ
3634
3635 - def getName(self):
3636 return self._type
3637 3638 @classmethod
3639 - def values(cls):
3640 return [cls.LINEAR, cls.DATETIME]
3641 3642 AxisType.LINEAR = AxisType('linear') 3643 AxisType.DATETIME = AxisType('datetime')
3644 3645 3646 -class AxisTitleAlign(object):
3647 3648 LOW = ['low'] 3649 MIDDLE = ['middle'] 3650 HIGH = ['high'] 3651
3652 - def __init__(self, name):
3653 self._name = name
3654
3655 - def getName(self):
3656 return self._name
3657 3658 @classmethod
3659 - def values(cls):
3660 return [cls.LOW, cls.MIDDLE, cls.HIGH]
3661 3662 AxisTitleAlign.LOW = AxisTitleAlign('low') 3663 AxisTitleAlign.MIDDLE = AxisTitleAlign('middle') 3664 AxisTitleAlign.HIGH = AxisTitleAlign('high')
3665 3666 3667 -class AxisTitle(object):
3668
3669 - def __init__(self, text):
3670 self._text = text 3671 self._align = None 3672 self._style = None 3673 self._rotation = None 3674 self._margin = None
3675
3676 - def getText(self):
3677 return self._text
3678
3679 - def setText(self, text):
3680 self._text = text
3681
3682 - def getAlign(self):
3683 return self._align
3684
3685 - def setAlign(self, align):
3686 self._align = align
3687
3688 - def getStyle(self):
3689 return self._style
3690
3691 - def setStyle(self, style):
3692 self._style = style
3693
3694 - def getRotation(self):
3695 return self._rotation
3696
3697 - def setRotation(self, rotation):
3698 self._rotation = rotation
3699
3700 - def getMargin(self):
3701 return self._margin
3702
3703 - def setMargin(self, margin):
3704 self._margin = margin
3705
3706 3707 -class PlotLabel(object):
3708
3709 - def __init__(self, text):
3710 super(PlotLabel, self).__init__() 3711 self._text = text 3712 self._align = None 3713 self._vertAlign = None 3714 self._rotation = None 3715 self._style = None 3716 self._textAlign = None 3717 self._x = None 3718 self._y = None
3719
3720 - def getText(self):
3721 return self._text
3722
3723 - def setText(self, text):
3724 self._text = text
3725
3726 - def getAlign(self):
3727 return self._align
3728
3729 - def setAlign(self, align):
3730 self._align = align
3731
3732 - def getVertAlign(self):
3733 return self._vertAlign
3734
3735 - def setVertAlign(self, vertAlign):
3736 self._vertAlign = vertAlign
3737
3738 - def getRotation(self):
3739 return self._rotation
3740
3741 - def setRotation(self, rotation):
3742 self._rotation = rotation
3743
3744 - def getStyle(self):
3745 return self._style
3746
3747 - def setStyle(self, style):
3748 self._style = style
3749
3750 - def getTextAlign(self):
3751 return self._textAlign
3752
3753 - def setTextAlign(self, textAlign):
3754 self._textAlign = textAlign
3755
3756 - def getX(self):
3757 return self._x
3758
3759 - def setX(self, x):
3760 self._x = x
3761
3762 - def getY(self):
3763 return self._y
3764
3765 - def setY(self, y):
3766 self._y = y
3767
3768 3769 -class PlotBand(object):
3770
3771 - def __init__(self, Id):
3772 self._id = Id 3773 self._color = None 3774 self._range = None 3775 self._zIndex = None 3776 self._label = None
3777
3778 - def getColor(self):
3779 return self._color
3780
3781 - def setColor(self, color):
3782 self._color = color
3783
3784 - def getRange(self):
3785 return self._range
3786
3787 - def setRange(self, rng):
3788 self._range = rng
3789
3790 - def getId(self):
3791 return self._id
3792
3793 - def getZIndex(self):
3794 return self._zIndex
3795
3796 - def setZIndex(self, zIndex):
3797 self._zIndex = zIndex
3798
3799 - def getLabel(self):
3800 return self._label
3801
3802 - def setLabel(self, label):
3803 self._label = label
3804
3805 - def __hash__(self):
3806 prime = 31 3807 result = 1 3808 result = (prime * result) + (0 if self._id is None else self._id.__hash__()) 3809 return result
3810
3811 - def __eq__(self, obj):
3812 if self is obj: 3813 return True 3814 if obj is None: 3815 return False 3816 if self.getClass() != obj.getClass(): 3817 return False 3818 other = obj 3819 if self._id is None: 3820 if other.id is not None: 3821 return False 3822 elif not (self._id == other.id): 3823 return False 3824 return True
3825
3826 3827 -class Range(object):
3828 pass
3829
3830 3831 -class NumberPlotBand(PlotBand):
3832
3833 - def __init__(self, Id):
3834 super(NumberPlotBand, self).__init__(Id)
3835
3836 - def getRange(self):
3837 return super(NumberPlotBand, self).getRange()
3838
3839 - def setRange(self, rang):
3840 super(NumberPlotBand, self).setRange(rang)
3841
3842 3843 -class NumberRange(Range):
3844
3845 - def __init__(self, from_, to):
3846 super(NumberRange, self).__init__() 3847 self._from = from_ 3848 self._to = to
3849
3850 - def getFrom(self):
3851 return self._from
3852
3853 - def setFrom(self, from_):
3854 self._from = from_
3855
3856 - def getTo(self):
3857 return self._to
3858
3859 - def setTo(self, to):
3860 self._to = to
3861
3862 3863 -class DateTimePlotBand(PlotBand):
3864
3865 - def __init__(self, Id):
3866 super(DateTimePlotBand, self).__init__(Id)
3867
3868 - def getRange(self):
3869 return super(DateTimePlotBand, self).getRange()
3870
3871 - def setRange(self, rang):
3872 super(DateTimePlotBand, self).setRange(rang)
3873
3874 3875 -class DateTimeRange(Range):
3876
3877 - def __init__(self, from_, to):
3878 super(DateTimeRange, self).__init__() 3879 self._from = from_ 3880 self._to = to
3881
3882 - def getFrom(self):
3883 return self._from
3884
3885 - def setFrom(self, from_):
3886 self._from = from_
3887
3888 - def getTo(self):
3889 return self._to
3890
3891 - def setTo(self, to):
3892 self._to = to
3893
3894 3895 -class PlotLine(object):
3896
3897 - def __init__(self, Id):
3898 self._id = Id 3899 self._color = None 3900 self._dashStyle = None 3901 self._value = None 3902 self._width = 1 3903 self._zIndex = None 3904 self._label = None
3905
3906 - def getColor(self):
3907 return self._color
3908
3909 - def setColor(self, color):
3910 self._color = color
3911
3912 - def getDashStyle(self):
3913 return self._dashStyle
3914
3915 - def setDashStyle(self, dashStyle):
3916 self._dashStyle = dashStyle
3917
3918 - def getId(self):
3919 return self._id
3920
3921 - def setId(self, Id):
3922 self._id = Id
3923
3924 - def getValue(self):
3925 return self._value
3926
3927 - def setValue(self, value):
3928 self._value = value
3929
3930 - def getWidth(self):
3931 return self._width
3932
3933 - def setWidth(self, width):
3934 self._width = width
3935
3936 - def getZIndex(self):
3937 return self._zIndex
3938
3939 - def setZIndex(self, zIndex):
3940 self._zIndex = zIndex
3941
3942 - def getLabel(self):
3943 return self._label
3944
3945 - def setLabel(self, label):
3946 self._label = label
3947
3948 3949 -class Value(object):
3950 pass
3951
3952 3953 -class NumberPlotLine(PlotLine):
3954
3955 - def __init__(self, Id):
3956 super(NumberPlotLine, self).__init__(Id)
3957
3958 - def getValue(self):
3959 return super(NumberPlotLine, self).getValue()
3960
3961 - def setValue(self, value):
3962 super(NumberPlotLine, self).setValue(value)
3963
3964 3965 -class NumberValue(Value):
3966
3967 - def __init__(self, value):
3968 super(NumberValue, self).__init__() 3969 self._value = value
3970
3971 - def getValue(self):
3972 return self._value
3973
3974 - def setValue(self, value):
3975 self._value = value
3976
3977 3978 -class DateTimePlotLine(PlotLine):
3979
3980 - def __init__(self, Id):
3981 super(DateTimePlotLine, self).__init__(Id)
3982
3983 - def getValue(self):
3984 return super(DateTimePlotLine, self).getValue()
3985
3986 - def setValue(self, value):
3987 super(DateTimePlotLine, self).setValue(value)
3988
3989 3990 -class DateTimeValue(Value):
3991
3992 - def __init__(self, value):
3993 super(DateTimeValue, self).__init__() 3994 self._value = value
3995
3996 - def getValue(self):
3997 return self._value
3998
3999 - def setValue(self, value):
4000 self._value = value
4001
4002 4003 -class NumberAxis(AxisBase):
4004
4005 - def __init__(self):
4006 super(NumberAxis, self).__init__() 4007 super(NumberAxis, self).setType(AxisType.LINEAR) 4008 self._allowDecimals = None 4009 self._max = None 4010 self._min = None
4011
4012 - def getAllowDecimals(self):
4013 return self._allowDecimals
4014
4015 - def setAllowDecimals(self, allowDecimals):
4016 self._allowDecimals = allowDecimals
4017
4018 - def setMax(self, mx):
4019 self._max = mx
4020
4021 - def setMin(self, mn):
4022 self._min = mn
4023
4024 - def getMin(self):
4025 return self._min
4026
4027 - def getMax(self):
4028 return self._max
4029
4030 - def getPlotBands(self):
4031 return super(NumberAxis, self).getAllPlotBands()
4032
4033 - def setPlotBands(self, plotBands):
4034 super(NumberAxis, self).setAllPlotBands(plotBands)
4035
4036 - def addPlotBand(self, plotBand):
4037 super(NumberAxis, self).addPlotBand(plotBand)
4038
4039 - def removePlotBand(self, plotBand):
4040 super(NumberAxis, self).removePlotBand(plotBand)
4041
4042 - def getPlotLines(self):
4043 return super(NumberAxis, self).getAllPlotLines()
4044
4045 - def setPlotLines(self, plotLines):
4046 super(NumberAxis, self).setAllPlotLines(plotLines)
4047
4048 - def addPlotLine(self, plotLine):
4049 super(NumberAxis, self).addPlotLine(plotLine)
4050
4051 - def removePlotLine(self, plotLine):
4052 super(NumberAxis, self).removePlotLine(plotLine)
4053
4054 4055 -class NumberXAxis(NumberAxis, XAxis):
4056
4057 - def setLabel(self, label):
4058 super(NumberXAxis, self).setLabel(label)
4059
4060 - def getLabel(self):
4061 return super(NumberXAxis, self).getLabel()
4062
4063 4064 -class NumberYAxis(NumberAxis, YAxis):
4065
4066 - def setLabel(self, label):
4067 super(NumberYAxis, self).setLabel(label)
4068
4069 - def getLabel(self):
4070 return super(NumberYAxis, self).getLabel()
4071
4072 4073 -class DateTimeAxis(AxisBase, XAxis):
4074
4075 - def __init__(self):
4076 super(DateTimeAxis, self).__init__() 4077 super(DateTimeAxis, self).setType(AxisType.DATETIME) 4078 self._dateTimeLabelFormats = None 4079 self._max = None 4080 self._min = None
4081
4082 - def getDateTimeLabelFormat(self):
4083 return self._dateTimeLabelFormats
4084
4085 - def setDateTimeLabelFormat(self, dateTimeLabelFormat):
4086 self._dateTimeLabelFormats = dateTimeLabelFormat
4087
4088 - def setMax(self, mx):
4089 self._max = mx
4090
4091 - def setMin(self, mn):
4092 self._min = mn
4093
4094 - def getMin(self):
4095 return self._min
4096
4097 - def getMax(self):
4098 return self._max
4099
4100 - def getPlotBands(self):
4101 return super(DateTimeAxis, self).getAllPlotBands()
4102
4103 - def setPlotBands(self, plotBands):
4104 super(DateTimeAxis, self).setAllPlotBands(plotBands)
4105
4106 - def addPlotBand(self, plotBand):
4107 super(DateTimeAxis, self).addPlotBand(plotBand)
4108
4109 - def removePlotBand(self, plotBand):
4110 super(DateTimeAxis, self).removePlotBand(plotBand)
4111
4112 - def getPlotLines(self):
4113 return super(DateTimeAxis, self).getAllPlotLines()
4114
4115 - def setPlotLines(self, plotLines):
4116 super(DateTimeAxis, self).setAllPlotLines(plotLines)
4117
4118 - def addPlotLine(self, plotLine):
4119 super(DateTimeAxis, self).addPlotLine(plotLine)
4120
4121 - def removePlotLine(self, plotLine):
4122 super(DateTimeAxis, self).removePlotLine(plotLine)
4123
4124 4125 -class DateTimeLabelFormat(object):
4126 - def __init__(self):
4127 self._second = '%H:%M:%S' 4128 self._minute = '%H:%M' 4129 self._hour = '%H:%M' 4130 self._day = '%e. %b' 4131 self._week = '%e. %b' 4132 self._month = '%b \'%y' 4133 self._year = '%Y'
4134
4135 - def getSecond(self):
4136 return self._second
4137
4138 - def setSecond(self, second):
4139 self._second = second
4140
4141 - def getMinute(self):
4142 return self._minute
4143
4144 - def setMinute(self, minute):
4145 self._minute = minute
4146
4147 - def getHour(self):
4148 return self._hour
4149
4150 - def setHour(self, hour):
4151 self._hour = hour
4152
4153 - def getDay(self):
4154 return self._day
4155
4156 - def setDay(self, day):
4157 self._day = day
4158
4159 - def getWeek(self):
4160 return self._week
4161
4162 - def setWeek(self, week):
4163 self._week = week
4164
4165 - def getMonth(self):
4166 return self._month
4167
4168 - def setMonth(self, month):
4169 self._month = month
4170
4171 - def getYear(self):
4172 return self._year
4173
4174 - def setYear(self, year):
4175 self._year = year
4176
4177 - def __str__(self):
4178 return ('DateTimeLabelFormat [second=' + self._second 4179 + ', minute=' + self._minute 4180 + ', hour=' + self._hour 4181 + ', day=' + self._day 4182 + ', week=' + self._week 4183 + ', month=' + self._month 4184 + ', year=' + self._year + ']')
4185
4186 4187 -class CategoryAxis(AxisBase, XAxis):
4188
4189 - def __init__(self):
4190 super(CategoryAxis, self).__init__() 4191 self._categories = list()
4192
4193 - def getCategories(self):
4194 return self._categories
4195
4196 - def setCategories(self, categories):
4197 if categories is not None: 4198 self._categories = categories
4199
4200 - def setLabel(self, label):
4201 super(CategoryAxis, self).setLabel(label)
4202
4203 - def getLabel(self):
4204 return super(CategoryAxis, self).getLabel()
4205
4206 - def getPlotBands(self):
4207 return super(CategoryAxis, self).getAllPlotBands()
4208
4209 - def setPlotBands(self, plotBands):
4210 super(CategoryAxis, self).setAllPlotBands(plotBands)
4211
4212 - def addPlotBand(self, plotBand):
4213 super(CategoryAxis, self).addPlotBand(plotBand)
4214
4215 - def removePlotBand(self, plotBand):
4216 super(CategoryAxis, self).removePlotBand(plotBand)
4217
4218 - def getPlotLines(self):
4219 return super(CategoryAxis, self).getAllPlotLines()
4220
4221 - def setPlotLines(self, plotLines):
4222 super(CategoryAxis, self).setAllPlotLines(plotLines)
4223
4224 - def addPlotLine(self, plotLine):
4225 super(CategoryAxis, self).addPlotLine(plotLine)
4226
4227 - def removePlotLine(self, plotLine):
4228 super(CategoryAxis, self).removePlotLine(plotLine)
4229
4230 4231 -class Legend(object):
4232
4233 - def __init__(self, enabled=True):
4234 self._backgroundColor = None 4235 self._borderColor = None 4236 self._borderRadius = None 4237 self._borderWidth = None 4238 self._enabled = enabled 4239 self._floating = None 4240 self._itemHiddenStyle = None 4241 self._itemHoverStyle = None 4242 self._itemStyle = None 4243 self._itemWidth = None 4244 self._layout = None 4245 self._labelFormatterJsFunc = None 4246 self._margin = None 4247 self._reversed = None 4248 self._shadow = None 4249 self._symbolPadding = None 4250 self._symbolWidth = None 4251 self._width = None 4252 self._position = None
4253
4254 - def getBackgroundColor(self):
4255 return self._backgroundColor
4256
4257 - def setBackgroundColor(self, backgroundColor):
4258 self._backgroundColor = backgroundColor
4259
4260 - def getBorderColor(self):
4261 return self._borderColor
4262
4263 - def setBorderColor(self, borderColor):
4264 self._borderColor = borderColor
4265
4266 - def getBorderRadius(self):
4267 return self._borderRadius
4268
4269 - def setBorderRadius(self, borderRadius):
4270 self._borderRadius = borderRadius
4271
4272 - def getBorderWidth(self):
4273 return self._borderWidth
4274
4275 - def setBorderWidth(self, borderWidth):
4276 self._borderWidth = borderWidth
4277
4278 - def getEnabled(self):
4279 return self._enabled
4280
4281 - def setEnabled(self, enabled):
4282 self._enabled = enabled
4283
4284 - def getFloating(self):
4285 return self._floating
4286
4287 - def setFloating(self, floating):
4288 self._floating = floating
4289
4290 - def getItemHiddenStyle(self):
4291 return self._itemHiddenStyle
4292
4293 - def setItemHiddenStyle(self, itemHiddenStyle):
4294 self._itemHiddenStyle = itemHiddenStyle
4295
4296 - def getItemHoverStyle(self):
4297 return self._itemHoverStyle
4298
4299 - def setItemHoverStyle(self, itemHoverStyle):
4300 self._itemHoverStyle = itemHoverStyle
4301
4302 - def getItemStyle(self):
4303 return self._itemStyle
4304
4305 - def setItemStyle(self, itemStyle):
4306 self._itemStyle = itemStyle
4307
4308 - def getItemWidth(self):
4309 return self._itemWidth
4310
4311 - def setItemWidth(self, itemWidth):
4312 self._itemWidth = itemWidth
4313
4314 - def getLayout(self):
4315 return self._layout
4316
4317 - def setLayout(self, layout):
4318 self._layout = layout
4319
4320 - def getLabelFormatterJsFunc(self):
4321 return self._labelFormatterJsFunc
4322
4323 - def setLabelFormatterJsFunc(self, labelFormatterJsFunc):
4324 self._labelFormatterJsFunc = labelFormatterJsFunc
4325
4326 - def getMargin(self):
4327 return self._margin
4328
4329 - def setMargin(self, margin):
4330 self._margin = margin
4331
4332 - def getReversed(self):
4333 return self._reversed
4334
4335 - def setReversed(self, r):
4336 self._reversed = r
4337
4338 - def getShadow(self):
4339 return self._shadow
4340
4341 - def setShadow(self, shadow):
4342 self._shadow = shadow
4343
4344 - def getSymbolPadding(self):
4345 return self._symbolPadding
4346
4347 - def setSymbolPadding(self, symbolPadding):
4348 self._symbolPadding = symbolPadding
4349
4350 - def getSymbolWidth(self):
4351 return self._symbolWidth
4352
4353 - def setSymbolWidth(self, symbolWidth):
4354 self._symbolWidth = symbolWidth
4355
4356 - def getWidth(self):
4357 return self._width
4358
4359 - def setWidth(self, width):
4360 self._width = width
4361
4362 - def getPosition(self):
4363 return self._position
4364
4365 - def setPosition(self, position):
4366 self._position = position
4367
4368 - def __str__(self):
4369 return ('Legend [backgroundColor=' + str(self._backgroundColor) 4370 + ', borderColor=' + str(self._borderColor) 4371 + ', borderRadius=' + str(self._borderRadius) 4372 + ', borderWidth=' + str(self._borderWidth) 4373 + ', enabled=' + str(self._enabled) 4374 + ', floating=' + str(self._floating) 4375 + ', itemHiddenStyle=' + str(self._itemHiddenStyle) 4376 + ', itemHoverStyle=' + str(self._itemHoverStyle) 4377 + ', itemStyle=' + str(self._itemStyle) 4378 + ', itemWidth=' + str(self._itemWidth) 4379 + ', layout=' + str(self._layout) 4380 + ', labelFormatter=' + str(self._labelFormatterJsFunc) 4381 + ', margin=' + str(self._margin) 4382 + ', reversed=' + str(self._reversed) 4383 + ', shadow=' + str(self._shadow) 4384 + ', symbolPadding=' + str(self._symbolPadding) 4385 + ', symbolWidth=' + str(self._symbolWidth) 4386 + ', width=' + str(self._width) 4387 + ', position=' + str(self._position) 4388 + ']')
4389
4390 4391 -class Layout(object):
4392 4393 HORIZONTAL = None 4394 VERTICAL = None 4395
4396 - def __init__(self, name):
4397 self._name = name
4398
4399 - def getName(self):
4400 return self._name
4401 4402 @classmethod
4403 - def values(cls):
4404 return [cls.HORIZONTAL, cls.VERTICAL]
4405 4406 Layout.HORIZONTAL = Layout('horizontal') 4407 Layout.VERTICAL = Layout('vertical')
4408 4409 4410 -class Credit(object):
4411
4412 - def __init__(self):
4413 self._enabled = None 4414 self._link = None 4415 self._style = None 4416 self._text = None 4417 self._position = None
4418
4419 - def getEnabled(self):
4420 return self._enabled
4421
4422 - def setEnabled(self, enabled):
4423 self._enabled = enabled
4424 4427 4430
4431 - def getStyle(self):
4432 return self._style
4433
4434 - def setStyle(self, style):
4435 self._style = style
4436
4437 - def getText(self):
4438 return self._text
4439
4440 - def setText(self, text):
4441 self._text = text
4442
4443 - def getPosition(self):
4444 return self._position
4445
4446 - def setPosition(self, position):
4447 self._position = position
4448
4449 - def __str__(self):
4450 return ('Credit [enabled=' + str(self._enabled) 4451 + ', link=' + str(self._link) 4452 + ', style=' + str(self._style) 4453 + ', text=' + str(self._text) 4454 + ', position=' + str(self._position) 4455 + ']')
4456
4457 4458 -class Position(object):
4459
4460 - def __init__(self):
4461 self._align = None 4462 self._vertAlign = None 4463 self._x = None 4464 self._y = None
4465
4466 - def getAlign(self):
4467 return self._align
4468
4469 - def setAlign(self, align):
4470 self._align = align
4471
4472 - def getVertAlign(self):
4473 return self._vertAlign
4474
4475 - def setVertAlign(self, vertAlign):
4476 self._vertAlign = vertAlign
4477
4478 - def getX(self):
4479 return self._x
4480
4481 - def setX(self, x):
4482 self._x = x
4483
4484 - def getY(self):
4485 return self._y
4486
4487 - def setY(self, y):
4488 self._y = y
4489
4490 - def __str__(self):
4491 return ('Position [align=' + str(self._align) 4492 + ', vertAlign=' + str(self._vertAlign) 4493 + ', x=' + str(self._x) 4494 + ', y=' + str(self._y) + ']')
4495
4496 4497 -class Tooltip(object):
4498
4499 - def __init__(self):
4500 self._backgroundColor = None 4501 self._borderColor = None 4502 self._borderRadius = None 4503 self._borderWidth = None 4504 self._crosshairs = None 4505 # FIMXE 4506 self._enabled = None 4507 self._formatterJsFunc = None 4508 self._shadow = None 4509 self._shared = None 4510 self._snap = None 4511 # NA for pie/bar/column 4512 self._style = None
4513
4514 - def getBackgroundColor(self):
4515 return self._backgroundColor
4516
4517 - def setBackgroundColor(self, backgroundColor):
4518 self._backgroundColor = backgroundColor
4519
4520 - def getBorderColor(self):
4521 return self._borderColor
4522
4523 - def setBorderColor(self, borderColor):
4524 self._borderColor = borderColor
4525
4526 - def getBorderRadius(self):
4527 return self._borderRadius
4528
4529 - def setBorderRadius(self, borderRadius):
4530 self._borderRadius = borderRadius
4531
4532 - def getBorderWidth(self):
4533 return self._borderWidth
4534
4535 - def setBorderWidth(self, borderWidth):
4536 self._borderWidth = borderWidth
4537
4538 - def getCrosshairs(self):
4539 return self._crosshairs
4540
4541 - def setCrosshairs(self, crosshairs):
4542 self._crosshairs = crosshairs
4543
4544 - def getEnabled(self):
4545 return self._enabled
4546
4547 - def setEnabled(self, enabled):
4548 self._enabled = enabled
4549
4550 - def getFormatterJsFunc(self):
4551 return self._formatterJsFunc
4552
4553 - def setFormatterJsFunc(self, formatterJsFunc):
4554 self._formatterJsFunc = formatterJsFunc
4555
4556 - def getShadow(self):
4557 return self._shadow
4558
4559 - def setShadow(self, shadow):
4560 self._shadow = shadow
4561
4562 - def getShared(self):
4563 return self._shared
4564
4565 - def setShared(self, shared):
4566 self._shared = shared
4567
4568 - def getSnap(self):
4569 return self._snap
4570
4571 - def setSnap(self, snap):
4572 self._snap = snap
4573
4574 - def getStyle(self):
4575 return self._style
4576
4577 - def setStyle(self, style):
4578 self._style = style
4579
4580 - def __str__(self):
4581 return ('Tooltip [backgroundColor=' + str(self._backgroundColor) 4582 + ', borderColor=' + str(self._borderColor) 4583 + ', borderRadius=' + str(self._borderRadius) 4584 + ', borderWidth=' + str(self._borderWidth) 4585 + ', crosshairs=' + str(self._crosshairs) 4586 + ', enabled=' + str(self._enabled) 4587 + ', formatter=' + str(self._formatterJsFunc) 4588 + ', shadow=' + str(self._shadow) 4589 + ', shared=' + str(self._shared) 4590 + ', snap=' + str(self._snap) 4591 + ', style=' + str(self._style) 4592 + ']')
4593