1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 """Window for Invient charts demo."""
16
17 from StringIO \
18 import StringIO
19
20 from random \
21 import random
22
23 from threading \
24 import Thread
25
26 from time \
27 import sleep
28
29 from muntjac.addon.invient.invient_charts_util \
30 import getDate
31
32 from datetime \
33 import datetime
34
35 from muntjac.util \
36 import totalseconds, OrderedSet
37
38 from muntjac.api \
39 import TextArea, VerticalLayout, HorizontalLayout, Label, \
40 HorizontalSplitPanel, Window, Tree, Alignment, Button, GridLayout, \
41 ProgressIndicator
42
43 from muntjac.ui \
44 import button
45
46 from muntjac.data.property \
47 import IValueChangeListener
48
49 from muntjac.data.util.hierarchical_container \
50 import HierarchicalContainer
51
52 from muntjac.terminal.sizeable \
53 import ISizeable
54
55 from muntjac.addon.invient.invient_charts \
56 import ChartZoomListener, DateTimePoint, InvientCharts, DateTimeSeries, \
57 SeriesType, XYSeries, DecimalPoint, PointClickListener, \
58 ChartSVGAvailableListener, ChartClickListener, ChartResetZoomListener, \
59 SeriesClickListerner, SeriesHideListerner, SeriesShowListerner, \
60 SeriesLegendItemClickListerner, PointRemoveListener, PointSelectListener, \
61 PointUnselectListener, PieChartLegendItemClickListener
62
63 from muntjac.addon.invient.invient_charts_config \
64 import DateTimePlotBand, DateTimeRange, InvientChartsConfig, Margin, \
65 DateTimeAxis, NumberYAxis, AxisTitle, LineConfig, SymbolMarker, \
66 MarkerState, ZoomType, YAxisDataLabel, Grid, AreaConfig, SeriesState, \
67 CategoryAxis, NumberPlotLine, Legend, Layout, Position, HorzAlign, \
68 VertAlign, NumberValue, NumberXAxis, ScatterConfig, DataLabel, \
69 SeriesConfig, Stacking, AxisTitleAlign, BarConfig, Tooltip, ColumnConfig, \
70 XAxisDataLabel, Spacing, Tick, TickmarkPlacement, Symbol, NumberPlotBand, \
71 NumberRange, AreaSplineConfig, PieConfig, PieDataLabel, PointConfig, \
72 SplineConfig, ImageMarker, MinorGrid, PlotLabel, ChartLabel, \
73 ChartLabelItem, DashStyle
74
75 from muntjac.addon.invient.color \
76 import RGBA, RGB
77
78 from muntjac.addon.invient.gradient \
79 import LinearColorStop, LinearGradient
83 return long(totalseconds(dt - datetime(1970, 1, 1)) * 1e03)
84
87
88 _TREE_ITEM_CAPTION_PROP_ID = 'ChartType'
89
90 _SEPARATOR = '|'
91
150
151
160
161
163 return self._isAppRunningOnGAE
164
165
168
169
170 - def showChart(self, demoSeriesTypeName, chartNameString):
265
266
283
284
353
354
356 chartConfig = InvientChartsConfig()
357
358 chartConfig.getGeneralChartConfig().setReflow(False)
359 chartConfig.getGeneralChartConfig().setBorderWidth(0)
360 chartConfig.getGeneralChartConfig().setMargin(Margin())
361 chartConfig.getGeneralChartConfig().getMargin().setLeft(50)
362 chartConfig.getGeneralChartConfig().getMargin().setRight(20)
363 chartConfig.getGeneralChartConfig().setZoomType(ZoomType.X)
364 chartConfig.getGeneralChartConfig().setClientZoom(False)
365 chartConfig.getGeneralChartConfig().setHeight(80)
366 chartConfig.getTitle().setText('')
367
368 xAxis = DateTimeAxis()
369 xAxis.setShowLastLabel(True)
370 xAxis.setMaxZoom(14 * 24 * 3600 * 1000.0)
371
372 plotBand = DateTimePlotBand('mask-before')
373 plotBand.setRange(DateTimeRange(self._masterChartMinDate,
374 self._detailChartPointStartDate))
375 plotBand.setColor(RGBA(0, 0, 0, 0.2))
376
377 xAxis.addPlotBand(plotBand)
378 xAxis.setTitle(AxisTitle(''))
379
380 xAxes = set()
381 xAxes.add(xAxis)
382 chartConfig.setXAxes(xAxes)
383
384 yAxis = NumberYAxis()
385 yAxis.setShowFirstLabel(False)
386 yAxis.setMin(0.6)
387 yAxis.setGrid(Grid())
388 yAxis.getGrid().setLineWidth(0)
389 yAxis.setLabel(YAxisDataLabel(False))
390 yAxis.setTitle(AxisTitle(''))
391
392 yAxes = set()
393 yAxes.add(yAxis)
394 chartConfig.setYAxes(yAxes)
395
396 chartConfig.getTooltip().setFormatterJsFunc(
397 'function() { return false; }')
398
399 chartConfig.getLegend().setEnabled(False)
400 chartConfig.getCredit().setEnabled(False)
401
402
403 areaCfg = AreaConfig()
404 colorStops = list()
405 colorStops.append(LinearColorStop(0, RGB(69, 114, 167)))
406 colorStops.append(LinearColorStop(1, RGBA(0, 0, 0, 0)))
407
408
409 areaCfg.setFillColor(LinearGradient(0, 0, 0, 70, colorStops))
410 areaCfg.setLineWidth(1)
411 areaCfg.setMarker(SymbolMarker(False))
412 areaCfg.setShadow(False)
413 areaCfg.setEnableMouseTracking(False)
414 areaCfg.setHoverState(SeriesState())
415 areaCfg.getHoverState().setLineWidth(1)
416 chartConfig.addSeriesConfig(areaCfg)
417
418 chart = InvientCharts(chartConfig)
419
420
421
422 seriesDataCfg = AreaConfig()
423 seriesDataCfg.setPointInterval(24 * 3600.0 * 1000)
424 start = timestamp(self._masterChartMinDate)
425 seriesDataCfg.setPointStart(start)
426 masterChartSeries = DateTimeSeries(chart, 'USD to EUR',
427 SeriesType.AREA, seriesDataCfg)
428 masterChartSeries.setSeriesPoints(self.getMasterDetailData(
429 masterChartSeries))
430 chart.addSeries(masterChartSeries)
431
432 return chart
433
434
436 chartConfig = InvientChartsConfig()
437 chartConfig.getGeneralChartConfig().setType(SeriesType.LINE)
438 chartConfig.getGeneralChartConfig().setMargin(Margin())
439 chartConfig.getGeneralChartConfig().getMargin().setRight(130)
440 chartConfig.getGeneralChartConfig().getMargin().setBottom(25)
441
442 chartConfig.getTitle().setX(-20)
443 chartConfig.getTitle().setText('Monthly Average Temperature')
444 chartConfig.getSubtitle().setText('Source: WorldClimate.com')
445 chartConfig.getTitle().setX(-20)
446
447 categoryAxis = CategoryAxis()
448 categoryAxis.setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May',
449 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
450
451 xAxesSet = set()
452 xAxesSet.add(categoryAxis)
453 chartConfig.setXAxes(xAxesSet)
454
455 numberYAxis = NumberYAxis()
456 numberYAxis.setTitle(AxisTitle(u'Temperature (\u2103)'.encode('utf-8')))
457 plotLine = NumberPlotLine('TempAt0')
458 plotLine.setValue(NumberValue(0.0))
459 plotLine.setWidth(1)
460 plotLine.setZIndex(1)
461 plotLine.setColor(RGB(128, 128, 128))
462 numberYAxis.addPlotLine(plotLine)
463 yAxesSet = set()
464 yAxesSet.add(numberYAxis)
465 chartConfig.setYAxes(yAxesSet)
466
467 legend = Legend()
468 legend.setLayout(Layout.VERTICAL)
469 legendPos = Position()
470 legendPos.setAlign(HorzAlign.RIGHT)
471 legendPos.setVertAlign(VertAlign.TOP)
472 legendPos.setX(-10)
473 legendPos.setY(100)
474 legend.setPosition(legendPos)
475 legend.setBorderWidth(0)
476 chartConfig.setLegend(legend)
477
478
479 lineCfg = LineConfig()
480 chartConfig.addSeriesConfig(lineCfg)
481
482
483 chartConfig.getTooltip().setFormatterJsFunc(
484 'function() { '
485 + u' return \'<b>\' + this.series.name + \'</b><br/>\' + this.x + \': \'+ this.y +\'\u2103\''.encode('utf-8')
486 + '}')
487
488 chart = InvientCharts(chartConfig)
489
490 seriesData = XYSeries('Tokyo')
491 seriesData.setSeriesPoints(self.getPoints(seriesData, [7.0, 6.9, 9.5,
492 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]))
493 chart.addSeries(seriesData)
494
495 seriesData = XYSeries('New York')
496 seriesData.setSeriesPoints(self.getPoints(seriesData, [-0.2, 0.8, 5.7,
497 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5]))
498 chart.addSeries(seriesData)
499
500 seriesData = XYSeries('Berlin')
501 seriesData.setSeriesPoints(self.getPoints(seriesData, [-0.9, 0.6, 3.5,
502 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0]))
503 chart.addSeries(seriesData)
504
505 seriesData = XYSeries('London')
506 seriesData.setSeriesPoints(self.getPoints(seriesData, [3.9, 4.2, 5.7,
507 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]))
508 chart.addSeries(seriesData)
509
510 self.addChart(chart)
511
512
514 chartConfig = InvientChartsConfig()
515 chartConfig.getGeneralChartConfig().setType(SeriesType.SCATTER)
516 chartConfig.getGeneralChartConfig().setMargin(Margin(70, 50, 60, 80))
517
518 chartConfig.getTitle().setText('User supplied data')
519 chartConfig.getSubtitle().setText('Click the plot area to add a '
520 'point. Click a point to remove it.')
521
522 xAxis = NumberXAxis()
523 xAxis.setMinPadding(0.2)
524 xAxis.setMaxPadding(0.2)
525 xAxis.setMaxZoom(60)
526 xAxes = set()
527 xAxes.add(xAxis)
528 chartConfig.setXAxes(xAxes)
529
530 yAxis = NumberYAxis()
531 yAxis.setTitle(AxisTitle('Value'))
532 yAxis.setMinPadding(0.2)
533 yAxis.setMaxPadding(0.2)
534 yAxis.setMaxZoom(60)
535
536 plotLine = NumberPlotLine('At0')
537 plotLine.setValue(NumberValue(0.0))
538 plotLine.setWidth(1)
539 plotLine.setColor(RGB(128, 128, 128))
540 yAxis.addPlotLine(plotLine)
541 yAxes = set()
542 yAxes.add(yAxis)
543 chartConfig.setYAxes(yAxes)
544 chartConfig.getLegend().setEnabled(False)
545
546 scatterCfg = ScatterConfig()
547 scatterCfg.setLineWidth(1)
548 chartConfig.addSeriesConfig(scatterCfg)
549
550
551 chart = InvientCharts(chartConfig)
552 seriesData = XYSeries('User Supplied Data')
553 seriesData.addPoint(DecimalPoint(seriesData, 20, 20))
554 seriesData.addPoint(DecimalPoint(seriesData, 80, 80))
555 chart.addSeries(seriesData)
556
557 l = AddPointChartClickListener(self)
558 chart.addListener(l)
559
560 l = AddPointClickListener(self)
561 chart.addListener(l, [])
562
563 self.addChart(chart, False, False)
564
565
567 chartConfig = InvientChartsConfig()
568 chartConfig.getGeneralChartConfig().setMargin(Margin())
569
570 chartConfig.getTitle().setText('Monthly Average Temperature')
571 chartConfig.getSubtitle().setText('Source: WorldClimate.com')
572
573 categoryAxis = CategoryAxis()
574 categoryAxis.setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May',
575 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
576 xAxesSet = set()
577 xAxesSet.add(categoryAxis)
578 chartConfig.setXAxes(xAxesSet)
579
580 numberYAxis = NumberYAxis()
581 numberYAxis.setTitle(AxisTitle(u'Temperature (\u2103)'.encode('utf-8')))
582 yAxesSet = set()
583 yAxesSet.add(numberYAxis)
584 chartConfig.setYAxes(yAxesSet)
585 chartConfig.getTooltip().setEnabled(False)
586
587
588 lineCfg = LineConfig()
589 lineCfg.setDataLabel(DataLabel())
590 lineCfg.getDataLabel().setEnabled(True)
591 lineCfg.setEnableMouseTracking(False)
592 chartConfig.addSeriesConfig(lineCfg)
593
594 chart = InvientCharts(chartConfig)
595 seriesData = XYSeries('Tokyo')
596 seriesData.setSeriesPoints(self.getPoints(seriesData, [7.0, 6.9, 9.5,
597 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]))
598 chart.addSeries(seriesData)
599
600 seriesData = XYSeries('London')
601 seriesData.setSeriesPoints(self.getPoints(seriesData, [3.9, 4.2, 5.7,
602 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]))
603 chart.addSeries(seriesData)
604
605 self.addChart(chart)
606
607
609 chartConfig = InvientChartsConfig()
610 chartConfig.getGeneralChartConfig().setType(SeriesType.BAR)
611
612 chartConfig.getTitle().setText('Stacked bar chart')
613
614 xAxis = CategoryAxis()
615 categories = ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
616 xAxis.setCategories(categories)
617 xAxesSet = set()
618 xAxesSet.add(xAxis)
619 chartConfig.setXAxes(xAxesSet)
620
621 numberYAxis = NumberYAxis()
622 numberYAxis.setMin(0.0)
623 numberYAxis.setTitle(AxisTitle('Total fruit consumption'))
624 yAxesSet = set()
625 yAxesSet.add(numberYAxis)
626 chartConfig.setYAxes(yAxesSet)
627
628 legend = Legend()
629 legend.setBackgroundColor(RGB(255, 255, 255))
630 legend.setReversed(True)
631 chartConfig.setLegend(legend)
632
633 chartConfig.getTooltip().setFormatterJsFunc(
634 'function() {'
635 + ' return \'\'+ this.series.name +\': \'+ this.y +\'\'; '
636 + '}')
637
638 seriesCfg = SeriesConfig()
639 seriesCfg.setStacking(Stacking.NORMAL)
640 chartConfig.addSeriesConfig(seriesCfg)
641
642 chart = InvientCharts(chartConfig)
643
644 seriesData = XYSeries('John')
645 seriesData.setSeriesPoints(self.getPoints(seriesData, [5, 3, 4, 7, 2]))
646 chart.addSeries(seriesData)
647
648 seriesData = XYSeries('Jane')
649 seriesData.setSeriesPoints(self.getPoints(seriesData, [2, 2, 3, 2, 1]))
650 chart.addSeries(seriesData)
651
652 seriesData = XYSeries('Joe')
653 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 4, 4, 2, 5]))
654 chart.addSeries(seriesData)
655
656 self.addChart(chart)
657
658
660 chartConfig = InvientChartsConfig()
661 chartConfig.getGeneralChartConfig().setType(SeriesType.BAR)
662
663 chartConfig.getTitle().setText('Historic World Population by Region')
664 chartConfig.getSubtitle().setText('Source: Wikipedia.org')
665
666 xAxisMain = CategoryAxis()
667 categories = ['Africa', 'America', 'Asia', 'Europe', 'Oceania']
668 xAxisMain.setCategories(categories)
669 xAxesSet = set()
670 xAxesSet.add(xAxisMain)
671 chartConfig.setXAxes(xAxesSet)
672
673 yAxis = NumberYAxis()
674 yAxis.setMin(0.0)
675 yAxis.setTitle(AxisTitle('Population (millions)'))
676 yAxis.getTitle().setAlign(AxisTitleAlign.HIGH)
677 yAxesSet = set()
678 yAxesSet.add(yAxis)
679 chartConfig.setYAxes(yAxesSet)
680
681 chartConfig.getTooltip().setFormatterJsFunc(
682 'function() {'
683 + ' return \'\' + this.series.name +\': \'+ this.y +\' millions\';'
684 + '}')
685
686 barCfg = BarConfig()
687 barCfg.setDataLabel(DataLabel())
688 chartConfig.addSeriesConfig(barCfg)
689
690 legend = Legend()
691 legend.setLayout(Layout.VERTICAL)
692 legend.setPosition(Position())
693 legend.getPosition().setAlign(HorzAlign.RIGHT)
694 legend.getPosition().setVertAlign(VertAlign.TOP)
695 legend.getPosition().setX(-100)
696 legend.getPosition().setY(100)
697 legend.setFloating(True)
698 legend.setBorderWidth(1)
699 legend.setBackgroundColor(RGB(255, 255, 255))
700 legend.setShadow(True)
701 chartConfig.setLegend(legend)
702
703 chartConfig.getCredit().setEnabled(False)
704
705 chart = InvientCharts(chartConfig)
706
707 seriesData = XYSeries('Year 1800')
708 seriesData.setSeriesPoints(self.getPoints(seriesData,
709 [107, 31, 635, 203, 2]))
710 chart.addSeries(seriesData)
711
712 seriesData = XYSeries('Year 1900')
713 seriesData.setSeriesPoints(self.getPoints(seriesData,
714 [133, 156, 947, 408, 6]))
715 chart.addSeries(seriesData)
716
717 seriesData = XYSeries('Year 2008')
718 seriesData.setSeriesPoints(self.getPoints(seriesData,
719 [973, 914, 4054, 732, 34]))
720 chart.addSeries(seriesData)
721
722 self.addChart(chart)
723
724
726 chartConfig = InvientChartsConfig()
727 chartConfig.getGeneralChartConfig().setType(SeriesType.BAR)
728
729 chartConfig.getTitle().setText(
730 'Population pyramid for Germany, midyear 2010')
731 chartConfig.getSubtitle().setText('Source: www.census.gov')
732
733 xAxisMain = CategoryAxis()
734 categories = ['0-4', '5-9', '10-14', '15-19', '20-24', '25-29',
735 '30-34', '35-39', '40-44', '45-49', '50-54', '55-59',
736 '60-64', '65-69', '70-74', '75-79', '80-84', '85-89',
737 '90-94', '95-99', '100 +']
738 xAxisMain.setCategories(categories)
739 xAxisMain.setReversed(False)
740 xAxesSet = set()
741
742
743 xAxesSet.add(xAxisMain)
744 xAxis = CategoryAxis()
745 xAxis.setCategories(categories)
746 xAxis.setOpposite(True)
747 xAxis.setReversed(False)
748 xAxis.setLinkedTo(xAxisMain)
749 xAxesSet.add(xAxis)
750 chartConfig.setXAxes(xAxesSet)
751
752 yAxis = NumberYAxis()
753 yAxis.setTitle(AxisTitle(''))
754 yAxis.setMin(-4000000.0)
755 yAxis.setMax(4000000.0)
756 yAxis.setLabel(YAxisDataLabel())
757 yAxis.getLabel().setFormatterJsFunc(
758 'function() {'
759 + ' return (Math.abs(this.value) / 1000000) + \'M\';'
760 + ' }')
761
762 yAxesSet = set()
763 yAxesSet.add(yAxis)
764 chartConfig.setYAxes(yAxesSet)
765
766 tooltip = Tooltip()
767 tooltip.setFormatterJsFunc(
768 'function() {'
769 + ' return \'<b>\'+ this.series.name +\', age \'+ this.point.category +\'</b><br/>\' + '
770 + ' \'Population: \'+ Highcharts.numberFormat(Math.abs(this.point.y), 0); '
771 + '}')
772
773 series = SeriesConfig()
774 series.setStacking(Stacking.NORMAL)
775 chartConfig.addSeriesConfig(series)
776
777 chart = InvientCharts(chartConfig)
778 seriesData = XYSeries('Male')
779 seriesData.setSeriesPoints(self.getPoints(seriesData,
780 [-1746181, -1884428, -2089758, -2222362, -2537431, -2507081,
781 -2443179, -2664537, -3556505, -3680231, -3143062, -2721122,
782 -2229181, -2227768, -2176300, -1329968, -836804, -354784,
783 -90569, -28367, -3878]))
784 chart.addSeries(seriesData)
785
786 seriesData = XYSeries('Female')
787 seriesData.setSeriesPoints(self.getPoints(seriesData,
788 [1656154, 1787564, 1981671, 2108575, 2403438, 2366003,
789 2301402, 2519874, 3360596, 3493473, 3050775, 2759560,
790 2304444, 2426504, 2568938, 1785638, 1447162, 1005011,
791 330870, 130632, 21208]))
792 chart.addSeries(seriesData)
793
794 self.addChart(chart)
795
796
798 chartConfig = InvientChartsConfig()
799 chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN)
800
801 chartConfig.getTitle().setText('Monthly Average Rainfall')
802 chartConfig.getSubtitle().setText('Source: WorldClimate.com')
803
804 xAxis = CategoryAxis()
805 xAxis.setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
806 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
807 xAxesSet = set()
808 xAxesSet.add(xAxis)
809 chartConfig.setXAxes(xAxesSet)
810
811 yAxis = NumberYAxis()
812 yAxis.setMin(0.0)
813 yAxis.setTitle(AxisTitle('Rainfall (mm)'))
814 yAxesSet = set()
815 yAxesSet.add(yAxis)
816 chartConfig.setYAxes(yAxesSet)
817
818 legend = Legend()
819 legend.setFloating(True)
820 legend.setLayout(Layout.VERTICAL)
821 legend.setPosition(Position())
822 legend.getPosition().setAlign(HorzAlign.LEFT)
823 legend.getPosition().setVertAlign(VertAlign.TOP)
824 legend.getPosition().setX(100)
825 legend.getPosition().setY(70)
826 legend.setShadow(True)
827 legend.setBackgroundColor(RGB(255, 255, 255))
828 chartConfig.setLegend(legend)
829
830 chartConfig.getTooltip().setFormatterJsFunc(
831 'function() {'
832 + ' return \'\' + this.x +\': \'+ this.y +\' mm\'; '
833 + '}')
834
835 colCfg = ColumnConfig()
836 colCfg.setPointPadding(0.2)
837 colCfg.setBorderWidth(0)
838 chartConfig.addSeriesConfig(colCfg)
839
840 chart = InvientCharts(chartConfig)
841 seriesData = XYSeries('Tokyo')
842 seriesData.setSeriesPoints(self.getPoints(seriesData,
843 [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4,
844 194.1, 95.6, 54.4]))
845 chart.addSeries(seriesData)
846
847 seriesData = XYSeries('New York')
848 seriesData.setSeriesPoints(self.getPoints(seriesData,
849 [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2,
850 83.5, 106.6, 92.3]))
851 chart.addSeries(seriesData)
852
853 seriesData = XYSeries('London')
854 seriesData.setSeriesPoints(self.getPoints(seriesData,
855 [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2,
856 59.3, 51.2]))
857 chart.addSeries(seriesData)
858
859 seriesData = XYSeries('Berlin')
860 seriesData.setSeriesPoints(self.getPoints(seriesData, [42.4, 33.2,
861 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]))
862 chart.addSeries(seriesData)
863
864 self.addChart(chart)
865
866
868 chartConfig = InvientChartsConfig()
869 chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN)
870
871 chartConfig.getTitle().setText('Column chart with negative values')
872
873 xAxis = CategoryAxis()
874 xAxis.setCategories(['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'])
875 xAxesSet = set()
876 xAxesSet.add(xAxis)
877 chartConfig.setXAxes(xAxesSet)
878
879 tooltip = Tooltip()
880 tooltip.setFormatterJsFunc(
881 'function() {'
882 + ' return \'\' + this.series.name +\': \'+ this.y +\'\'; '
883 + '}')
884 chartConfig.setTooltip(tooltip)
885 chartConfig.getCredit().setEnabled(False)
886
887 chart = InvientCharts(chartConfig)
888 seriesData = XYSeries('John')
889 seriesData.setSeriesPoints(self.getPoints(seriesData, [5, 3, 4, 7, 2]))
890 chart.addSeries(seriesData)
891
892 seriesData = XYSeries('Jane')
893 seriesData.setSeriesPoints(self.getPoints(seriesData, [2, -2, -3, 2, 1]))
894 chart.addSeries(seriesData)
895
896 seriesData = XYSeries('Joe')
897 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 4, 4, -2, 5]))
898 chart.addSeries(seriesData)
899
900 self.addChart(chart)
901
902
904 chartConfig = InvientChartsConfig()
905 chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN)
906
907 chartConfig.getTitle().setText('Stacked column chart')
908
909 xAxis = CategoryAxis()
910 xAxis.setCategories(['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'])
911 xAxesSet = set()
912 xAxesSet.add(xAxis)
913 chartConfig.setXAxes(xAxesSet)
914
915 yAxis = NumberYAxis()
916 yAxis.setMin(0.0)
917 yAxis.setTitle(AxisTitle('Total fruit consumption'))
918 yAxesSet = set()
919 yAxesSet.add(yAxis)
920 chartConfig.setYAxes(yAxesSet)
921
922 legend = Legend()
923 legend.setPosition(Position())
924 legend.getPosition().setAlign(HorzAlign.RIGHT)
925 legend.getPosition().setVertAlign(VertAlign.TOP)
926 legend.getPosition().setX(-100)
927 legend.getPosition().setY(20)
928 legend.setFloating(True)
929 legend.setBackgroundColor(RGB(255, 255, 255))
930 legend.setBorderWidth(1)
931 legend.setShadow(True)
932 chartConfig.setLegend(legend)
933
934 chartConfig.getTooltip().setFormatterJsFunc(
935 'function() {'
936 + ' return \'<b>\'+ this.x +\'</b><br/>\'+ this.series.name +\': \'+ this.y +\'<br/>\'+'
937 + ' \'Total: \'+ this.point.stackTotal; '
938 + '}')
939
940 colCfg = ColumnConfig()
941 colCfg.setStacking(Stacking.NORMAL)
942 chartConfig.addSeriesConfig(colCfg)
943
944 chart = InvientCharts(chartConfig)
945 seriesData = XYSeries('John')
946 seriesData.setSeriesPoints(self.getPoints(seriesData, [5, 3, 4, 7, 2]))
947 chart.addSeries(seriesData)
948
949 seriesData = XYSeries('Jane')
950 seriesData.setSeriesPoints(self.getPoints(seriesData, [2, 2, 3, 2, 1]))
951 chart.addSeries(seriesData)
952
953 seriesData = XYSeries('Joe')
954 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 4, 4, 2, 5]))
955 chart.addSeries(seriesData)
956
957 self.addChart(chart)
958
959
961 chartConfig = InvientChartsConfig()
962 chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN)
963
964 chartConfig.getTitle().setText(
965 'Total fruit consumtion, grouped by gender')
966
967 xAxis = CategoryAxis()
968 xAxis.setCategories(['Apples', 'Oranges', 'Pears',
969 'Grapes', 'Bananas'])
970 xAxesSet = set()
971 xAxesSet.add(xAxis)
972 chartConfig.setXAxes(xAxesSet)
973
974 yAxis = NumberYAxis()
975 yAxis.setAllowDecimals(False)
976 yAxis.setMin(0.0)
977 yAxis.setTitle(AxisTitle('Number of fruits'))
978 yAxesSet = set()
979 yAxesSet.add(yAxis)
980 chartConfig.setYAxes(yAxesSet)
981
982 series = ColumnConfig()
983 series.setStacking(Stacking.NORMAL)
984 chartConfig.addSeriesConfig(series)
985
986 chartConfig.getTooltip().setFormatterJsFunc(
987 'function() {'
988 + ' return \'<b>\'+ this.x +\'</b><br/>\'+ this.series.name +\': \'+ this.y +\'<br/>\'+ \'Total: \'+ this.point.stackTotal;'
989 + '}')
990
991 chart = InvientCharts(chartConfig)
992 seriesData = XYSeries('John')
993 seriesData.setSeriesPoints(self.getPoints(seriesData, [5, 3, 4, 7, 2]))
994 seriesData.setStack('male')
995 chart.addSeries(seriesData)
996
997 seriesData = XYSeries('Joe')
998 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 4, 4, 2, 5]))
999 seriesData.setStack('male')
1000 chart.addSeries(seriesData)
1001
1002 seriesData = XYSeries('Jane')
1003 seriesData.setSeriesPoints(self.getPoints(seriesData, [2, 5, 6, 2, 1]))
1004 seriesData.setStack('female')
1005 chart.addSeries(seriesData)
1006
1007 seriesData = XYSeries('Janet')
1008 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 0, 4, 4, 3]))
1009 seriesData.setStack('female')
1010 chart.addSeries(seriesData)
1011
1012 self.addChart(chart)
1013
1014
1016 chartConfig = InvientChartsConfig()
1017 chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN)
1018
1019 chartConfig.getTitle().setText('Stacked column chart')
1020
1021 xAxis = CategoryAxis()
1022 xAxis.setCategories(['Apples', 'Oranges', 'Pears',
1023 'Grapes', 'Bananas'])
1024 xAxesSet = set()
1025 xAxesSet.add(xAxis)
1026 chartConfig.setXAxes(xAxesSet)
1027
1028 yAxis = NumberYAxis()
1029 yAxis.setMin(0.0)
1030 yAxis.setTitle(AxisTitle('Total fruit consumption'))
1031 yAxesSet = set()
1032 yAxesSet.add(yAxis)
1033 chartConfig.setYAxes(yAxesSet)
1034
1035 series = ColumnConfig()
1036 series.setStacking(Stacking.PERCENT)
1037 chartConfig.addSeriesConfig(series)
1038
1039 chartConfig.getTooltip().setFormatterJsFunc(
1040 'function() {'
1041 + ' return \'\' + this.series.name +\': \'+ this.y +\' (\'+ Math.round(this.percentage) +\'%)\'; '
1042 + '}')
1043
1044 chart = InvientCharts(chartConfig)
1045 seriesData = XYSeries('John')
1046 seriesData.setSeriesPoints(self.getPoints(seriesData, [5, 3, 4, 7, 2]))
1047 chart.addSeries(seriesData)
1048
1049 seriesData = XYSeries('Joe')
1050 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 4, 4, 2, 5]))
1051 chart.addSeries(seriesData)
1052
1053 seriesData = XYSeries('Jane')
1054 seriesData.setSeriesPoints(self.getPoints(seriesData, [2, 2, 3, 2, 1]))
1055 chart.addSeries(seriesData)
1056
1057 self.addChart(chart)
1058
1059
1061 chartConfig = InvientChartsConfig()
1062 chartConfig.getGeneralChartConfig().setType(SeriesType.COLUMN)
1063 chartConfig.getGeneralChartConfig().setMargin(Margin())
1064 chartConfig.getGeneralChartConfig().getMargin().setTop(50)
1065 chartConfig.getGeneralChartConfig().getMargin().setRight(50)
1066 chartConfig.getGeneralChartConfig().getMargin().setBottom(100)
1067 chartConfig.getGeneralChartConfig().getMargin().setLeft(80)
1068
1069 chartConfig.getTitle().setText('World\'s largest cities per 2008')
1070
1071 xAxis = CategoryAxis()
1072 xAxis.setCategories(['Tokyo', 'Jakarta', 'New York', 'Seoul',
1073 'Manila', 'Mumbai', 'Sao Paulo', 'Mexico City', 'Dehli',
1074 'Osaka', 'Cairo', 'Kolkata', 'Los Angeles', 'Shanghai',
1075 'Moscow', 'Beijing', 'Buenos Aires', 'Guangzhou',
1076 'Shenzhen', 'Istanbul'])
1077 xAxis.setLabel(XAxisDataLabel())
1078 xAxis.getLabel().setRotation(-45)
1079 xAxis.getLabel().setAlign(HorzAlign.RIGHT)
1080 xAxis.getLabel().setStyle('{ font: \'normal 13px Verdana, sans-serif\' }')
1081 xAxesSet = set()
1082 xAxesSet.add(xAxis)
1083 chartConfig.setXAxes(xAxesSet)
1084
1085 yAxis = NumberYAxis()
1086 yAxis.setMin(0.0)
1087 yAxis.setTitle(AxisTitle('Population (millions)'))
1088 yAxesSet = set()
1089 yAxesSet.add(yAxis)
1090 chartConfig.setYAxes(yAxesSet)
1091 chartConfig.setLegend(Legend(False))
1092
1093 chartConfig.getTooltip().setFormatterJsFunc(
1094 'function() {'
1095 + ' return \'<b>\'+ this.x +\'</b><br/>\'+ \'Population in 2008: \'+ $wnd.Highcharts.numberFormat(this.y, 1) + '
1096 + ' \' millions\' '
1097 + '}')
1098
1099 chart = InvientCharts(chartConfig)
1100
1101 colCfg = ColumnConfig()
1102 colCfg.setDataLabel(DataLabel())
1103 colCfg.getDataLabel().setRotation(-90)
1104 colCfg.getDataLabel().setAlign(HorzAlign.RIGHT)
1105 colCfg.getDataLabel().setX(-3)
1106 colCfg.getDataLabel().setY(10)
1107 colCfg.getDataLabel().setColor(RGB(255, 255, 255))
1108
1109 colCfg.getDataLabel().setFormatterJsFunc('function() {'
1110 + ' return this.y; '
1111 + '}')
1112
1113 colCfg.getDataLabel().setStyle(
1114 ' { font: \'normal 13px Verdana, sans-serif\' } ')
1115 seriesData = XYSeries('Population', colCfg)
1116 seriesData.setSeriesPoints(self.getPoints(seriesData,
1117 [34.4, 21.8, 20.1, 20, 19.6, 19.5, 19.1, 18.4, 18, 17.3,
1118 16.8, 15, 14.7, 14.5, 13.3, 12.8, 12.4, 11.8, 11.7, 11.2]))
1119
1120 chart.addSeries(seriesData)
1121
1122 self.addChart(chart)
1123
1124
1126 chartConfig = InvientChartsConfig()
1127 chartConfig.getGeneralChartConfig().setType(SeriesType.AREA)
1128
1129 chartConfig.getTitle().setText('Area chart with negative values')
1130
1131 xAxis = CategoryAxis()
1132 xAxis.setCategories(['Apples', 'Oranges', 'Pears',
1133 'Grapes', 'Bananas'])
1134 xAxesSet = set()
1135 xAxesSet.add(xAxis)
1136 chartConfig.setXAxes(xAxesSet)
1137
1138 chartConfig.getCredit().setEnabled(False)
1139
1140 chart = InvientCharts(chartConfig)
1141
1142 series = XYSeries('John')
1143 series.setSeriesPoints(self.getPoints(series, [5, 3, 4, 7, 2]))
1144 chart.addSeries(series)
1145
1146 series = XYSeries('Jane')
1147 series.setSeriesPoints(self.getPoints(series, [2, -2, -3, 2, 1]))
1148 chart.addSeries(series)
1149
1150 series = XYSeries('Joe')
1151 series.setSeriesPoints(self.getPoints(series, [3, 4, 4, -2, 5]))
1152 chart.addSeries(series)
1153
1154 self.addChart(chart)
1155
1156
1158 chartConfig = InvientChartsConfig()
1159 chartConfig.getGeneralChartConfig().setType(SeriesType.AREA)
1160 chartConfig.getGeneralChartConfig().setInverted(True)
1161
1162 chartConfig.getTitle().setText(
1163 'Average fruit consumption during one week')
1164 chartConfig.getSubtitle().setStyle(
1165 '{ position: \'absolute\', right: \'0px\', bottom: \'10px\'}')
1166
1167 legend = Legend()
1168 legend.setFloating(True)
1169 legend.setLayout(Layout.VERTICAL)
1170 legend.setPosition(Position())
1171 legend.getPosition().setAlign(HorzAlign.RIGHT)
1172 legend.getPosition().setVertAlign(VertAlign.TOP)
1173 legend.getPosition().setX(-150)
1174 legend.getPosition().setY(100)
1175 legend.setBorderWidth(1)
1176 legend.setBackgroundColor(RGB(255, 255, 255))
1177 chartConfig.setLegend(legend)
1178
1179 xAxis = CategoryAxis()
1180 xAxis.setCategories(['Monday', 'Tuesday', 'Wednesday', 'Thursday',
1181 'Friday', 'Saturday', 'Sunday'])
1182 xAxesSet = set()
1183 xAxesSet.add(xAxis)
1184 chartConfig.setXAxes(xAxesSet)
1185
1186 yAxis = NumberYAxis()
1187 yAxis.setTitle(AxisTitle('Number of units'))
1188 yAxis.setMin(0.0)
1189 yAxis.setLabel(YAxisDataLabel())
1190 yAxis.getLabel().setFormatterJsFunc(
1191 'function() {' + ' return this.value; ' + '}')
1192 yAxesSet = set()
1193 yAxesSet.add(yAxis)
1194 chartConfig.setYAxes(yAxesSet)
1195
1196 chartConfig.getTooltip().setFormatterJsFunc('function() {'
1197 + ' return \'\' + this.x + \': \' + this.y; '
1198 + '}')
1199
1200 areaCfg = AreaConfig()
1201 areaCfg.setFillOpacity(0.5)
1202 chartConfig.addSeriesConfig(areaCfg)
1203
1204 chart = InvientCharts(chartConfig)
1205
1206 series = XYSeries('John')
1207 series.setSeriesPoints(self.getPoints(series, [3, 4, 3, 5, 4, 10, 12]))
1208 chart.addSeries(series)
1209
1210 series = XYSeries('Jane')
1211 series.setSeriesPoints(self.getPoints(series, [1, 3, 4, 3, 3, 5, 4]))
1212 chart.addSeries(series)
1213
1214 self.addChart(chart)
1215
1216
1218 chartConfig = InvientChartsConfig()
1219 chartConfig.getGeneralChartConfig().setType(SeriesType.AREA)
1220 chartConfig.getGeneralChartConfig().setSpacing(Spacing())
1221 chartConfig.getGeneralChartConfig().getSpacing().setBottom(30)
1222
1223 chartConfig.getTitle().setText('Fruit consumption *')
1224 chartConfig.getSubtitle().setText(
1225 '* Jane\'s banana consumption is unknown')
1226 chartConfig.getSubtitle().setFloating(True)
1227 chartConfig.getSubtitle().setAlign(HorzAlign.RIGHT)
1228 chartConfig.getSubtitle().setVertAlign(VertAlign.BOTTOM)
1229 chartConfig.getSubtitle().setY(15)
1230
1231 legend = Legend()
1232 legend.setFloating(True)
1233 legend.setLayout(Layout.VERTICAL)
1234 legend.setPosition(Position())
1235 legend.getPosition().setAlign(HorzAlign.LEFT)
1236 legend.getPosition().setVertAlign(VertAlign.TOP)
1237 legend.getPosition().setX(150)
1238 legend.getPosition().setY(100)
1239 legend.setBorderWidth(1)
1240 legend.setBackgroundColor(RGB(255, 255, 255))
1241 chartConfig.setLegend(legend)
1242
1243 xAxis = CategoryAxis()
1244 xAxis.setCategories(['Apples', 'Pears', 'Oranges', 'Bananas',
1245 'Grapes', 'Plums', 'Strawberries', 'Raspberries'])
1246 xAxesSet = set()
1247 xAxesSet.add(xAxis)
1248 chartConfig.setXAxes(xAxesSet)
1249
1250 yAxis = NumberYAxis()
1251 yAxis.setTitle(AxisTitle('Y-Axis'))
1252 yAxis.setLabel(YAxisDataLabel())
1253 yAxis.getLabel().setFormatterJsFunc(
1254 'function() {'
1255 + ' return this.value; '
1256 + '}')
1257 yAxesSet = set()
1258 yAxesSet.add(yAxis)
1259 chartConfig.setYAxes(yAxesSet)
1260 chartConfig.getTooltip().setFormatterJsFunc(
1261 'function() {'
1262 + ' return \'<b>\'+ this.series.name +\'</b><br/>\'+ this.x +\': \'+ this.y;'
1263 + '}')
1264
1265 chartConfig.getCredit().setEnabled(False)
1266
1267 areaCfg = AreaConfig()
1268 areaCfg.setFillOpacity(0.5)
1269 chartConfig.addSeriesConfig(areaCfg)
1270
1271 chart = InvientCharts(chartConfig)
1272
1273 series = XYSeries('John')
1274 series.setSeriesPoints(self.getPoints(series, [0, 1, 4, 4, 5, 2, 3, 7]))
1275 chart.addSeries(series)
1276
1277 series = XYSeries('Jane')
1278 series.addPoint([DecimalPoint(series, 1.0), DecimalPoint(series, 0.0),
1279 DecimalPoint(series, 3.0), DecimalPoint(series),
1280 DecimalPoint(series, 3.0), DecimalPoint(series, 1.0),
1281 DecimalPoint(series, 2.0), DecimalPoint(series, 1.0)])
1282 chart.addSeries(series)
1283
1284 self.addChart(chart)
1285
1286
1288 chartConfig = InvientChartsConfig()
1289 chartConfig.getGeneralChartConfig().setType(SeriesType.AREA)
1290
1291 chartConfig.getTitle().setText('Historic and Estimated Worldwide '
1292 'Population Growth by Region')
1293 chartConfig.getSubtitle().setText('Source: Wikipedia.org')
1294
1295 xAxis = CategoryAxis()
1296 xAxis.setCategories(['1750', '1800', '1850', '1900', '1950',
1297 '1999', '2050'])
1298 tick = Tick()
1299 tick.setPlacement(TickmarkPlacement.ON)
1300 xAxis.setTick(tick)
1301 xAxesSet = set()
1302 xAxesSet.add(xAxis)
1303 chartConfig.setXAxes(xAxesSet)
1304
1305 yAxis = NumberYAxis()
1306 yAxis.setTitle(AxisTitle('Billions'))
1307 yAxis.setLabel(YAxisDataLabel())
1308 yAxis.getLabel().setFormatterJsFunc('function() {'
1309 + ' return this.value / 1000; '
1310 + '}')
1311
1312 yAxesSet = set()
1313 yAxesSet.add(yAxis)
1314 chartConfig.setYAxes(yAxesSet)
1315
1316 chartConfig.getTooltip().setFormatterJsFunc('function() {'
1317 + ' return \'\'+ this.x +\': \'+ $wnd.Highcharts.numberFormat(this.y, 0, \',\') +\' millions\';'
1318 + '}')
1319
1320 areaCfg = AreaConfig()
1321 areaCfg.setStacking(Stacking.NORMAL)
1322 areaCfg.setLineColor(RGB(102, 102, 102))
1323 areaCfg.setLineWidth(1)
1324
1325 marker = SymbolMarker()
1326 marker.setLineColor(RGB(102, 102, 102))
1327 marker.setLineWidth(1)
1328 areaCfg.setMarker(marker)
1329
1330 chartConfig.addSeriesConfig(areaCfg)
1331
1332 chart = InvientCharts(chartConfig)
1333
1334 series = XYSeries('Asia')
1335 series.setSeriesPoints(self.getPoints(series,
1336 [502, 635, 809, 947, 1402, 3634, 5268]))
1337 chart.addSeries(series)
1338
1339 series = XYSeries('Africa')
1340 series.setSeriesPoints(self.getPoints(series,
1341 [106, 107, 111, 133, 221, 767, 1766]))
1342 chart.addSeries(series)
1343
1344 series = XYSeries('Europe')
1345 series.setSeriesPoints(self.getPoints(series,
1346 [163, 203, 276, 408, 547, 729, 628]))
1347 chart.addSeries(series)
1348
1349 series = XYSeries('America')
1350 series.setSeriesPoints(self.getPoints(series,
1351 [18, 31, 54, 156, 339, 818, 1201]))
1352 chart.addSeries(series)
1353
1354 series = XYSeries('Oceania')
1355 series.setSeriesPoints(self.getPoints(series,
1356 [2, 2, 2, 6, 13, 30, 46]))
1357 chart.addSeries(series)
1358
1359 self.addChart(chart)
1360
1361
1363 chartConfig = InvientChartsConfig()
1364 chartConfig.getGeneralChartConfig().setType(SeriesType.AREA)
1365
1366 chartConfig.getTitle().setText('Historic and Estimated Worldwide '
1367 'Population Distribution by Region')
1368 chartConfig.getSubtitle().setText('Source: Wikipedia.org')
1369
1370 xAxis = CategoryAxis()
1371 xAxis.setCategories(['1750', '1800', '1850', '1900', '1950',
1372 '1999', '2050'])
1373
1374 tick = Tick()
1375 tick.setPlacement(TickmarkPlacement.ON)
1376 xAxis.setTick(tick)
1377 xAxesSet = set()
1378 xAxesSet.add(xAxis)
1379 chartConfig.setXAxes(xAxesSet)
1380
1381 yAxis = NumberYAxis()
1382 yAxis.setTitle(AxisTitle('Percent'))
1383 yAxesSet = set()
1384 yAxesSet.add(yAxis)
1385 chartConfig.setYAxes(yAxesSet)
1386
1387 chartConfig.getTooltip().setFormatterJsFunc(
1388 'function() {'
1389 + ' return \'\' + this.x +\': \' + $wnd.Highcharts.numberFormat(this.percentage, 1) + '
1390 + ' \'% (\'+ $wnd.Highcharts.numberFormat(this.y, 0, \',\') +\' millions)\'; '
1391 + '}')
1392
1393 areaCfg = AreaConfig()
1394 areaCfg.setStacking(Stacking.PERCENT)
1395 areaCfg.setLineColor(RGB(255, 255, 255))
1396 areaCfg.setLineWidth(1)
1397
1398 marker = SymbolMarker()
1399 marker.setLineColor(RGB(255, 255, 255))
1400 marker.setLineWidth(1)
1401 areaCfg.setMarker(marker)
1402
1403 chartConfig.addSeriesConfig(areaCfg)
1404
1405 chart = InvientCharts(chartConfig)
1406
1407 series = XYSeries('Asia')
1408 series.setSeriesPoints(self.getPoints(series,
1409 [502, 635, 809, 947, 1402, 3634, 5268]))
1410 chart.addSeries(series)
1411
1412 series = XYSeries('Africa')
1413 series.setSeriesPoints(self.getPoints(series,
1414 [106, 107, 111, 133, 221, 767, 1766]))
1415 chart.addSeries(series)
1416
1417 series = XYSeries('Europe')
1418 series.setSeriesPoints(self.getPoints(series,
1419 [163, 203, 276, 408, 547, 729, 628]))
1420 chart.addSeries(series)
1421
1422 series = XYSeries('America')
1423 series.setSeriesPoints(self.getPoints(series,
1424 [18, 31, 54, 156, 339, 818, 1201]))
1425 chart.addSeries(series)
1426
1427 series = XYSeries('Oceania')
1428 series.setSeriesPoints(self.getPoints(series,
1429 [2, 2, 2, 6, 13, 30, 46]))
1430 chart.addSeries(series)
1431
1432 self.addChart(chart)
1433
1434
1436 chartConfig = InvientChartsConfig()
1437 chartConfig.getGeneralChartConfig().setType(SeriesType.AREA)
1438
1439 chartConfig.getTitle().setText('US and USSR nuclear stockpiles')
1440 chartConfig.getSubtitle().setText(
1441 'Source: <a href=\'http://thebulletin.metapress.com/content/c4120650912x74k7/fulltext.pdf\'>thebulletin.metapress.com</a>')
1442
1443 xAxis = NumberXAxis()
1444 xAxis.setLabel(XAxisDataLabel())
1445 xAxis.getLabel().setFormatterJsFunc(
1446 'function() {'
1447 + ' return this.value;'
1448 + '}')
1449 xAxesSet = set()
1450 xAxesSet.add(xAxis)
1451 chartConfig.setXAxes(xAxesSet)
1452
1453 yAxis = NumberYAxis()
1454 yAxis.setTitle(AxisTitle('Nuclear weapon states'))
1455 yAxis.setLabel(YAxisDataLabel())
1456 yAxis.getLabel().setFormatterJsFunc(
1457 'function() {'
1458 + ' return this.value / 1000 +\'k\';'
1459 + '}')
1460
1461 yAxesSet = set()
1462 yAxesSet.add(yAxis)
1463 chartConfig.setYAxes(yAxesSet)
1464
1465 chartConfig.getTooltip().setFormatterJsFunc(
1466 'function() {'
1467 + ' return this.series.name +\' produced <b>\'+'
1468 + ' $wnd.Highcharts.numberFormat(this.y, 0) +\'</b><br/>warheads in \'+ this.x;'
1469 + '}')
1470
1471 areaCfg = AreaConfig()
1472 areaCfg.setPointStart(1940.0)
1473 marker = SymbolMarker()
1474 areaCfg.setMarker(marker)
1475 marker.setEnabled(False)
1476 marker.setSymbol(Symbol.CIRCLE)
1477 marker.setRadius(2)
1478 marker.setHoverState(MarkerState(True))
1479 chartConfig.addSeriesConfig(areaCfg)
1480 chart = InvientCharts(chartConfig)
1481
1482
1483 usaAreaCfg = AreaConfig()
1484 usaAreaCfg.setPointStart(1940.0)
1485 series = XYSeries('USA', usaAreaCfg)
1486 points = set()
1487 self.addNullPoints(points, series, 5)
1488 points = points.union(self.getPoints(series,
1489 [6, 11, 32, 110, 235, 369, 640, 1005, 1436, 2063, 3057, 4618,
1490 6444, 9822, 15468, 20434, 24126, 27387, 29459, 31056, 31982,
1491 32040, 31233, 29224, 27342, 26662, 26956, 27912, 28999,
1492 28965, 27826, 25579, 25722, 24826, 24605, 24304, 23464, 23708,
1493 24099, 24357, 24237, 24401, 24344, 23586, 22380, 21004, 17287,
1494 14747, 13076, 12555, 12144, 11009, 10950, 10871, 10824, 10577,
1495 10527, 10475, 10421, 10358, 10295, 10104]))
1496 series.setSeriesPoints(points)
1497 chart.addSeries(series)
1498
1499 russiaAreaCfg = AreaConfig()
1500 russiaAreaCfg.setPointStart(1940.0)
1501 series = XYSeries('USSR/Russia', russiaAreaCfg)
1502 points = set()
1503 self.addNullPoints(points, series, 10)
1504 points = points.union(self.getPoints(series,
1505 [5, 25, 50, 120, 150, 200, 426, 660, 869, 1060, 1605, 2471,
1506 3322, 4238, 5221, 6129, 7089, 8339, 9399, 10538, 11643,
1507 13092, 14478, 15915, 17385, 19055, 21205, 23044, 25393,
1508 27935, 30062, 32049, 33952, 35804, 37431, 39197, 45000,
1509 43000, 41000, 39000, 37000, 35000, 33000, 31000, 29000,
1510 27000, 25000, 24000, 23000, 22000, 21000, 20000, 19000,
1511 18000, 18000, 17000, 16000]))
1512 series.setSeriesPoints(points)
1513 chart.addSeries(series)
1514 self.addChart(chart)
1515
1516
1518 for _ in range(howManyNullPoints):
1519 points.add(DecimalPoint(series))
1520
1521
1523 chartConfig = InvientChartsConfig()
1524 chartConfig.getGeneralChartConfig().setType(SeriesType.AREASPLINE)
1525
1526 chartConfig.getTitle().setText('Average fruit consumption during '
1527 'one week')
1528
1529 legend = Legend()
1530 legend.setLayout(Layout.VERTICAL)
1531 legendPos = Position()
1532 legendPos.setAlign(HorzAlign.LEFT)
1533 legendPos.setVertAlign(VertAlign.TOP)
1534 legendPos.setX(150)
1535 legendPos.setY(100)
1536 legend.setPosition(legendPos)
1537 legend.setFloating(True)
1538 legend.setBorderWidth(1)
1539 legend.setBackgroundColor(RGB(255, 255, 255))
1540 chartConfig.setLegend(legend)
1541
1542 xAxis = CategoryAxis()
1543 xAxis.setCategories(['Monday', 'Tuesday', 'Wednesday', 'Thursday',
1544 'Friday', 'Saturday', 'Sunday'])
1545 plotBand = NumberPlotBand('sat-sun')
1546 plotBand.setRange(NumberRange(4.6, 6.5))
1547 plotBand.setColor(RGBA(68, 170, 213, 0.2))
1548 xAxis.addPlotBand(plotBand)
1549
1550 xAxesSet = set()
1551 xAxesSet.add(xAxis)
1552 chartConfig.setXAxes(xAxesSet)
1553
1554 yAxis = NumberYAxis()
1555 yAxis.setTitle(AxisTitle('Fruit units'))
1556
1557 yAxesSet = set()
1558 yAxesSet.add(yAxis)
1559 chartConfig.setYAxes(yAxesSet)
1560 chartConfig.getCredit().setEnabled(False)
1561
1562 areaSpline = AreaSplineConfig()
1563 areaSpline.setFillOpacity(0.5)
1564 chartConfig.addSeriesConfig(areaSpline)
1565 chart = InvientCharts(chartConfig)
1566
1567 series = XYSeries('John')
1568 series.setSeriesPoints(self.getPoints(series, [3, 4, 3, 5, 4, 10, 12]))
1569 chart.addSeries(series)
1570
1571 series = XYSeries('Jane')
1572 series.setSeriesPoints(self.getPoints(series, [1, 3, 4, 3, 3, 5, 4]))
1573 chart.addSeries(series)
1574
1575 self.addChart(chart)
1576
1577
1579 chartConfig = InvientChartsConfig()
1580 chartConfig.getGeneralChartConfig().setType(SeriesType.PIE)
1581
1582 chartConfig.getTitle().setText('Browser market shares at a specific website, 2010')
1583
1584 chartConfig.getTooltip().setFormatterJsFunc(
1585 'function() {'
1586 + ' return \'<b>\'+ this.point.name +\'</b>: \'+ this.y +\' %\'; '
1587 + '}')
1588
1589 pie = PieConfig()
1590 pie.setAllowPointSelect(True)
1591 pie.setCursor('pointer')
1592 pie.setDataLabel(PieDataLabel(False))
1593 pie.setShowInLegend(True)
1594 chartConfig.addSeriesConfig(pie)
1595
1596 chart = InvientCharts(chartConfig)
1597
1598 series = XYSeries('Browser Share')
1599 points = set()
1600 points.add(DecimalPoint(series, 'Firefox', 45.0))
1601 points.add(DecimalPoint(series, 'IE', 26.8))
1602 config = PointConfig(True)
1603 points.add(DecimalPoint(series, 'Chrome', 12.8, config))
1604 points.add(DecimalPoint(series, 'Safari', 8.5))
1605 points.add(DecimalPoint(series, 'Opera', 6.2))
1606 points.add(DecimalPoint(series, 'Others', 0.7))
1607
1608 series.setSeriesPoints(points)
1609 chart.addSeries(series)
1610
1611 self.addChart(chart)
1612
1613
1615 chartConfig = InvientChartsConfig()
1616 chartConfig.getGeneralChartConfig().setType(SeriesType.PIE)
1617
1618 chartConfig.getGeneralChartConfig().setMargin(Margin())
1619 chartConfig.getGeneralChartConfig().getMargin().setTop(50)
1620 chartConfig.getGeneralChartConfig().getMargin().setRight(0)
1621 chartConfig.getGeneralChartConfig().getMargin().setBottom(0)
1622 chartConfig.getGeneralChartConfig().getMargin().setLeft(0)
1623
1624 chartConfig.getTitle().setText(
1625 'Browser market shares at a specific website')
1626 chartConfig.getSubtitle().setText(
1627 'Inner circle: 2008, outer circle: 2010')
1628
1629 chartConfig.getTooltip().setFormatterJsFunc(
1630 'function() {'
1631 + ' return \'<b>\'+ this.series.name +\'</b><br/>\'+ '
1632 + ' this.point.name +\': \'+ this.y +\' %\'; '
1633 + '}')
1634
1635 chart = InvientCharts(chartConfig)
1636
1637 pieCfg = PieConfig()
1638 pieCfg.setInnerSize(65)
1639 pieCfg.setDataLabel(PieDataLabel(False))
1640
1641 series = XYSeries('2008', SeriesType.PIE, pieCfg)
1642 points = set()
1643 points.add(self.getPointWithColor(series, 'Firefox', 44.2,
1644 RGB(69, 114, 167)))
1645 points.add(self.getPointWithColor(series, 'IE', 46.6,
1646 RGB(170, 70, 67)))
1647 points.add(self.getPointWithColor(series, 'Chrome', 3.1,
1648 RGB(137, 165, 78)))
1649 points.add(self.getPointWithColor(series, 'Safari', 2.7,
1650 RGB(128, 105, 155)))
1651 points.add(self.getPointWithColor(series, 'Opera', 2.3,
1652 RGB(128, 105, 155)))
1653 points.add(self.getPointWithColor(series, 'Mozilla', 0.4,
1654 RGB(219, 132, 61)))
1655 series.setSeriesPoints(points)
1656
1657 chart.addSeries(series)
1658
1659 pieCfg = PieConfig()
1660 pieCfg.setInnerSize(150)
1661 pieCfg.setDataLabel(PieDataLabel())
1662 pieCfg.setColor(RGB(0, 0, 0))
1663 pieCfg.getDataLabel().setConnectorColor(RGB(0, 0, 0))
1664
1665 series = XYSeries('2010', SeriesType.PIE, pieCfg)
1666 points = set()
1667 points.add(self.getPointWithColor(series, 'Firefox', 45.0,
1668 RGB(69, 114, 167)))
1669 points.add(self.getPointWithColor(series, 'IE', 26.8,
1670 RGB(170, 70, 67)))
1671 points.add(self.getPointWithColor(series, 'Chrome', 12.8,
1672 RGB(137, 165, 78)))
1673 points.add(self.getPointWithColor(series, 'Safari', 8.5,
1674 RGB(128, 105, 155)))
1675 points.add(self.getPointWithColor(series, 'Opera', 6.2,
1676 RGB(128, 105, 155)))
1677 points.add(self.getPointWithColor(series, 'Mozilla', 0.2,
1678 RGB(219, 132, 61)))
1679 series.setSeriesPoints(points)
1680
1681 chart.addSeries(series)
1682
1683 self.addChart(chart)
1684
1685
1690
1691
1693 chartConfig = InvientChartsConfig()
1694 chartConfig.getGeneralChartConfig().setType(SeriesType.PIE)
1695 chartConfig.getTitle().setText('Browser market shares at a specific '
1696 'website, 2010')
1697
1698 pieCfg = PieConfig()
1699 pieCfg.setAllowPointSelect(True)
1700 pieCfg.setCursor('pointer')
1701 pieCfg.setDataLabel(PieDataLabel())
1702 pieCfg.getDataLabel().setEnabled(True)
1703 pieCfg.getDataLabel().setFormatterJsFunc(
1704 'function() {'
1705 + ' return \'<b>\'+ this.point.name +\'</b>: \'+ this.y +\' %\';'
1706 + '}')
1707 pieCfg.getDataLabel().setConnectorColor(RGB(0, 0, 0))
1708
1709 chartConfig.addSeriesConfig(pieCfg)
1710
1711 chart = InvientCharts(chartConfig)
1712
1713 series = XYSeries('Browser Share')
1714 points = set()
1715 points.add(DecimalPoint(series, 'Firefox', 45.0))
1716 points.add(DecimalPoint(series, 'IE', 26.8))
1717 config = PointConfig(True)
1718 points.add(DecimalPoint(series, 'Chrome', 12.8, config))
1719 points.add(DecimalPoint(series, 'Safari', 8.5))
1720 points.add(DecimalPoint(series, 'Opera', 6.2))
1721 points.add(DecimalPoint(series, 'Others', 0.7))
1722
1723 series.setSeriesPoints(points)
1724 chart.addSeries(series)
1725
1726 self.addChart(chart)
1727
1728
1730 chartConfig = InvientChartsConfig()
1731 chartConfig.getGeneralChartConfig().setType(SeriesType.SCATTER)
1732 chartConfig.getGeneralChartConfig().setZoomType(ZoomType.XY)
1733
1734 chartConfig.getTitle().setText(
1735 'Height Versus Weight of Individuals by Gender')
1736 chartConfig.getSubtitle().setText('Source: Heinz 2003')
1737
1738 chartConfig.getTooltip().setFormatterJsFunc(
1739 'function() {'
1740 + ' return \'\' + this.x + \' cm, \' + this.y + \' kg\'; '
1741 + '}')
1742
1743 xAxis = NumberXAxis()
1744 xAxis.setTitle(AxisTitle('Height (cm)'))
1745 xAxis.setStartOnTick(True)
1746 xAxis.setEndOnTick(True)
1747 xAxis.setShowLastLabel(True)
1748 xAxesSet = set()
1749 xAxesSet.add(xAxis)
1750 chartConfig.setXAxes(xAxesSet)
1751
1752 yAxis = NumberYAxis()
1753 yAxis.setTitle(AxisTitle('Weight (kg)'))
1754 yAxesSet = set()
1755 yAxesSet.add(yAxis)
1756 chartConfig.setYAxes(yAxesSet)
1757
1758 legend = Legend()
1759 legend.setLayout(Layout.VERTICAL)
1760 legendPos = Position()
1761 legendPos.setAlign(HorzAlign.LEFT)
1762 legendPos.setVertAlign(VertAlign.TOP)
1763 legendPos.setX(100)
1764 legendPos.setY(70)
1765 legend.setPosition(legendPos)
1766 legend.setFloating(True)
1767 legend.setBorderWidth(1)
1768 legend.setBackgroundColor(RGB(255, 255, 255))
1769 chartConfig.setLegend(legend)
1770
1771 scatterCfg = ScatterConfig()
1772
1773 marker = SymbolMarker(5)
1774 scatterCfg.setMarker(marker)
1775 marker.setHoverState(MarkerState())
1776 marker.getHoverState().setEnabled(True)
1777 marker.getHoverState().setLineColor(RGB(100, 100, 100))
1778 chartConfig.addSeriesConfig(scatterCfg)
1779
1780 chart = InvientCharts(chartConfig)
1781
1782 femaleScatterCfg = ScatterConfig()
1783 femaleScatterCfg.setColor(RGBA(223, 83, 83, 0.5))
1784 series = XYSeries('Female', femaleScatterCfg)
1785 series.setSeriesPoints(self.getScatterFemalePoints(series))
1786 chart.addSeries(series)
1787
1788 maleScatterCfg = ScatterConfig()
1789 maleScatterCfg.setColor(RGBA(119, 152, 191, 0.5))
1790 series = XYSeries('Male', maleScatterCfg)
1791 series.setSeriesPoints(self.getScatterMalePoints(series))
1792 chart.addSeries(series)
1793 self.addChart(chart)
1794
1795
1797 chartConfig = InvientChartsConfig()
1798
1799 chartConfig.getTitle().setText('Scatter plot with regression line')
1800
1801 xAxis = NumberXAxis()
1802 xAxis.setMin(-0.5)
1803 xAxis.setMax(5.5)
1804 xAxesSet = set()
1805 xAxesSet.add(xAxis)
1806 chartConfig.setXAxes(xAxesSet)
1807
1808 yAxis = NumberYAxis()
1809 yAxis.setMin(0.0)
1810 yAxesSet = set()
1811 yAxesSet.add(yAxis)
1812 chartConfig.setYAxes(yAxesSet)
1813
1814 chart = InvientCharts(chartConfig)
1815
1816
1817 lineCfg = LineConfig()
1818 lineCfg.setMarker(SymbolMarker(False))
1819 lineCfg.setHoverState(SeriesState())
1820 lineCfg.getHoverState().setLineWidth(0)
1821 lineSeries = XYSeries('Regression Line', lineCfg)
1822 lineSeries.setType(SeriesType.LINE)
1823 lineSeries.setSeriesPoints(self.getPoints(lineSeries,
1824 [[0, 1.11], [5, 4.51]]))
1825 chart.addSeries(lineSeries)
1826
1827
1828 scatterCfg = ScatterConfig()
1829 scatterCfg.setMarker(SymbolMarker(4))
1830 scatterSeries = XYSeries('Observations', scatterCfg)
1831 scatterSeries.setType(SeriesType.SCATTER)
1832 scatterSeries.setSeriesPoints(self.getPoints(scatterSeries,
1833 [1, 1.5, 2.8, 3.5, 3.9, 4.2]))
1834 chart.addSeries(scatterSeries)
1835
1836 self.addChart(chart)
1837
1838
1840 chartConfig = InvientChartsConfig()
1841 chartConfig.getGeneralChartConfig().setType(SeriesType.SPLINE)
1842 chartConfig.getGeneralChartConfig().setInverted(True)
1843 chartConfig.getGeneralChartConfig().setWidth(500)
1844
1845 chartConfig.getTitle().setText('Atmosphere Temperature by Altitude')
1846 chartConfig.getSubtitle().setText(
1847 'According to the Standard Atmosphere Model')
1848
1849 xAxis = NumberXAxis()
1850 xAxis.setReversed(False)
1851 xAxis.setTitle(AxisTitle('Altitude'))
1852 xAxis.setLabel(XAxisDataLabel())
1853 xAxis.getLabel().setFormatterJsFunc(
1854 'function() {'
1855 + ' return this.value +\'km\';'
1856 + '}')
1857 xAxis.setMaxPadding(0.05)
1858 xAxis.setShowLastLabel(True)
1859 xAxesSet = set()
1860 xAxesSet.add(xAxis)
1861 chartConfig.setXAxes(xAxesSet)
1862
1863 yAxis = NumberYAxis()
1864 yAxis.setTitle(AxisTitle('Temperature'))
1865 yAxis.setLineWidth(2)
1866 yAxis.setLabel(YAxisDataLabel())
1867 yAxis.getLabel().setFormatterJsFunc(
1868 'function() {'
1869 + u' return this.value + \'\u2103\';'.encode('utf-8')
1870 + '}')
1871 yAxesSet = set()
1872 yAxesSet.add(yAxis)
1873 chartConfig.setYAxes(yAxesSet)
1874 tooltip = Tooltip()
1875 tooltip.setFormatterJsFunc(
1876 'function() {'
1877 + u' return \'\' + this.x +\' km: \'+ this.y +\'\u2103\';'.encode('utf-8')
1878 + '}')
1879 chartConfig.setTooltip(tooltip)
1880
1881 legend = Legend()
1882 legend.setEnabled(False)
1883 chartConfig.setLegend(legend)
1884 splineCfg = SplineConfig()
1885 splineCfg.setMarker(SymbolMarker(True))
1886 chartConfig.addSeriesConfig(splineCfg)
1887
1888 chart = InvientCharts(chartConfig)
1889 series = XYSeries('Temperature')
1890 series.setSeriesPoints(self.getPoints(series,
1891 [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
1892 [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]))
1893 chart.addSeries(series)
1894
1895 self.addChart(chart)
1896
1897
1899 chartConfig = InvientChartsConfig()
1900 chartConfig.getGeneralChartConfig().setType(SeriesType.SPLINE)
1901
1902 chartConfig.getTitle().setText('Monthly Average Temperature')
1903 chartConfig.getSubtitle().setText('Source: WorldClimate.com')
1904
1905 xAxis = CategoryAxis()
1906 xAxis.setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
1907 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
1908 xAxesSet = set()
1909 xAxesSet.add(xAxis)
1910 chartConfig.setXAxes(xAxesSet)
1911
1912 yAxis = NumberYAxis()
1913 yAxis.setTitle(AxisTitle('Temperature'))
1914 yAxis.setLabel(YAxisDataLabel())
1915 yAxis.getLabel().setFormatterJsFunc(
1916 'function() {' +
1917 u' return this.value + \'\u2103\';'.encode('utf-8') +
1918 '}')
1919 yAxesSet = set()
1920 yAxesSet.add(yAxis)
1921 chartConfig.setYAxes(yAxesSet)
1922
1923 tooltip = Tooltip()
1924 tooltip.setCrosshairs(True)
1925 tooltip.setShared(True)
1926 chartConfig.setTooltip(tooltip)
1927
1928 splineCfg = SplineConfig()
1929 symbolMarker = SymbolMarker(True)
1930 symbolMarker.setRadius(4)
1931 symbolMarker.setLineColor(RGB(102, 102, 102))
1932 symbolMarker.setLineWidth(1)
1933 splineCfg.setMarker(symbolMarker)
1934 chartConfig.addSeriesConfig(splineCfg)
1935
1936 chart = InvientCharts(chartConfig)
1937
1938 splineCfg = SplineConfig()
1939 splineCfg.setMarker(SymbolMarker(Symbol.SQUARE))
1940 series = XYSeries('Tokyo', splineCfg)
1941 series.setSeriesPoints(self.getPoints(series,
1942 [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2]))
1943 config = PointConfig(ImageMarker('/graphics/sun.png'))
1944 highest = DecimalPoint(series, 26.5, config)
1945 series.addPoint(highest)
1946 series.addPoint(DecimalPoint(series, 23.3))
1947 series.addPoint(DecimalPoint(series, 18.3))
1948 series.addPoint(DecimalPoint(series, 13.9))
1949 series.addPoint(DecimalPoint(series, 9.6))
1950 chart.addSeries(series)
1951
1952 splineCfg = SplineConfig()
1953 splineCfg.setMarker(SymbolMarker(Symbol.DIAMOND))
1954 series = XYSeries('London', splineCfg)
1955 config = PointConfig(ImageMarker('/graphics/snow.png'))
1956 lowest = DecimalPoint(series, 3.9, config)
1957 series.addPoint(lowest)
1958 series.addPoint(DecimalPoint(series, 4.2))
1959 series.addPoint(DecimalPoint(series, 5.7))
1960 series.addPoint(DecimalPoint(series, 8.5))
1961 series.addPoint(DecimalPoint(series, 11.9))
1962 series.addPoint(DecimalPoint(series, 15.2))
1963 series.addPoint(DecimalPoint(series, 17.0))
1964 series.addPoint(DecimalPoint(series, 16.6))
1965 series.addPoint(DecimalPoint(series, 14.2))
1966 series.addPoint(DecimalPoint(series, 10.3))
1967 series.addPoint(DecimalPoint(series, 6.6))
1968 series.addPoint(DecimalPoint(series, 4.8))
1969 chart.addSeries(series)
1970 self.addChart(chart)
1971
1972
1974 chartConfig = InvientChartsConfig()
1975 chartConfig.getGeneralChartConfig().setType(SeriesType.SPLINE)
1976 chartConfig.getGeneralChartConfig().setMargin(Margin())
1977 chartConfig.getGeneralChartConfig().getMargin().setRight(10)
1978
1979 chartConfig.getTitle().setText('Live random data')
1980
1981 xAxis = DateTimeAxis()
1982 xAxis.setTick(Tick())
1983 xAxis.getTick().setPixelInterval(150)
1984 xAxes = set()
1985 xAxes.add(xAxis)
1986 chartConfig.setXAxes(xAxes)
1987
1988 yAxis = NumberYAxis()
1989 yAxis.setTitle(AxisTitle('Value'))
1990 plotLine = NumberPlotLine('LineAt0')
1991 yAxis.addPlotLine(plotLine)
1992 plotLine.setValue(NumberValue(0.0))
1993 plotLine.setWidth(1)
1994 plotLine.setColor(RGB(128, 128, 128))
1995 yAxes = set()
1996 yAxes.add(yAxis)
1997 chartConfig.setYAxes(yAxes)
1998
1999 chartConfig.getTooltip().setFormatterJsFunc(
2000 'function() {'
2001 + ' return \'<b>\'+ this.series.name +\'</b><br/>\'+ '
2002 + ' $wnd.Highcharts.dateFormat(\'%Y-%m-%d %H:%M:%S\', this.x) +\'<br/>\'+ '
2003 + ' $wnd.Highcharts.numberFormat(this.y, 2);'
2004 + '}')
2005
2006 chartConfig.getLegend().setEnabled(False)
2007
2008 chart = InvientCharts(chartConfig)
2009
2010 seriesData = DateTimeSeries(chart, 'Random Data', True)
2011 points = set()
2012 dtNow = datetime.now()
2013
2014 for cnt in range(-19, 0):
2015 points.add(DateTimePoint(seriesData,
2016 self.getUpdatedDate(dtNow, cnt), random()))
2017
2018 seriesData.setSeriesPoints(points)
2019 chart.addSeries(seriesData)
2020
2021 self.addChart(chart, False, False, False)
2022
2023 self._indicator = ProgressIndicator(0.2)
2024 self._indicator.setPollingInterval(1000)
2025 self._indicator.setStyleName('i-progressindicator-invisible')
2026 self._rightLayout.addComponent(self._indicator)
2027
2028 if not self.isAppRunningOnGAE():
2029 self._splineThread = SelfUpdateSplineThread(chart)
2030 self._splineThread.start()
2031 else:
2032 self.getApplication().getMainWindow().showNotification(
2033 'This chart does not auto-update because Google App '
2034 'Engine does not support threads.')
2035
2036
2042
2043
2044 @classmethod
2046 ts = getDate(dt) + seconds
2047 return datetime.fromtimestamp(ts)
2048
2049
2051 chartConfig = InvientChartsConfig()
2052 chartConfig.getGeneralChartConfig().setType(SeriesType.SPLINE)
2053
2054 chartConfig.getTitle().setText('Wind speed during two days')
2055 chartConfig.getSubtitle().setText('October 6th and 7th 2009 at two '
2056 'locations in Vik i Sogn, Norway')
2057 chartConfig.getTooltip().setFormatterJsFunc(
2058 'function() {'
2059 + ' return \'\' + $wnd.Highcharts.dateFormat(\'%e. %b %Y, %H:00\', this.x) +\': \'+ this.y +\' m/s\'; '
2060 + '}')
2061
2062 xAxis = DateTimeAxis()
2063 xAxesSet = set()
2064 xAxesSet.add(xAxis)
2065 chartConfig.setXAxes(xAxesSet)
2066
2067 yAxis = NumberYAxis()
2068 yAxis.setTitle(AxisTitle('Wind speed (m/s)'))
2069 yAxis.setMin(0.0)
2070 yAxis.setMinorGrid(MinorGrid())
2071 yAxis.getMinorGrid().setLineWidth(0)
2072 yAxis.setGrid(Grid())
2073 yAxis.getGrid().setLineWidth(0)
2074
2075 numberBand = NumberPlotBand('Light air')
2076 numberBand.setRange(NumberRange(0.3, 1.5))
2077 numberBand.setColor(RGBA(68, 170, 213, 0.1))
2078 numberBand.setLabel(PlotLabel('Light air'))
2079 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2080 yAxis.getPlotBands().add(numberBand)
2081
2082 numberBand = NumberPlotBand('Light breeze')
2083 numberBand.setRange(NumberRange(1.5, 3.3))
2084 numberBand.setColor(RGBA(0, 0, 0, 0.0))
2085 numberBand.setLabel(PlotLabel('Light breeze'))
2086 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2087 yAxis.getPlotBands().add(numberBand)
2088
2089 numberBand = NumberPlotBand('Gentle breeze')
2090 numberBand.setRange(NumberRange(3.3, 5.5))
2091 numberBand.setColor(RGBA(68, 170, 213, 0.1))
2092 numberBand.setLabel(PlotLabel('Gentle breeze'))
2093 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2094 yAxis.getPlotBands().add(numberBand)
2095
2096 numberBand = NumberPlotBand('Moderate breeze')
2097 numberBand.setRange(NumberRange(5.5, 8.0))
2098 numberBand.setColor(RGBA(0, 0, 0, 0.0))
2099 numberBand.setLabel(PlotLabel('Moderate breeze'))
2100 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2101 yAxis.getPlotBands().add(numberBand)
2102
2103 numberBand = NumberPlotBand('Fresh breeze')
2104 numberBand.setRange(NumberRange(8.0, 11.0))
2105 numberBand.setColor(RGBA(68, 170, 213, 0.1))
2106 numberBand.setLabel(PlotLabel('Fresh breeze'))
2107 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2108 yAxis.getPlotBands().add(numberBand)
2109
2110 numberBand = NumberPlotBand('Strong breeze')
2111 numberBand.setRange(NumberRange(11.0, 14.0))
2112 numberBand.setColor(RGBA(0, 0, 0, 0.0))
2113 numberBand.setLabel(PlotLabel('Strong breeze'))
2114 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2115 yAxis.getPlotBands().add(numberBand)
2116
2117 numberBand = NumberPlotBand('High wind')
2118 numberBand.setRange(NumberRange(14.0, 15.0))
2119 numberBand.setColor(RGBA(68, 170, 213, 0.1))
2120 numberBand.setLabel(PlotLabel('High wind'))
2121 numberBand.getLabel().setStyle('{ color: \'#606060\' }')
2122 yAxis.getPlotBands().add(numberBand)
2123
2124 yAxesSet = set()
2125 yAxesSet.add(yAxis)
2126 chartConfig.setYAxes(yAxesSet)
2127
2128 splineCfg = SplineConfig()
2129 splineCfg.setLineWidth(4)
2130 splineCfg.setHoverState(SeriesState())
2131 splineCfg.getHoverState().setLineWidth(5)
2132
2133 symbolMarker = SymbolMarker(False)
2134 splineCfg.setMarker(symbolMarker)
2135 symbolMarker.setSymbol(Symbol.CIRCLE)
2136 symbolMarker.setHoverState(MarkerState())
2137 symbolMarker.getHoverState().setEnabled(True)
2138 symbolMarker.getHoverState().setRadius(5)
2139 symbolMarker.getHoverState().setLineWidth(1)
2140
2141 splineCfg.setPointStart(self.getPointStartDate(2009, 8, 6))
2142 splineCfg.setPointInterval(3600.0 * 1000.0)
2143 chartConfig.addSeriesConfig(splineCfg)
2144
2145 chart = InvientCharts(chartConfig)
2146
2147 series = DateTimeSeries(chart, 'Hestavollane', splineCfg, True)
2148 series.setSeriesPoints(self.getDateTimePoints(series,
2149 [4.3, 5.1, 4.3, 5.2, 5.4, 4.7, 3.5, 4.1, 5.6, 7.4, 6.9, 7.1,
2150 7.9, 7.9, 7.5, 6.7, 7.7, 7.7, 7.4, 7.0, 7.1, 5.8, 5.9, 7.4,
2151 8.2, 8.5, 9.4, 8.1, 10.9, 10.4, 10.9, 12.4, 12.1, 9.5, 7.5,
2152 7.1, 7.5, 8.1, 6.8, 3.4, 2.1, 1.9, 2.8, 2.9, 1.3, 4.4, 4.2,
2153 3.0, 3.0]))
2154 chart.addSeries(series)
2155
2156 series = DateTimeSeries(chart, 'Voll', splineCfg, True)
2157 series.setSeriesPoints(self.getDateTimePoints(series,
2158 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.3, 0.0,
2159 0.0, 0.4, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
2160 0.0, 0.6, 1.2, 1.7, 0.7, 2.9, 4.1, 2.6, 3.7, 3.9, 1.7, 2.3,
2161 3.0, 3.3, 4.8, 5.0, 4.8, 5.0, 3.2, 2.0, 0.9, 0.4, 0.3, 0.5,
2162 0.4]))
2163 chart.addSeries(series)
2164
2165 self.addChart(chart)
2166
2167
2169 chartConfig = InvientChartsConfig()
2170 chartConfig.getTitle().setText('Combination chart')
2171
2172 tooltip = Tooltip()
2173 tooltip.setFormatterJsFunc(
2174 'function() {'
2175 + ' if (this.point.name) { // the pie chart '
2176 + ' return this.point.name +\': \'+ this.y +\' fruits\'; '
2177 + ' } else {'
2178 + ' return this.x +\': \'+ this.y; '
2179 + ' } '
2180 + '}')
2181
2182 xAxis = CategoryAxis()
2183 xAxis.setCategories(['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums'])
2184 xAxesSet = set()
2185 xAxesSet.add(xAxis)
2186 chartConfig.setXAxes(xAxesSet)
2187
2188 yAxis = NumberYAxis()
2189 yAxis.setAllowDecimals(False)
2190 yAxesSet = set()
2191 yAxesSet.add(yAxis)
2192 chartConfig.setYAxes(yAxesSet)
2193
2194 chart = InvientCharts(chartConfig)
2195
2196 seriesData = XYSeries('Jane', SeriesType.COLUMN)
2197 seriesData.setSeriesPoints(self.getPoints(seriesData, [3, 2, 1, 3, 4]))
2198 chart.addSeries(seriesData)
2199
2200 seriesData = XYSeries('John', SeriesType.COLUMN)
2201 seriesData.setSeriesPoints(self.getPoints(seriesData, [2, 3, 5, 7, 6]))
2202 chart.addSeries(seriesData)
2203
2204 seriesData = XYSeries('Joe', SeriesType.COLUMN)
2205 seriesData.setSeriesPoints(self.getPoints(seriesData, [4, 3, 3, 9, 0]))
2206 chart.addSeries(seriesData)
2207
2208 seriesData = XYSeries('Average', SeriesType.SPLINE)
2209 seriesData.setSeriesPoints(self.getPoints(seriesData,
2210 [3, 2.67, 3, 6.33, 3.33]))
2211
2212 chart.addSeries(seriesData)
2213
2214
2215 pieCfg = PieConfig()
2216 pieCfg.setCenterX(100)
2217 pieCfg.setCenterY(80)
2218 pieCfg.setSize(100)
2219 pieCfg.setShowInLegend(False)
2220 pieCfg.setDataLabel(PieDataLabel())
2221 pieCfg.getDataLabel().setEnabled(False)
2222
2223 totalConsumpSeriesData = XYSeries('Total consumption',
2224 SeriesType.PIE, pieCfg)
2225 config = PointConfig(RGB(69, 114, 167))
2226 point = DecimalPoint(totalConsumpSeriesData, 'Jane', 13, config)
2227 totalConsumpSeriesData.addPoint(point)
2228 config = PointConfig(RGB(170, 70, 67))
2229 point = DecimalPoint(totalConsumpSeriesData, 'John', 23, config)
2230 totalConsumpSeriesData.addPoint(point)
2231 config = PointConfig(RGB(137, 165, 78))
2232 point = DecimalPoint(totalConsumpSeriesData, 'Joe', 19, config)
2233 totalConsumpSeriesData.addPoint(point)
2234
2235 chartLabel = ChartLabel()
2236 chartLabel.addLabel(ChartLabelItem('Total fruit consumption',
2237 '{ left: \'40px\', top: \'8px\', color: \'black\' }'))
2238 chartConfig.setChartLabel(chartLabel)
2239 chart.addSeries(totalConsumpSeriesData)
2240
2241 self.addChart(chart)
2242
2243
2245 chartConfig = InvientChartsConfig()
2246
2247 chartConfig.getTitle().setText(
2248 'Average Monthly Weather Data for Tokyo')
2249 chartConfig.getSubtitle().setText('Source: WorldClimate.com')
2250
2251 chartConfig.getTooltip().setFormatterJsFunc(
2252 'function() {'
2253 + ' var unit = { '
2254 + ' \'Rainfall\': \'mm\','
2255 + u' \'Temperature\': \'\u2103\','.encode('utf-8')
2256 + ' \'Sea-Level Pressure\': \'mb\''
2257 + ' }[this.series.name];'
2258 + ' return \'\' + this.x + \': \' + this.y + \' \' + unit; '
2259 + '}')
2260
2261 legend = Legend()
2262 legend.setLayout(Layout.VERTICAL)
2263 legend.setPosition(Position())
2264 legend.getPosition().setAlign(HorzAlign.LEFT)
2265 legend.getPosition().setVertAlign(VertAlign.TOP)
2266 legend.getPosition().setX(120)
2267 legend.getPosition().setY(80)
2268 legend.setFloating(True)
2269 legend.setBackgroundColor(RGB(255, 255, 255))
2270 chartConfig.setLegend(legend)
2271
2272 xAxis = CategoryAxis()
2273 xAxis.setCategories(['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
2274 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'])
2275 xAxesSet = set()
2276 xAxesSet.add(xAxis)
2277 chartConfig.setXAxes(xAxesSet)
2278
2279
2280 temperatureAxis = NumberYAxis()
2281 temperatureAxis.setAllowDecimals(False)
2282 temperatureAxis.setLabel(YAxisDataLabel())
2283 temperatureAxis.getLabel().setFormatterJsFunc(
2284 'function() {'
2285 + u' return this.value +\'\u2103\'; '.encode('utf-8')
2286 + '}')
2287 temperatureAxis.getLabel().setStyle('{ color: \'#89A54E\' }')
2288 temperatureAxis.setTitle(AxisTitle('Temperature'))
2289 temperatureAxis.getTitle().setStyle(' { color: \'#89A54E\' }')
2290 temperatureAxis.setOpposite(True)
2291
2292 yAxesSet = set()
2293 yAxesSet.add(temperatureAxis)
2294
2295
2296 rainfallAxis = NumberYAxis()
2297 rainfallAxis.setGrid(Grid())
2298 rainfallAxis.getGrid().setLineWidth(0)
2299 rainfallAxis.setTitle(AxisTitle('Rainfall'))
2300 rainfallAxis.getTitle().setStyle(' { color: \'#4572A7\' }')
2301 rainfallAxis.setLabel(YAxisDataLabel())
2302 rainfallAxis.getLabel().setStyle('{ color: \'#4572A7\' }')
2303 rainfallAxis.getLabel().setFormatterJsFunc(
2304 'function() {'
2305 + ' return this.value +\' mm\'; '
2306 + '}')
2307 yAxesSet.add(rainfallAxis)
2308
2309
2310 sealevelPressureAxis = NumberYAxis()
2311 sealevelPressureAxis.setGrid(Grid())
2312 sealevelPressureAxis.getGrid().setLineWidth(0)
2313 sealevelPressureAxis.setTitle(AxisTitle('Sea-Level Pressure'))
2314 sealevelPressureAxis.getTitle().setStyle(' { color: \'#AA4643\' }')
2315 sealevelPressureAxis.setLabel(YAxisDataLabel())
2316 sealevelPressureAxis.getLabel().setStyle('{ color: \'#AA4643\' }')
2317 sealevelPressureAxis.getLabel().setFormatterJsFunc(
2318 'function() {'
2319 + ' return this.value +\' mb\'; '
2320 + '}')
2321 sealevelPressureAxis.setOpposite(True)
2322 yAxesSet.add(sealevelPressureAxis)
2323 chartConfig.setYAxes(yAxesSet)
2324
2325 chart = InvientCharts(chartConfig)
2326
2327
2328 colCfg = ColumnConfig()
2329 colCfg.setColor(RGB(69, 114, 167))
2330
2331 rainfallSeriesData = XYSeries('Rainfall', SeriesType.COLUMN, colCfg)
2332 rainfallSeriesData.setSeriesPoints(self.getPoints(rainfallSeriesData,
2333 [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4,
2334 194.1, 95.6, 54.4]))
2335 rainfallSeriesData.setYAxis(rainfallAxis)
2336 chart.addSeries(rainfallSeriesData)
2337
2338
2339 seaLevelSplineCfg = SplineConfig()
2340 seaLevelSplineCfg.setColor(RGB(170, 70, 67))
2341 seaLevelSplineCfg.setMarker(SymbolMarker(False))
2342 seaLevelSplineCfg.setDashStyle(DashStyle.SHORT_DOT)
2343
2344
2345 seaLevelSeriesData = XYSeries('Sea-Level Pressure', SeriesType.SPLINE,
2346 seaLevelSplineCfg)
2347 seaLevelSeriesData.setSeriesPoints(self.getPoints(seaLevelSeriesData,
2348 [1016, 1016, 1015.9, 1015.5, 1012.3, 1009.5, 1009.6, 1010.2,
2349 1013.1, 1016.9, 1018.2, 1016.7]))
2350 seaLevelSeriesData.setYAxis(sealevelPressureAxis)
2351 chart.addSeries(seaLevelSeriesData)
2352
2353
2354 tempSplineCfg = SplineConfig()
2355 tempSplineCfg.setColor(RGB(137, 165, 78))
2356
2357
2358 tempSeriesData = XYSeries('Temperature', SeriesType.SPLINE,
2359 tempSplineCfg)
2360 tempSeriesData.setSeriesPoints(self.getPoints(tempSeriesData,
2361 [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3,
2362 13.9, 9.6]))
2363 chart.addSeries(tempSeriesData)
2364
2365 self.addChart(chart)
2366
2367
2369 chartConfig = InvientChartsConfig()
2370 chartConfig.getGeneralChartConfig().setZoomType(ZoomType.X)
2371 chartConfig.getGeneralChartConfig().setSpacing(Spacing())
2372 chartConfig.getGeneralChartConfig().getSpacing().setRight(20)
2373
2374 chartConfig.getSubtitle().setText(
2375 'Click and drag in the plot area to zoom in')
2376
2377 xAxis = DateTimeAxis()
2378 xAxis.setMaxZoom(14 * 24 * 3600 * 1000.0)
2379 xAxesSet = set()
2380 xAxesSet.add(xAxis)
2381 chartConfig.setXAxes(xAxesSet)
2382
2383 yAxis = NumberYAxis()
2384 yAxis.setTitle(AxisTitle('Exchange rate'))
2385 yAxis.setMin(0.6)
2386 yAxis.setStartOnTick(True)
2387 yAxis.setShowFirstLabel(False)
2388 yAxesSet = set()
2389 yAxesSet.add(yAxis)
2390 chartConfig.setYAxes(yAxesSet)
2391
2392 chartConfig.getTooltip().setShared(True)
2393
2394 chartConfig.getLegend().setEnabled(False)
2395
2396
2397 areaCfg = AreaConfig()
2398 colorStops = list()
2399 colorStops.append(LinearColorStop(0, RGB(69, 114, 167)))
2400 colorStops.append(LinearColorStop(1, RGBA(2, 0, 0, 0)))
2401
2402
2403 areaCfg.setFillColor(LinearGradient(0, 0, 0, 300, colorStops))
2404
2405 areaCfg.setLineWidth(1)
2406 areaCfg.setShadow(False)
2407 areaCfg.setHoverState(SeriesState())
2408 areaCfg.getHoverState().setLineWidth(1)
2409 marker = SymbolMarker(False)
2410 areaCfg.setMarker(marker)
2411 marker.setHoverState(MarkerState())
2412 marker.getHoverState().setEnabled(True)
2413 marker.getHoverState().setRadius(5)
2414
2415 chartConfig.addSeriesConfig(areaCfg)
2416
2417 chart = InvientCharts(chartConfig)
2418
2419
2420 serieaAreaCfg = AreaConfig()
2421
2422 serieaAreaCfg.setPointStart(self.getPointStartDate(2006, 1, 1))
2423 serieaAreaCfg.setPointInterval(24 * 3600 * 1000.0)
2424
2425
2426 dateTimeSeries = DateTimeSeries(chart, 'USD to EUR', SeriesType.AREA,
2427 serieaAreaCfg)
2428 points = self.getDateTimeSeriesPoints(dateTimeSeries)
2429 dateTimeSeries.addPoint(points)
2430 chart.addSeries(dateTimeSeries)
2431
2432 self.addChart(chart)
2433
2434
2435 - def addChart(self, chart, isPrepend=False, isRegisterEvents=True,
2436 isRegisterSVGEvent=True, isSetHeight=True):
2461
2462
2480
2481
2519
2520
2521 @classmethod
2523 dt = datetime(year, month, day)
2524 return long(totalseconds(dt - datetime(1970, 1, 1)) * 1e03)
2525
2526
2527 @classmethod
2529 return datetime(year, month, day)
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2545
2546
2547 @classmethod
2567
2568
2569 @classmethod
2575
2576
2577 @classmethod
2580
2581
2583 for chartName in ChartName.values():
2584 if chartNameString.lower() == chartName.getName().lower():
2585 return chartName
2586 return None
2587
2588
2590 for demoSeriesType in DemoSeriesType.values():
2591 if demoSeriesTypeName.lower() == demoSeriesType.getName().lower():
2592 return demoSeriesType
2593 return None
2594
2595
2610
2611
2621
2622
2635
2636
2647
2648
2702
2703
2705 nargs = len(args)
2706 if nargs == 1:
2707 eventInfo, = args
2708 self.logEventInfo(eventInfo, True)
2709 elif nargs == 2:
2710 if isinstance(args[1], bool):
2711 eventInfo, isAppend = args
2712 self._eventLog.setReadOnly(False)
2713 if isAppend:
2714 self._eventLog.setValue('['
2715 + self.getCurrFormattedTimestamp() + '] '
2716 + eventInfo + '\n'
2717 + self._eventLog.getValue())
2718 else:
2719 self._eventLog.setValue('')
2720 self._eventLog.setReadOnly(True)
2721 else:
2722 eventName, seriesName = args
2723 sb = ''
2724 sb += '[' + eventName + ']'
2725 sb += ' series -> ' + seriesName
2726 self.logEventInfo(sb)
2727 elif nargs == 5:
2728 if isinstance(args[1], float):
2729 if isinstance(args[3], float):
2730 eventName, xAxisMin, xAxisMax, yAxisMin, yAxisMax = args
2731 sb = ''
2732 sb += '[' + eventName + ']'
2733 sb += ', xAxisMin -> ' + str(xAxisMin)
2734 sb += ', xAxisMax -> ' + str(xAxisMax)
2735 sb += ', yAxisMin -> ' + str(yAxisMin)
2736 sb += ', yAxisMax -> ' + str(yAxisMax)
2737 self.logEventInfo(sb)
2738 else:
2739 eventName, xAxisPos, yAxisPos, mouseX, mouseY = args
2740 sb = ''
2741 sb += '[' + eventName + ']'
2742 sb += ', xAxisPos -> ' + str(xAxisPos)
2743 sb += ', yAxisPos -> ' + str(yAxisPos)
2744 sb += ', mouseX -> ' + str(mouseX)
2745 sb += ', mouseY -> ' + str(mouseY)
2746 self.logEventInfo(sb)
2747 else:
2748 if isinstance(args[3], datetime):
2749 eventName, seriesName, category, x, y = args
2750 self.logEventInfo(eventName, seriesName, category,
2751 x, y, None, None)
2752 else:
2753 eventName, seriesName, category, x, y = args
2754 self.logEventInfo(eventName, seriesName, category,
2755 x, y, None, None)
2756 elif nargs == 7:
2757 if isinstance(args[3], datetime):
2758 eventName, seriesName, category, x, y, mouseX, mouseY = args
2759 self.logStringEventInfo(eventName, seriesName, category,
2760 str(x) if x is not None else None,
2761 str(y) if y is not None else None,
2762 str(mouseX) if mouseX is not None else None,
2763 str(mouseY) if mouseY is not None else None)
2764 else:
2765 eventName, seriesName, category, x, y, mouseX, mouseY = args
2766 self.logStringEventInfo(eventName, seriesName, category,
2767 str(x) if x is not None else None,
2768 str(y) if y is not None else None,
2769 str(mouseX) if mouseX is not None else None,
2770 str(mouseY) if mouseY is not None else None)
2771 else:
2772 raise ValueError
2773
2774
2775 - def logStringEventInfo(self, eventName, seriesName, category, x, y,
2776 mouseX, mouseY):
2777 sb = StringIO()
2778 sb.write('[' + eventName + ']')
2779 sb.write(' series -> ' + seriesName)
2780 if category is not None and len(category) > 0:
2781 sb.write(', category -> ' + category)
2782 if x is not None:
2783 sb.write(', x -> ' + str(x))
2784 if y is not None:
2785 sb.write(', y -> ' + str(y))
2786 if mouseX is not None:
2787 sb.write(', mouseX -> ' + str(mouseX))
2788 if mouseY is not None:
2789 sb.write(', mouseY -> ' + str(mouseY))
2790 self.logEventInfo(sb.getvalue())
2791 sb.close()
2792
2793
2796
2797
2799 if self._scatterFemaleData is not None:
2800 return self._scatterFemaleData
2801
2802
2803 self._scatterFemaleData = self.getPoints(series,
2804 [[161.2, 51.6],
2805 [167.5, 59.0], [159.5, 49.2],
2806 [157.0, 63.0], [155.8, 53.6],
2807 [170.0, 59.0], [159.1, 47.6],
2808 [166.0, 69.8], [176.2, 66.8],
2809 [160.2, 75.2], [172.5, 55.2],
2810 [170.9, 54.2], [172.9, 62.5],
2811 [153.4, 42.0], [160.0, 50.0],
2812 [147.2, 49.8], [168.2, 49.2],
2813 [175.0, 73.2], [157.0, 47.8],
2814 [167.6, 68.8], [159.5, 50.6],
2815 [175.0, 82.5], [166.8, 57.2],
2816 [176.5, 87.8], [170.2, 72.8],
2817 [174.0, 54.5], [173.0, 59.8],
2818 [179.9, 67.3], [170.5, 67.8],
2819 [160.0, 47.0], [154.4, 46.2],
2820 [162.0, 55.0], [176.5, 83.0],
2821 [160.0, 54.4], [152.0, 45.8],
2822 [162.1, 53.6], [170.0, 73.2],
2823 [160.2, 52.1], [161.3, 67.9],
2824 [166.4, 56.6], [168.9, 62.3],
2825 [163.8, 58.5], [167.6, 54.5],
2826 [160.0, 50.2], [161.3, 60.3],
2827 [167.6, 58.3], [165.1, 56.2],
2828 [160.0, 50.2], [170.0, 72.9],
2829 [157.5, 59.8], [167.6, 61.0],
2830 [160.7, 69.1], [163.2, 55.9],
2831 [152.4, 46.5], [157.5, 54.3],
2832 [168.3, 54.8], [180.3, 60.7],
2833 [165.5, 60.0], [165.0, 62.0],
2834 [164.5, 60.3], [156.0, 52.7],
2835 [160.0, 74.3], [163.0, 62.0],
2836 [165.7, 73.1], [161.0, 80.0],
2837 [162.0, 54.7], [166.0, 53.2],
2838 [174.0, 75.7], [172.7, 61.1],
2839 [167.6, 55.7], [151.1, 48.7],
2840 [164.5, 52.3], [163.5, 50.0],
2841 [152.0, 59.3], [169.0, 62.5],
2842 [164.0, 55.7], [161.2, 54.8],
2843 [155.0, 45.9], [170.0, 70.6],
2844 [176.2, 67.2], [170.0, 69.4],
2845 [162.5, 58.2], [170.3, 64.8],
2846 [164.1, 71.6], [169.5, 52.8],
2847 [163.2, 59.8], [154.5, 49.0],
2848 [159.8, 50.0], [173.2, 69.2],
2849 [170.0, 55.9], [161.4, 63.4],
2850 [169.0, 58.2], [166.2, 58.6],
2851 [159.4, 45.7], [162.5, 52.2],
2852 [159.0, 48.6], [162.8, 57.8],
2853 [159.0, 55.6], [179.8, 66.8],
2854 [162.9, 59.4], [161.0, 53.6],
2855 [151.1, 73.2], [168.2, 53.4],
2856 [168.9, 69.0], [173.2, 58.4],
2857 [171.8, 56.2], [178.0, 70.6],
2858 [164.3, 59.8], [163.0, 72.0],
2859 [168.5, 65.2], [166.8, 56.6],
2860 [172.7, 105.2], [163.5, 51.8],
2861 [169.4, 63.4], [167.8, 59.0],
2862 [159.5, 47.6], [167.6, 63.0],
2863 [161.2, 55.2], [160.0, 45.0],
2864 [163.2, 54.0], [162.2, 50.2],
2865 [161.3, 60.2], [149.5, 44.8],
2866 [157.5, 58.8], [163.2, 56.4],
2867 [172.7, 62.0], [155.0, 49.2],
2868 [156.5, 67.2], [164.0, 53.8],
2869 [160.9, 54.4], [162.8, 58.0],
2870 [167.0, 59.8], [160.0, 54.8],
2871 [160.0, 43.2], [168.9, 60.5],
2872 [158.2, 46.4], [156.0, 64.4],
2873 [160.0, 48.8], [167.1, 62.2],
2874 [158.0, 55.5], [167.6, 57.8],
2875 [156.0, 54.6], [162.1, 59.2],
2876 [173.4, 52.7], [159.8, 53.2],
2877 [170.5, 64.5], [159.2, 51.8],
2878 [157.5, 56.0], [161.3, 63.6],
2879 [162.6, 63.2], [160.0, 59.5],
2880 [168.9, 56.8], [165.1, 64.1],
2881 [162.6, 50.0], [165.1, 72.3],
2882 [166.4, 55.0], [160.0, 55.9],
2883 [152.4, 60.4], [170.2, 69.1],
2884 [162.6, 84.5], [170.2, 55.9],
2885 [158.8, 55.5], [172.7, 69.5],
2886 [167.6, 76.4], [162.6, 61.4],
2887 [167.6, 65.9], [156.2, 58.6],
2888 [175.2, 66.8], [172.1, 56.6],
2889 [162.6, 58.6], [160.0, 55.9],
2890 [165.1, 59.1], [182.9, 81.8],
2891 [166.4, 70.7], [165.1, 56.8],
2892 [177.8, 60.0], [165.1, 58.2],
2893 [175.3, 72.7], [154.9, 54.1],
2894 [158.8, 49.1], [172.7, 75.9],
2895 [168.9, 55.0], [161.3, 57.3],
2896 [167.6, 55.0], [165.1, 65.5],
2897 [175.3, 65.5], [157.5, 48.6],
2898 [163.8, 58.6], [167.6, 63.6],
2899 [165.1, 55.2], [165.1, 62.7],
2900 [168.9, 56.6], [162.6, 53.9],
2901 [164.5, 63.2], [176.5, 73.6],
2902 [168.9, 62.0], [175.3, 63.6],
2903 [159.4, 53.2], [160.0, 53.4],
2904 [170.2, 55.0], [162.6, 70.5],
2905 [167.6, 54.5], [162.6, 54.5],
2906 [160.7, 55.9], [160.0, 59.0],
2907 [157.5, 63.6], [162.6, 54.5],
2908 [152.4, 47.3], [170.2, 67.7],
2909 [165.1, 80.9], [172.7, 70.5],
2910 [165.1, 60.9], [170.2, 63.6],
2911 [170.2, 54.5], [170.2, 59.1],
2912 [161.3, 70.5], [167.6, 52.7],
2913 [167.6, 62.7], [165.1, 86.3],
2914 [162.6, 66.4], [152.4, 67.3],
2915 [168.9, 63.0], [170.2, 73.6],
2916 [175.2, 62.3], [175.2, 57.7],
2917 [160.0, 55.4], [165.1, 104.1],
2918 [174.0, 55.5], [170.2, 77.3],
2919 [160.0, 80.5], [167.6, 64.5],
2920 [167.6, 72.3], [167.6, 61.4],
2921 [154.9, 58.2], [162.6, 81.8],
2922 [175.3, 63.6], [171.4, 53.4],
2923 [157.5, 54.5], [165.1, 53.6],
2924 [160.0, 60.0], [174.0, 73.6],
2925 [162.6, 61.4], [174.0, 55.5],
2926 [162.6, 63.6], [161.3, 60.9],
2927 [156.2, 60.0], [149.9, 46.8],
2928 [169.5, 57.3], [160.0, 64.1],
2929 [175.3, 63.6], [169.5, 67.3],
2930 [160.0, 75.5], [172.7, 68.2],
2931 [162.6, 61.4], [157.5, 76.8],
2932 [176.5, 71.8], [164.4, 55.5],
2933 [160.7, 48.6], [174.0, 66.4],
2934 [163.8, 67.3]])
2935
2936 return self._scatterFemaleData
2937
2938
2940 if self._scatterMaleData is not None:
2941 return self._scatterMaleData
2942
2943 self._scatterMaleData = self.getPoints(series,
2944 [[174.0, 65.6],
2945 [175.3, 71.8], [193.5, 80.7],
2946 [186.5, 72.6], [187.2, 78.8],
2947 [181.5, 74.8], [184.0, 86.4],
2948 [184.5, 78.4], [175.0, 62.0],
2949 [184.0, 81.6], [180.0, 76.6],
2950 [177.8, 83.6], [192.0, 90.0],
2951 [176.0, 74.6], [174.0, 71.0],
2952 [184.0, 79.6], [192.7, 93.8],
2953 [171.5, 70.0], [173.0, 72.4],
2954 [176.0, 85.9], [176.0, 78.8],
2955 [180.5, 77.8], [172.7, 66.2],
2956 [176.0, 86.4], [173.5, 81.8],
2957 [178.0, 89.6], [180.3, 82.8],
2958 [180.3, 76.4], [164.5, 63.2],
2959 [173.0, 60.9], [183.5, 74.8],
2960 [175.5, 70.0], [188.0, 72.4],
2961 [189.2, 84.1], [172.8, 69.1],
2962 [170.0, 59.5], [182.0, 67.2],
2963 [170.0, 61.3], [177.8, 68.6],
2964 [184.2, 80.1], [186.7, 87.8],
2965 [171.4, 84.7], [172.7, 73.4],
2966 [175.3, 72.1], [180.3, 82.6],
2967 [182.9, 88.7], [188.0, 84.1],
2968 [177.2, 94.1], [172.1, 74.9],
2969 [167.0, 59.1], [169.5, 75.6],
2970 [174.0, 86.2], [172.7, 75.3],
2971 [182.2, 87.1], [164.1, 55.2],
2972 [163.0, 57.0], [171.5, 61.4],
2973 [184.2, 76.8], [174.0, 86.8],
2974 [174.0, 72.2], [177.0, 71.6],
2975 [186.0, 84.8], [167.0, 68.2],
2976 [171.8, 66.1], [182.0, 72.0],
2977 [167.0, 64.6], [177.8, 74.8],
2978 [164.5, 70.0], [192.0, 101.6],
2979 [175.5, 63.2], [171.2, 79.1],
2980 [181.6, 78.9], [167.4, 67.7],
2981 [181.1, 66.0], [177.0, 68.2],
2982 [174.5, 63.9], [177.5, 72.0],
2983 [170.5, 56.8], [182.4, 74.5],
2984 [197.1, 90.9], [180.1, 93.0],
2985 [175.5, 80.9], [180.6, 72.7],
2986 [184.4, 68.0], [175.5, 70.9],
2987 [180.6, 72.5], [177.0, 72.5],
2988 [177.1, 83.4], [181.6, 75.5],
2989 [176.5, 73.0], [175.0, 70.2],
2990 [174.0, 73.4], [165.1, 70.5],
2991 [177.0, 68.9], [192.0, 102.3],
2992 [176.5, 68.4], [169.4, 65.9],
2993 [182.1, 75.7], [179.8, 84.5],
2994 [175.3, 87.7], [184.9, 86.4],
2995 [177.3, 73.2], [167.4, 53.9],
2996 [178.1, 72.0], [168.9, 55.5],
2997 [157.2, 58.4], [180.3, 83.2],
2998 [170.2, 72.7], [177.8, 64.1],
2999 [172.7, 72.3], [165.1, 65.0],
3000 [186.7, 86.4], [165.1, 65.0],
3001 [174.0, 88.6], [175.3, 84.1],
3002 [185.4, 66.8], [177.8, 75.5],
3003 [180.3, 93.2], [180.3, 82.7],
3004 [177.8, 58.0], [177.8, 79.5],
3005 [177.8, 78.6], [177.8, 71.8],
3006 [177.8, 116.4], [163.8, 72.2],
3007 [188.0, 83.6], [198.1, 85.5],
3008 [175.3, 90.9], [166.4, 85.9],
3009 [190.5, 89.1], [166.4, 75.0],
3010 [177.8, 77.7], [179.7, 86.4],
3011 [172.7, 90.9], [190.5, 73.6],
3012 [185.4, 76.4], [168.9, 69.1],
3013 [167.6, 84.5], [175.3, 64.5],
3014 [170.2, 69.1], [190.5, 108.6],
3015 [177.8, 86.4], [190.5, 80.9],
3016 [177.8, 87.7], [184.2, 94.5],
3017 [176.5, 80.2], [177.8, 72.0],
3018 [180.3, 71.4], [171.4, 72.7],
3019 [172.7, 84.1], [172.7, 76.8],
3020 [177.8, 63.6], [177.8, 80.9],
3021 [182.9, 80.9], [170.2, 85.5],
3022 [167.6, 68.6], [175.3, 67.7],
3023 [165.1, 66.4], [185.4, 102.3],
3024 [181.6, 70.5], [172.7, 95.9],
3025 [190.5, 84.1], [179.1, 87.3],
3026 [175.3, 71.8], [170.2, 65.9],
3027 [193.0, 95.9], [171.4, 91.4],
3028 [177.8, 81.8], [177.8, 96.8],
3029 [167.6, 69.1], [167.6, 82.7],
3030 [180.3, 75.5], [182.9, 79.5],
3031 [176.5, 73.6], [186.7, 91.8],
3032 [188.0, 84.1], [188.0, 85.9],
3033 [177.8, 81.8], [174.0, 82.5],
3034 [177.8, 80.5], [171.4, 70.0],
3035 [185.4, 81.8], [185.4, 84.1],
3036 [188.0, 90.5], [188.0, 91.4],
3037 [182.9, 89.1], [176.5, 85.0],
3038 [175.3, 69.1], [175.3, 73.6],
3039 [188.0, 80.5], [188.0, 82.7],
3040 [175.3, 86.4], [170.5, 67.7],
3041 [179.1, 92.7], [177.8, 93.6],
3042 [175.3, 70.9], [182.9, 75.0],
3043 [170.8, 93.2], [188.0, 93.2],
3044 [180.3, 77.7], [177.8, 61.4],
3045 [185.4, 94.1], [168.9, 75.0],
3046 [185.4, 83.6], [180.3, 85.5],
3047 [174.0, 73.9], [167.6, 66.8],
3048 [182.9, 87.3], [160.0, 72.3],
3049 [180.3, 88.6], [167.6, 75.5],
3050 [186.7, 101.4], [175.3, 91.1],
3051 [175.3, 67.3], [175.9, 77.7],
3052 [175.3, 81.8], [179.1, 75.5],
3053 [181.6, 84.5], [177.8, 76.6],
3054 [182.9, 85.0], [177.8, 102.5],
3055 [184.2, 77.3], [179.1, 71.8],
3056 [176.5, 87.9], [188.0, 94.3],
3057 [174.0, 70.9], [167.6, 64.5],
3058 [170.2, 77.3], [167.6, 72.3],
3059 [188.0, 87.3], [174.0, 80.0],
3060 [176.5, 82.3], [180.3, 73.6],
3061 [167.6, 74.1], [188.0, 85.9],
3062 [180.3, 73.2], [167.6, 76.3],
3063 [183.0, 65.9], [183.0, 90.9],
3064 [179.1, 89.1], [170.2, 62.3],
3065 [177.8, 82.7], [179.1, 79.1],
3066 [190.5, 98.2], [177.8, 84.1],
3067 [180.3, 83.2], [180.3, 83.2]])
3068
3069 return self._scatterMaleData
3070
3071
3073 return self.getDateTimePoints(series, [0.8446, 0.8445, 0.8444, 0.8451,
3074 0.8418, 0.8264, 0.8258, 0.8232, 0.8233, 0.8258, 0.8283, 0.8278,
3075 0.8256, 0.8292, 0.8239, 0.8239, 0.8245, 0.8265, 0.8261, 0.8269,
3076 0.8273, 0.8244, 0.8244, 0.8172, 0.8139, 0.8146, 0.8164, 0.82,
3077 0.8269, 0.8269, 0.8269, 0.8258, 0.8247, 0.8286, 0.8289, 0.8316,
3078 0.832, 0.8333, 0.8352, 0.8357, 0.8355, 0.8354, 0.8403, 0.8403,
3079 0.8406, 0.8403, 0.8396, 0.8418, 0.8409, 0.8384, 0.8386, 0.8372,
3080 0.839, 0.84, 0.8389, 0.84, 0.8423, 0.8423, 0.8435, 0.8422,
3081 0.838, 0.8373, 0.8316, 0.8303, 0.8303, 0.8302, 0.8369, 0.84,
3082 0.8385, 0.84, 0.8401, 0.8402, 0.8381, 0.8351, 0.8314, 0.8273,
3083 0.8213, 0.8207, 0.8207, 0.8215, 0.8242, 0.8273, 0.8301, 0.8346,
3084 0.8312, 0.8312, 0.8312, 0.8306, 0.8327, 0.8282, 0.824, 0.8255,
3085 0.8256, 0.8273, 0.8209, 0.8151, 0.8149, 0.8213, 0.8273, 0.8273,
3086 0.8261, 0.8252, 0.824, 0.8262, 0.8258, 0.8261, 0.826, 0.8199,
3087 0.8153, 0.8097, 0.8101, 0.8119, 0.8107, 0.8105, 0.8084, 0.8069,
3088 0.8047, 0.8023, 0.7965, 0.7919, 0.7921, 0.7922, 0.7934, 0.7918,
3089 0.7915, 0.787, 0.7861, 0.7861, 0.7853, 0.7867, 0.7827, 0.7834,
3090 0.7766, 0.7751, 0.7739, 0.7767, 0.7802, 0.7788, 0.7828, 0.7816,
3091 0.7829, 0.783, 0.7829, 0.7781, 0.7811, 0.7831, 0.7826, 0.7855,
3092 0.7855, 0.7845, 0.7798, 0.7777, 0.7822, 0.7785, 0.7744, 0.7743,
3093 0.7726, 0.7766, 0.7806, 0.785, 0.7907, 0.7912, 0.7913, 0.7931,
3094 0.7952, 0.7951, 0.7928, 0.791, 0.7913, 0.7912, 0.7941, 0.7953,
3095 0.7921, 0.7919, 0.7968, 0.7999, 0.7999, 0.7974, 0.7942, 0.796,
3096 0.7969, 0.7862, 0.7821, 0.7821, 0.7821, 0.7811, 0.7833, 0.7849,
3097 0.7819, 0.7809, 0.7809, 0.7827, 0.7848, 0.785, 0.7873, 0.7894,
3098 0.7907, 0.7909, 0.7947, 0.7987, 0.799, 0.7927, 0.79, 0.7878,
3099 0.7878, 0.7907, 0.7922, 0.7937, 0.786, 0.787, 0.7838, 0.7838,
3100 0.7837, 0.7836, 0.7806, 0.7825, 0.7798, 0.777, 0.777, 0.7772,
3101 0.7793, 0.7788, 0.7785, 0.7832, 0.7865, 0.7865, 0.7853, 0.7847,
3102 0.7809, 0.778, 0.7799, 0.78, 0.7801, 0.7765, 0.7785, 0.7811,
3103 0.782, 0.7835, 0.7845, 0.7844, 0.782, 0.7811, 0.7795, 0.7794,
3104 0.7806, 0.7794, 0.7794, 0.7778, 0.7793, 0.7808, 0.7824, 0.787,
3105 0.7894, 0.7893, 0.7882, 0.7871, 0.7882, 0.7871, 0.7878, 0.79,
3106 0.7901, 0.7898, 0.7879, 0.7886, 0.7858, 0.7814, 0.7825, 0.7826,
3107 0.7826, 0.786, 0.7878, 0.7868, 0.7883, 0.7893, 0.7892, 0.7876,
3108 0.785, 0.787, 0.7873, 0.7901, 0.7936, 0.7939, 0.7938, 0.7956,
3109 0.7975, 0.7978, 0.7972, 0.7995, 0.7995, 0.7994, 0.7976, 0.7977,
3110 0.796, 0.7922, 0.7928, 0.7929, 0.7948, 0.797, 0.7953, 0.7907,
3111 0.7872, 0.7852, 0.7852, 0.786, 0.7862, 0.7836, 0.7837, 0.784,
3112 0.7867, 0.7867, 0.7869, 0.7837, 0.7827, 0.7825, 0.7779, 0.7791,
3113 0.779, 0.7787, 0.78, 0.7807, 0.7803, 0.7817, 0.7799, 0.7799,
3114 0.7795, 0.7801, 0.7765, 0.7725, 0.7683, 0.7641, 0.7639, 0.7616,
3115 0.7608, 0.759, 0.7582, 0.7539, 0.75, 0.75, 0.7507, 0.7505,
3116 0.7516, 0.7522, 0.7531, 0.7577, 0.7577, 0.7582, 0.755, 0.7542,
3117 0.7576, 0.7616, 0.7648, 0.7648, 0.7641, 0.7614, 0.757, 0.7587,
3118 0.7588, 0.762, 0.762, 0.7617, 0.7618, 0.7615, 0.7612, 0.7596,
3119 0.758, 0.758, 0.758, 0.7547, 0.7549, 0.7613, 0.7655, 0.7693,
3120 0.7694, 0.7688, 0.7678, 0.7708, 0.7727, 0.7749, 0.7741, 0.7741,
3121 0.7732, 0.7727, 0.7737, 0.7724, 0.7712, 0.772, 0.7721, 0.7717,
3122 0.7704, 0.769, 0.7711, 0.774, 0.7745, 0.7745, 0.774, 0.7716,
3123 0.7713, 0.7678, 0.7688, 0.7718, 0.7718, 0.7728, 0.7729, 0.7698,
3124 0.7685, 0.7681, 0.769, 0.769, 0.7698, 0.7699, 0.7651, 0.7613,
3125 0.7616, 0.7614, 0.7614, 0.7607, 0.7602, 0.7611, 0.7622, 0.7615,
3126 0.7598, 0.7598, 0.7592, 0.7573, 0.7566, 0.7567, 0.7591, 0.7582,
3127 0.7585, 0.7613, 0.7631, 0.7615, 0.76, 0.7613, 0.7627, 0.7627,
3128 0.7608, 0.7583, 0.7575, 0.7562, 0.752, 0.7512, 0.7512, 0.7517,
3129 0.752, 0.7511, 0.748, 0.7509, 0.7531, 0.7531, 0.7527, 0.7498,
3130 0.7493, 0.7504, 0.75, 0.7491, 0.7491, 0.7485, 0.7484, 0.7492,
3131 0.7471, 0.7459, 0.7477, 0.7477, 0.7483, 0.7458, 0.7448, 0.743,
3132 0.7399, 0.7395, 0.7395, 0.7378, 0.7382, 0.7362, 0.7355, 0.7348,
3133 0.7361, 0.7361, 0.7365, 0.7362, 0.7331, 0.7339, 0.7344, 0.7327,
3134 0.7327, 0.7336, 0.7333, 0.7359, 0.7359, 0.7372, 0.736, 0.736,
3135 0.735, 0.7365, 0.7384, 0.7395, 0.7413, 0.7397, 0.7396, 0.7385,
3136 0.7378, 0.7366, 0.74, 0.7411, 0.7406, 0.7405, 0.7414, 0.7431,
3137 0.7431, 0.7438, 0.7443, 0.7443, 0.7443, 0.7434, 0.7429, 0.7442,
3138 0.744, 0.7439, 0.7437, 0.7437, 0.7429, 0.7403, 0.7399, 0.7418,
3139 0.7468, 0.748, 0.748, 0.749, 0.7494, 0.7522, 0.7515, 0.7502,
3140 0.7472, 0.7472, 0.7462, 0.7455, 0.7449, 0.7467, 0.7458, 0.7427,
3141 0.7427, 0.743, 0.7429, 0.744, 0.743, 0.7422, 0.7388, 0.7388,
3142 0.7369, 0.7345, 0.7345, 0.7345, 0.7352, 0.7341, 0.7341, 0.734,
3143 0.7324, 0.7272, 0.7264, 0.7255, 0.7258, 0.7258, 0.7256, 0.7257,
3144 0.7247, 0.7243, 0.7244, 0.7235, 0.7235, 0.7235, 0.7235, 0.7262,
3145 0.7288, 0.7301, 0.7337, 0.7337, 0.7324, 0.7297, 0.7317, 0.7315,
3146 0.7288, 0.7263, 0.7263, 0.7242, 0.7253, 0.7264, 0.727, 0.7312,
3147 0.7305, 0.7305, 0.7318, 0.7358, 0.7409, 0.7454, 0.7437, 0.7424,
3148 0.7424, 0.7415, 0.7419, 0.7414, 0.7377, 0.7355, 0.7315, 0.7315,
3149 0.732, 0.7332, 0.7346, 0.7328, 0.7323, 0.734, 0.734, 0.7336,
3150 0.7351, 0.7346, 0.7321, 0.7294, 0.7266, 0.7266, 0.7254, 0.7242,
3151 0.7213, 0.7197, 0.7209, 0.721, 0.721, 0.721, 0.7209, 0.7159,
3152 0.7133, 0.7105, 0.7099, 0.7099, 0.7093, 0.7093, 0.7076, 0.707,
3153 0.7049, 0.7012, 0.7011, 0.7019, 0.7046, 0.7063, 0.7089, 0.7077,
3154 0.7077, 0.7077, 0.7091, 0.7118, 0.7079, 0.7053, 0.705, 0.7055,
3155 0.7055, 0.7045, 0.7051, 0.7051, 0.7017, 0.7, 0.6995, 0.6994,
3156 0.7014, 0.7036, 0.7021, 0.7002, 0.6967, 0.695, 0.695, 0.6939,
3157 0.694, 0.6922, 0.6919, 0.6914, 0.6894, 0.6891, 0.6904, 0.689,
3158 0.6834, 0.6823, 0.6807, 0.6815, 0.6815, 0.6847, 0.6859, 0.6822,
3159 0.6827, 0.6837, 0.6823, 0.6822, 0.6822, 0.6792, 0.6746, 0.6735,
3160 0.6731, 0.6742, 0.6744, 0.6739, 0.6731, 0.6761, 0.6761, 0.6785,
3161 0.6818, 0.6836, 0.6823, 0.6805, 0.6793, 0.6849, 0.6833, 0.6825,
3162 0.6825, 0.6816, 0.6799, 0.6813, 0.6809, 0.6868, 0.6933, 0.6933,
3163 0.6945, 0.6944, 0.6946, 0.6964, 0.6965, 0.6956, 0.6956, 0.695,
3164 0.6948, 0.6928, 0.6887, 0.6824, 0.6794, 0.6794, 0.6803, 0.6855,
3165 0.6824, 0.6791, 0.6783, 0.6785, 0.6785, 0.6797, 0.68, 0.6803,
3166 0.6805, 0.676, 0.677, 0.677, 0.6736, 0.6726, 0.6764, 0.6821,
3167 0.6831, 0.6842, 0.6842, 0.6887, 0.6903, 0.6848, 0.6824, 0.6788,
3168 0.6814, 0.6814, 0.6797, 0.6769, 0.6765, 0.6733, 0.6729, 0.6758,
3169 0.6758, 0.675, 0.678, 0.6833, 0.6856, 0.6903, 0.6896, 0.6896,
3170 0.6882, 0.6879, 0.6862, 0.6852, 0.6823, 0.6813, 0.6813, 0.6822,
3171 0.6802, 0.6802, 0.6784, 0.6748, 0.6747, 0.6747, 0.6748, 0.6733,
3172 0.665, 0.6611, 0.6583, 0.659, 0.659, 0.6581, 0.6578, 0.6574,
3173 0.6532, 0.6502, 0.6514, 0.6514, 0.6507, 0.651, 0.6489, 0.6424,
3174 0.6406, 0.6382, 0.6382, 0.6341, 0.6344, 0.6378, 0.6439, 0.6478,
3175 0.6481, 0.6481, 0.6494, 0.6438, 0.6377, 0.6329, 0.6336, 0.6333,
3176 0.6333, 0.633, 0.6371, 0.6403, 0.6396, 0.6364, 0.6356, 0.6356,
3177 0.6368, 0.6357, 0.6354, 0.632, 0.6332, 0.6328, 0.6331, 0.6342,
3178 0.6321, 0.6302, 0.6278, 0.6308, 0.6324, 0.6324, 0.6307, 0.6277,
3179 0.6269, 0.6335, 0.6392, 0.64, 0.6401, 0.6396, 0.6407, 0.6423,
3180 0.6429, 0.6472, 0.6485, 0.6486, 0.6467, 0.6444, 0.6467, 0.6509,
3181 0.6478, 0.6461, 0.6461, 0.6468, 0.6449, 0.647, 0.6461, 0.6452,
3182 0.6422, 0.6422, 0.6425, 0.6414, 0.6366, 0.6346, 0.635, 0.6346,
3183 0.6346, 0.6343, 0.6346, 0.6379, 0.6416, 0.6442, 0.6431, 0.6431,
3184 0.6435, 0.644, 0.6473, 0.6469, 0.6386, 0.6356, 0.634, 0.6346,
3185 0.643, 0.6452, 0.6467, 0.6506, 0.6504, 0.6503, 0.6481, 0.6451,
3186 0.645, 0.6441, 0.6414, 0.6409, 0.6409, 0.6428, 0.6431, 0.6418,
3187 0.6371, 0.6349, 0.6333, 0.6334, 0.6338, 0.6342, 0.632, 0.6318,
3188 0.637, 0.6368, 0.6368, 0.6383, 0.6371, 0.6371, 0.6355, 0.632,
3189 0.6277, 0.6276, 0.6291, 0.6274, 0.6293, 0.6311, 0.631, 0.6312,
3190 0.6312, 0.6304, 0.6294, 0.6348, 0.6378, 0.6368, 0.6368, 0.6368,
3191 0.636, 0.637, 0.6418, 0.6411, 0.6435, 0.6427, 0.6427, 0.6419,
3192 0.6446, 0.6468, 0.6487, 0.6594, 0.6666, 0.6666, 0.6678, 0.6712,
3193 0.6705, 0.6718, 0.6784, 0.6811, 0.6811, 0.6794, 0.6804, 0.6781,
3194 0.6756, 0.6735, 0.6763, 0.6762, 0.6777, 0.6815, 0.6802, 0.678,
3195 0.6796, 0.6817, 0.6817, 0.6832, 0.6877, 0.6912, 0.6914, 0.7009,
3196 0.7012, 0.701, 0.7005, 0.7076, 0.7087, 0.717, 0.7105, 0.7031,
3197 0.7029, 0.7006, 0.7035, 0.7045, 0.6956, 0.6988, 0.6915, 0.6914,
3198 0.6859, 0.6778, 0.6815, 0.6815, 0.6843, 0.6846, 0.6846, 0.6923,
3199 0.6997, 0.7098, 0.7188, 0.7232, 0.7262, 0.7266, 0.7359, 0.7368,
3200 0.7337, 0.7317, 0.7387, 0.7467, 0.7461, 0.7366, 0.7319, 0.7361,
3201 0.7437, 0.7432, 0.7461, 0.7461, 0.7454, 0.7549, 0.7742, 0.7801,
3202 0.7903, 0.7876, 0.7928, 0.7991, 0.8007, 0.7823, 0.7661, 0.785,
3203 0.7863, 0.7862, 0.7821, 0.7858, 0.7731, 0.7779, 0.7844, 0.7866,
3204 0.7864, 0.7788, 0.7875, 0.7971, 0.8004, 0.7857, 0.7932, 0.7938,
3205 0.7927, 0.7918, 0.7919, 0.7989, 0.7988, 0.7949, 0.7948, 0.7882,
3206 0.7745, 0.771, 0.775, 0.7791, 0.7882, 0.7882, 0.7899, 0.7905,
3207 0.7889, 0.7879, 0.7855, 0.7866, 0.7865, 0.7795, 0.7758, 0.7717,
3208 0.761, 0.7497, 0.7471, 0.7473, 0.7407, 0.7288, 0.7074, 0.6927,
3209 0.7083, 0.7191, 0.719, 0.7153, 0.7156, 0.7158, 0.714, 0.7119,
3210 0.7129, 0.7129, 0.7049, 0.7095])
3211
3212
3214 return self.getDateTimePoints(series, [0.8446, 0.8445, 0.8444, 0.8451,
3215 0.8418, 0.8264, 0.8258, 0.8232, 0.8233, 0.8258, 0.8283, 0.8278,
3216 0.8256, 0.8292, 0.8239, 0.8239, 0.8245, 0.8265, 0.8261, 0.8269,
3217 0.8273, 0.8244, 0.8244, 0.8172, 0.8139, 0.8146, 0.8164, 0.82,
3218 0.8269, 0.8269, 0.8269, 0.8258, 0.8247, 0.8286, 0.8289, 0.8316,
3219 0.832, 0.8333, 0.8352, 0.8357, 0.8355, 0.8354, 0.8403, 0.8403,
3220 0.8406, 0.8403, 0.8396, 0.8418, 0.8409, 0.8384, 0.8386, 0.8372,
3221 0.839, 0.84, 0.8389, 0.84, 0.8423, 0.8423, 0.8435, 0.8422,
3222 0.838, 0.8373, 0.8316, 0.8303, 0.8303, 0.8302, 0.8369, 0.84,
3223 0.8385, 0.84, 0.8401, 0.8402, 0.8381, 0.8351, 0.8314, 0.8273,
3224 0.8213, 0.8207, 0.8207, 0.8215, 0.8242, 0.8273, 0.8301, 0.8346,
3225 0.8312, 0.8312, 0.8312, 0.8306, 0.8327, 0.8282, 0.824, 0.8255,
3226 0.8256, 0.8273, 0.8209, 0.8151, 0.8149, 0.8213, 0.8273, 0.8273,
3227 0.8261, 0.8252, 0.824, 0.8262, 0.8258, 0.8261, 0.826, 0.8199,
3228 0.8153, 0.8097, 0.8101, 0.8119, 0.8107, 0.8105, 0.8084, 0.8069,
3229 0.8047, 0.8023, 0.7965, 0.7919, 0.7921, 0.7922, 0.7934, 0.7918,
3230 0.7915, 0.787, 0.7861, 0.7861, 0.7853, 0.7867, 0.7827, 0.7834,
3231 0.7766, 0.7751, 0.7739, 0.7767, 0.7802, 0.7788, 0.7828, 0.7816,
3232 0.7829, 0.783, 0.7829, 0.7781, 0.7811, 0.7831, 0.7826, 0.7855,
3233 0.7855, 0.7845, 0.7798, 0.7777, 0.7822, 0.7785, 0.7744, 0.7743,
3234 0.7726, 0.7766, 0.7806, 0.785, 0.7907, 0.7912, 0.7913, 0.7931,
3235 0.7952, 0.7951, 0.7928, 0.791, 0.7913, 0.7912, 0.7941, 0.7953,
3236 0.7921, 0.7919, 0.7968, 0.7999, 0.7999, 0.7974, 0.7942, 0.796,
3237 0.7969, 0.7862, 0.7821, 0.7821, 0.7821, 0.7811, 0.7833, 0.7849,
3238 0.7819, 0.7809, 0.7809, 0.7827, 0.7848, 0.785, 0.7873, 0.7894,
3239 0.7907, 0.7909, 0.7947, 0.7987, 0.799, 0.7927, 0.79, 0.7878,
3240 0.7878, 0.7907, 0.7922, 0.7937, 0.786, 0.787, 0.7838, 0.7838,
3241 0.7837, 0.7836, 0.7806, 0.7825, 0.7798, 0.777, 0.777, 0.7772,
3242 0.7793, 0.7788, 0.7785, 0.7832, 0.7865, 0.7865, 0.7853, 0.7847,
3243 0.7809, 0.778, 0.7799, 0.78, 0.7801, 0.7765, 0.7785, 0.7811,
3244 0.782, 0.7835, 0.7845, 0.7844, 0.782, 0.7811, 0.7795, 0.7794,
3245 0.7806, 0.7794, 0.7794, 0.7778, 0.7793, 0.7808, 0.7824, 0.787,
3246 0.7894, 0.7893, 0.7882, 0.7871, 0.7882, 0.7871, 0.7878, 0.79,
3247 0.7901, 0.7898, 0.7879, 0.7886, 0.7858, 0.7814, 0.7825, 0.7826,
3248 0.7826, 0.786, 0.7878, 0.7868, 0.7883, 0.7893, 0.7892, 0.7876,
3249 0.785, 0.787, 0.7873, 0.7901, 0.7936, 0.7939, 0.7938, 0.7956,
3250 0.7975, 0.7978, 0.7972, 0.7995, 0.7995, 0.7994, 0.7976, 0.7977,
3251 0.796, 0.7922, 0.7928, 0.7929, 0.7948, 0.797, 0.7953, 0.7907,
3252 0.7872, 0.7852, 0.7852, 0.786, 0.7862, 0.7836, 0.7837, 0.784,
3253 0.7867, 0.7867, 0.7869, 0.7837, 0.7827, 0.7825, 0.7779, 0.7791,
3254 0.779, 0.7787, 0.78, 0.7807, 0.7803, 0.7817, 0.7799, 0.7799,
3255 0.7795, 0.7801, 0.7765, 0.7725, 0.7683, 0.7641, 0.7639, 0.7616,
3256 0.7608, 0.759, 0.7582, 0.7539, 0.75, 0.75, 0.7507, 0.7505,
3257 0.7516, 0.7522, 0.7531, 0.7577, 0.7577, 0.7582, 0.755, 0.7542,
3258 0.7576, 0.7616, 0.7648, 0.7648, 0.7641, 0.7614, 0.757, 0.7587,
3259 0.7588, 0.762, 0.762, 0.7617, 0.7618, 0.7615, 0.7612, 0.7596,
3260 0.758, 0.758, 0.758, 0.7547, 0.7549, 0.7613, 0.7655, 0.7693,
3261 0.7694, 0.7688, 0.7678, 0.7708, 0.7727, 0.7749, 0.7741, 0.7741,
3262 0.7732, 0.7727, 0.7737, 0.7724, 0.7712, 0.772, 0.7721, 0.7717,
3263 0.7704, 0.769, 0.7711, 0.774, 0.7745, 0.7745, 0.774, 0.7716,
3264 0.7713, 0.7678, 0.7688, 0.7718, 0.7718, 0.7728, 0.7729, 0.7698,
3265 0.7685, 0.7681, 0.769, 0.769, 0.7698, 0.7699, 0.7651, 0.7613,
3266 0.7616, 0.7614, 0.7614, 0.7607, 0.7602, 0.7611, 0.7622, 0.7615,
3267 0.7598, 0.7598, 0.7592, 0.7573, 0.7566, 0.7567, 0.7591, 0.7582,
3268 0.7585, 0.7613, 0.7631, 0.7615, 0.76, 0.7613, 0.7627, 0.7627,
3269 0.7608, 0.7583, 0.7575, 0.7562, 0.752, 0.7512, 0.7512, 0.7517,
3270 0.752, 0.7511, 0.748, 0.7509, 0.7531, 0.7531, 0.7527, 0.7498,
3271 0.7493, 0.7504, 0.75, 0.7491, 0.7491, 0.7485, 0.7484, 0.7492,
3272 0.7471, 0.7459, 0.7477, 0.7477, 0.7483, 0.7458, 0.7448, 0.743,
3273 0.7399, 0.7395, 0.7395, 0.7378, 0.7382, 0.7362, 0.7355, 0.7348,
3274 0.7361, 0.7361, 0.7365, 0.7362, 0.7331, 0.7339, 0.7344, 0.7327,
3275 0.7327, 0.7336, 0.7333, 0.7359, 0.7359, 0.7372, 0.736, 0.736,
3276 0.735, 0.7365, 0.7384, 0.7395, 0.7413, 0.7397, 0.7396, 0.7385,
3277 0.7378, 0.7366, 0.74, 0.7411, 0.7406, 0.7405, 0.7414, 0.7431,
3278 0.7431, 0.7438, 0.7443, 0.7443, 0.7443, 0.7434, 0.7429, 0.7442,
3279 0.744, 0.7439, 0.7437, 0.7437, 0.7429, 0.7403, 0.7399, 0.7418,
3280 0.7468, 0.748, 0.748, 0.749, 0.7494, 0.7522, 0.7515, 0.7502,
3281 0.7472, 0.7472, 0.7462, 0.7455, 0.7449, 0.7467, 0.7458, 0.7427,
3282 0.7427, 0.743, 0.7429, 0.744, 0.743, 0.7422, 0.7388, 0.7388,
3283 0.7369, 0.7345, 0.7345, 0.7345, 0.7352, 0.7341, 0.7341, 0.734,
3284 0.7324, 0.7272, 0.7264, 0.7255, 0.7258, 0.7258, 0.7256, 0.7257,
3285 0.7247, 0.7243, 0.7244, 0.7235, 0.7235, 0.7235, 0.7235, 0.7262,
3286 0.7288, 0.7301, 0.7337, 0.7337, 0.7324, 0.7297, 0.7317, 0.7315,
3287 0.7288, 0.7263, 0.7263, 0.7242, 0.7253, 0.7264, 0.727, 0.7312,
3288 0.7305, 0.7305, 0.7318, 0.7358, 0.7409, 0.7454, 0.7437, 0.7424,
3289 0.7424, 0.7415, 0.7419, 0.7414, 0.7377, 0.7355, 0.7315, 0.7315,
3290 0.732, 0.7332, 0.7346, 0.7328, 0.7323, 0.734, 0.734, 0.7336,
3291 0.7351, 0.7346, 0.7321, 0.7294, 0.7266, 0.7266, 0.7254, 0.7242,
3292 0.7213, 0.7197, 0.7209, 0.721, 0.721, 0.721, 0.7209, 0.7159,
3293 0.7133, 0.7105, 0.7099, 0.7099, 0.7093, 0.7093, 0.7076, 0.707,
3294 0.7049, 0.7012, 0.7011, 0.7019, 0.7046, 0.7063, 0.7089, 0.7077,
3295 0.7077, 0.7077, 0.7091, 0.7118, 0.7079, 0.7053, 0.705, 0.7055,
3296 0.7055, 0.7045, 0.7051, 0.7051, 0.7017, 0.7, 0.6995, 0.6994,
3297 0.7014, 0.7036, 0.7021, 0.7002, 0.6967, 0.695, 0.695, 0.6939,
3298 0.694, 0.6922, 0.6919, 0.6914, 0.6894, 0.6891, 0.6904, 0.689,
3299 0.6834, 0.6823, 0.6807, 0.6815, 0.6815, 0.6847, 0.6859, 0.6822,
3300 0.6827, 0.6837, 0.6823, 0.6822, 0.6822, 0.6792, 0.6746, 0.6735,
3301 0.6731, 0.6742, 0.6744, 0.6739, 0.6731, 0.6761, 0.6761, 0.6785,
3302 0.6818, 0.6836, 0.6823, 0.6805, 0.6793, 0.6849, 0.6833, 0.6825,
3303 0.6825, 0.6816, 0.6799, 0.6813, 0.6809, 0.6868, 0.6933, 0.6933,
3304 0.6945, 0.6944, 0.6946, 0.6964, 0.6965, 0.6956, 0.6956, 0.695,
3305 0.6948, 0.6928, 0.6887, 0.6824, 0.6794, 0.6794, 0.6803, 0.6855,
3306 0.6824, 0.6791, 0.6783, 0.6785, 0.6785, 0.6797, 0.68, 0.6803,
3307 0.6805, 0.676, 0.677, 0.677, 0.6736, 0.6726, 0.6764, 0.6821,
3308 0.6831, 0.6842, 0.6842, 0.6887, 0.6903, 0.6848, 0.6824, 0.6788,
3309 0.6814, 0.6814, 0.6797, 0.6769, 0.6765, 0.6733, 0.6729, 0.6758,
3310 0.6758, 0.675, 0.678, 0.6833, 0.6856, 0.6903, 0.6896, 0.6896,
3311 0.6882, 0.6879, 0.6862, 0.6852, 0.6823, 0.6813, 0.6813, 0.6822,
3312 0.6802, 0.6802, 0.6784, 0.6748, 0.6747, 0.6747, 0.6748, 0.6733,
3313 0.665, 0.6611, 0.6583, 0.659, 0.659, 0.6581, 0.6578, 0.6574,
3314 0.6532, 0.6502, 0.6514, 0.6514, 0.6507, 0.651, 0.6489, 0.6424,
3315 0.6406, 0.6382, 0.6382, 0.6341, 0.6344, 0.6378, 0.6439, 0.6478,
3316 0.6481, 0.6481, 0.6494, 0.6438, 0.6377, 0.6329, 0.6336, 0.6333,
3317 0.6333, 0.633, 0.6371, 0.6403, 0.6396, 0.6364, 0.6356, 0.6356,
3318 0.6368, 0.6357, 0.6354, 0.632, 0.6332, 0.6328, 0.6331, 0.6342,
3319 0.6321, 0.6302, 0.6278, 0.6308, 0.6324, 0.6324, 0.6307, 0.6277,
3320 0.6269, 0.6335, 0.6392, 0.64, 0.6401, 0.6396, 0.6407, 0.6423,
3321 0.6429, 0.6472, 0.6485, 0.6486, 0.6467, 0.6444, 0.6467, 0.6509,
3322 0.6478, 0.6461, 0.6461, 0.6468, 0.6449, 0.647, 0.6461, 0.6452,
3323 0.6422, 0.6422, 0.6425, 0.6414, 0.6366, 0.6346, 0.635, 0.6346,
3324 0.6346, 0.6343, 0.6346, 0.6379, 0.6416, 0.6442, 0.6431, 0.6431,
3325 0.6435, 0.644, 0.6473, 0.6469, 0.6386, 0.6356, 0.634, 0.6346,
3326 0.643, 0.6452, 0.6467, 0.6506, 0.6504, 0.6503, 0.6481, 0.6451,
3327 0.645, 0.6441, 0.6414, 0.6409, 0.6409, 0.6428, 0.6431, 0.6418,
3328 0.6371, 0.6349, 0.6333, 0.6334, 0.6338, 0.6342, 0.632, 0.6318,
3329 0.637, 0.6368, 0.6368, 0.6383, 0.6371, 0.6371, 0.6355, 0.632,
3330 0.6277, 0.6276, 0.6291, 0.6274, 0.6293, 0.6311, 0.631, 0.6312,
3331 0.6312, 0.6304, 0.6294, 0.6348, 0.6378, 0.6368, 0.6368, 0.6368,
3332 0.636, 0.637, 0.6418, 0.6411, 0.6435, 0.6427, 0.6427, 0.6419,
3333 0.6446, 0.6468, 0.6487, 0.6594, 0.6666, 0.6666, 0.6678, 0.6712,
3334 0.6705, 0.6718, 0.6784, 0.6811, 0.6811, 0.6794, 0.6804, 0.6781,
3335 0.6756, 0.6735, 0.6763, 0.6762, 0.6777, 0.6815, 0.6802, 0.678,
3336 0.6796, 0.6817, 0.6817, 0.6832, 0.6877, 0.6912, 0.6914, 0.7009,
3337 0.7012, 0.701, 0.7005, 0.7076, 0.7087, 0.717, 0.7105, 0.7031,
3338 0.7029, 0.7006, 0.7035, 0.7045, 0.6956, 0.6988, 0.6915, 0.6914,
3339 0.6859, 0.6778, 0.6815, 0.6815, 0.6843, 0.6846, 0.6846, 0.6923,
3340 0.6997, 0.7098, 0.7188, 0.7232, 0.7262, 0.7266, 0.7359, 0.7368,
3341 0.7337, 0.7317, 0.7387, 0.7467, 0.7461, 0.7366, 0.7319, 0.7361,
3342 0.7437, 0.7432, 0.7461, 0.7461, 0.7454, 0.7549, 0.7742, 0.7801,
3343 0.7903, 0.7876, 0.7928, 0.7991, 0.8007, 0.7823, 0.7661, 0.785,
3344 0.7863, 0.7862, 0.7821, 0.7858, 0.7731, 0.7779, 0.7844, 0.7866,
3345 0.7864, 0.7788, 0.7875, 0.7971, 0.8004, 0.7857, 0.7932, 0.7938,
3346 0.7927, 0.7918, 0.7919, 0.7989, 0.7988, 0.7949, 0.7948, 0.7882,
3347 0.7745, 0.771, 0.775, 0.7791, 0.7882, 0.7882, 0.7899, 0.7905,
3348 0.7889, 0.7879, 0.7855, 0.7866, 0.7865, 0.7795, 0.7758, 0.7717,
3349 0.761, 0.7497, 0.7471, 0.7473, 0.7407, 0.7288, 0.7074, 0.6927,
3350 0.7083, 0.7191, 0.719, 0.7153, 0.7156, 0.7158, 0.714, 0.7119,
3351 0.7129, 0.7129, 0.7049, 0.7095])
3352
3355
3356 - def __init__(self, window, masterChart, detailChart):
3357 self._window = window
3358 self._masterChart = masterChart
3359 self._detailChart = detailChart
3360
3361
3363
3364 masterChartSeries = self._masterChart.getSeries('USD to EUR')
3365
3366 min_ = chartZoomEvent.getChartArea().getxAxisMin()
3367 max_ = chartZoomEvent.getChartArea().getxAxisMax()
3368
3369 detailPoints = set()
3370 detailChartSeries = self._detailChart.getSeries('USD to EUR')
3371 self._detailChart.removeSeries(detailChartSeries)
3372
3373 for point in masterChartSeries.getPoints():
3374 if (timestamp(point.getX()) > min_
3375 and timestamp(point.getX()) < max_):
3376 dtp = DateTimePoint(detailChartSeries,
3377 point.getX(), point.getY())
3378 detailPoints.add(dtp)
3379
3380
3381 detailChartSeries.setSeriesPoints(detailPoints)
3382 self._detailChart.addSeries(detailChartSeries)
3383 self._detailChart.refresh()
3384
3385
3386 masterDateTimeAxis = iter(self._masterChart.getConfig().getXAxes()).next()
3387 masterDateTimeAxis.removePlotBand('mask-before')
3388 plotBandBefore = DateTimePlotBand('mask-before')
3389 plotBandBefore.setRange(DateTimeRange(self._window._masterChartMinDate,
3390 datetime.fromtimestamp(min_ / 1e03)))
3391 plotBandBefore.setColor(RGBA(0, 0, 0, 0.2))
3392 masterDateTimeAxis.addPlotBand(plotBandBefore)
3393
3394 masterDateTimeAxis.removePlotBand('mask-after')
3395 plotBandAfter = DateTimePlotBand('mask-after')
3396 plotBandAfter.setRange(DateTimeRange(
3397 datetime.fromtimestamp(max_ / 1e03),
3398 self._window._masterChartMaxDate))
3399 plotBandAfter.setColor(RGBA(0, 0, 0, 0.2))
3400 masterDateTimeAxis.addPlotBand(plotBandAfter)
3401 self._masterChart.refresh()
3402
3419
3438
3441
3446
3447
3449 self._keepUpdating = False
3450 print 'stopUpdating ' + self._keepUpdating
3451
3452
3454 return self._keepUpdating
3455
3456
3458 while self.keepUpdating():
3459
3460 try:
3461 sleep(1000)
3462 except KeyboardInterrupt, e:
3463 print ('InterruptedException occured. Exception message '
3464 + str(e))
3465 seriesData = self._chart.getSeries('Random Data')
3466 seriesData.addPoint(DateTimePoint(seriesData, datetime(),
3467 random()), True)
3468 print 'Inside run() keepUpdating ' + self._keepUpdating
3469
3472
3474 self._window = window
3475 self._chart = chart
3476
3481
3484
3487
3489 self._window.logEventInfo('[svgAvailable]' + ' svg -> '
3490 + chartSVGAvailableEvent.getSVG())
3491
3500
3513
3526
3535
3538
3541
3543 EVENT_NAME = 'seriesClick'
3544 if isinstance(seriesClickEvent.getNearestPoint(), DecimalPoint):
3545 self._window.logEventInfo(EVENT_NAME,
3546 seriesClickEvent.getSeries().getName(),
3547 None,
3548 seriesClickEvent.getNearestPoint().getX(),
3549 seriesClickEvent.getNearestPoint().getY(),
3550 seriesClickEvent.getMousePosition().getMouseX(),
3551 seriesClickEvent.getMousePosition().getMouseY())
3552 else:
3553 self._window.logEventInfo(EVENT_NAME,
3554 seriesClickEvent.getSeries().getName(),
3555 None,
3556 seriesClickEvent.getNearestPoint().getX(),
3557 seriesClickEvent.getNearestPoint().getY(),
3558 seriesClickEvent.getMousePosition().getMouseX(),
3559 seriesClickEvent.getMousePosition().getMouseY())
3560
3570
3580
3590
3593
3596
3598 EVENT_NAME = 'pointClick'
3599 if isinstance(pointClickEvent.getPoint(), DecimalPoint):
3600 self._window.logEventInfo(EVENT_NAME,
3601 pointClickEvent.getPoint().getSeries().getName(),
3602 pointClickEvent.getCategory(),
3603 pointClickEvent.getPoint().getX(),
3604 pointClickEvent.getPoint().getY(),
3605 pointClickEvent.getMousePosition().getMouseX(),
3606 pointClickEvent.getMousePosition().getMouseY())
3607 else:
3608 self._window.logEventInfo(EVENT_NAME,
3609 pointClickEvent.getPoint().getSeries().getName(),
3610 pointClickEvent.getCategory(),
3611 pointClickEvent.getPoint().getX(),
3612 pointClickEvent.getPoint().getY(),
3613 pointClickEvent.getMousePosition().getMouseX(),
3614 pointClickEvent.getMousePosition().getMouseY())
3615
3636
3657
3678
3693
3696
3697 BASIC = None
3698 DONUT = None
3699 CLICK_TO_ADD_POINT = None
3700 MASTER_DETAIL = None
3701 TIMESERIES_ZOOMABLE = None
3702 WITH_DATA_LABELS = None
3703 STACKED = None
3704 WITH_NEGATIVE_STACK = None
3705 WITH_NEGATIVE_VALUES = None
3706 STACKED_AND_GROUPED = None
3707 STACKED_PERCENT = None
3708 WITH_ROTATED_LABELS = None
3709 WITH_MISSING_POINTS = None
3710 INVERTED_AXES = None
3711 WITH_LEGEND = None
3712 WITH_PLOTBANDS = None
3713 WITH_SYMBOLS = None
3714 UPDATING_EACH_SECOND = None
3715 COMBINATION_COLUMN_LINE_AND_PIE = None
3716 PERCENTAGE = None
3717 SCATTER_WITH_REGRESSION_LINE = None
3718 MULTIPLE_AXES = None
3719
3722
3725
3726 @classmethod
3728 return [cls.BASIC, cls.DONUT, cls.CLICK_TO_ADD_POINT, cls.MASTER_DETAIL,
3729 cls.TIMESERIES_ZOOMABLE, cls.WITH_DATA_LABELS, cls.STACKED,
3730 cls.WITH_NEGATIVE_STACK, cls.WITH_NEGATIVE_VALUES,
3731 cls.STACKED_AND_GROUPED, cls.STACKED_PERCENT,
3732 cls.WITH_ROTATED_LABELS, cls.WITH_MISSING_POINTS,
3733 cls.INVERTED_AXES, cls.WITH_LEGEND, cls.WITH_PLOTBANDS, cls.WITH_SYMBOLS,
3734 cls.UPDATING_EACH_SECOND, cls.COMBINATION_COLUMN_LINE_AND_PIE,
3735 cls.PERCENTAGE, cls.SCATTER_WITH_REGRESSION_LINE, cls.MULTIPLE_AXES]
3736
3737 ChartName.BASIC = ChartName('Basic')
3738 ChartName.DONUT = ChartName('Donut')
3739 ChartName.CLICK_TO_ADD_POINT = ChartName('Click to add a point')
3740 ChartName.MASTER_DETAIL = ChartName('Master-detail')
3741 ChartName.TIMESERIES_ZOOMABLE = ChartName('Time series, zoomable')
3742 ChartName.WITH_DATA_LABELS = ChartName('With data labels')
3743 ChartName.STACKED = ChartName('Stacked')
3744 ChartName.WITH_NEGATIVE_STACK = ChartName('With negative stack')
3745 ChartName.WITH_NEGATIVE_VALUES = ChartName('With negative values')
3746 ChartName.STACKED_AND_GROUPED = ChartName('Stacked and grouped')
3747 ChartName.STACKED_PERCENT = ChartName('Stacked percentage')
3748 ChartName.WITH_ROTATED_LABELS = ChartName('With rotated labels')
3749 ChartName.WITH_MISSING_POINTS = ChartName('With missing points')
3750 ChartName.INVERTED_AXES = ChartName('Inverted axes')
3751 ChartName.WITH_LEGEND = ChartName('With legend')
3752 ChartName.WITH_PLOTBANDS = ChartName('With plot bands')
3753 ChartName.WITH_SYMBOLS = ChartName('With symbols')
3754 ChartName.UPDATING_EACH_SECOND = ChartName('Updating each second')
3755 ChartName.COMBINATION_COLUMN_LINE_AND_PIE = ChartName('Column, spline and pie')
3756 ChartName.PERCENTAGE = ChartName('Percentage')
3757 ChartName.SCATTER_WITH_REGRESSION_LINE = ChartName('Scatter with regression line')
3758 ChartName.MULTIPLE_AXES = ChartName('Multiple axes')
3762
3763 LINE = None
3764 SPLINE = None
3765 SCATTER = None
3766 AREA = None
3767 AREASPLINE = None
3768 BAR = None
3769 COLUMN = None
3770 PIE = None
3771 COMBINATION = None
3772
3774 self._seriesType = seriesType
3775 self._name = name
3776
3778 return self._seriesType
3779
3782
3783 @classmethod
3787
3788 DemoSeriesType.LINE = DemoSeriesType(SeriesType.LINE, 'Line')
3789 DemoSeriesType.SPLINE = DemoSeriesType(SeriesType.SPLINE, 'Spline')
3790 DemoSeriesType.SCATTER = DemoSeriesType(SeriesType.SCATTER, 'Scatter')
3791 DemoSeriesType.AREA = DemoSeriesType(SeriesType.AREA, 'Area - Line')
3792 DemoSeriesType.AREASPLINE = DemoSeriesType(SeriesType.AREASPLINE, 'Area - Spline')
3793 DemoSeriesType.BAR = DemoSeriesType(SeriesType.BAR, 'Bar')
3794 DemoSeriesType.COLUMN = DemoSeriesType(SeriesType.COLUMN, 'Column')
3795 DemoSeriesType.PIE = DemoSeriesType(SeriesType.PIE, 'Pie')
3796 DemoSeriesType.COMBINATION = DemoSeriesType(SeriesType.COMMONSERIES, 'Combination')
3823
3835