Index: trunk/fundraiser-statistics/fundraiser-scripts/classes/DataReporting.py |
— | — | @@ -999,7 +999,7 @@ |
1000 | 1000 | _font_size_ = 24 |
1001 | 1001 | _fig_width_pt_ = 246.0 # Get this from LaTeX using \showthe\columnwidth |
1002 | 1002 | _inches_per_pt_ = 1.0/72.27 # Convert pt to inch |
1003 | | - _use_labels= False |
| 1003 | + _use_labels_= False |
1004 | 1004 | _fig_file_format_ = 'png' |
1005 | 1005 | _plot_type_ = 'line' |
1006 | 1006 | |
— | — | @@ -1011,26 +1011,30 @@ |
1012 | 1012 | loader_type - string which determines the type of dataloader object |
1013 | 1013 | **kwargs - allows plotting parameters to be tuned !! MODIFY -- move up to base class !! |
1014 | 1014 | """ |
1015 | | - def __init__(self, loader_type, **kwargs): |
1016 | | - if loader_type == 'standard': |
1017 | | - self._data_loader_ = DL.IntervalReportingLoader() |
1018 | | - elif loader_type == 'campaign': |
1019 | | - self._data_loader_ = DL.CampaignIntervalReportingLoader() |
| 1015 | + def __init__(self, **kwargs): |
| 1016 | + |
| 1017 | + self._data_loader_ = DL.IntervalReportingLoader() |
1020 | 1018 | |
1021 | 1019 | for key in kwargs: |
| 1020 | + |
1022 | 1021 | if key == 'font_size': |
1023 | | - self._font_size_ = kwargs[key] |
| 1022 | + self._font_size_ = kwargs[key] |
1024 | 1023 | elif key == 'fig_width_pt': |
1025 | | - self._fig_width_pt_ = kwargs[key] |
| 1024 | + self._fig_width_pt_ = kwargs[key] |
1026 | 1025 | elif key == 'inches_per_pt': |
1027 | | - self._inches_per_pt_ = kwargs[key] |
| 1026 | + self._inches_per_pt_ = kwargs[key] |
1028 | 1027 | elif key == 'use_labels': |
1029 | | - self._use_labels = kwargs[key] |
| 1028 | + self._use_labels_ = kwargs[key] |
1030 | 1029 | elif key == 'fig_file_format': |
1031 | | - self._fig_file_format_ = kwargs[key] |
1032 | | - elif key == 'plot_type': |
1033 | | - self._plot_type_ = kwargs[key] |
1034 | | - |
| 1030 | + self._fig_file_format_ = kwargs[key] |
| 1031 | + elif key == 'plot_type': |
| 1032 | + self._plot_type_ = kwargs[key] |
| 1033 | + elif key == 'data_loader': # Set custom data loaders |
| 1034 | + if kwargs[key] == 'campaign_interval': |
| 1035 | + self._data_loader_ = DL.CampaignIntervalReportingLoader() |
| 1036 | + |
| 1037 | + print self._data_loader_.__str__ |
| 1038 | + |
1035 | 1039 | """ |
1036 | 1040 | <description> |
1037 | 1041 | """ |
— | — | @@ -1071,7 +1075,7 @@ |
1072 | 1076 | if self._plot_type_ == 'step': |
1073 | 1077 | pylab.step(times[key], metrics[key], line_types[count]) |
1074 | 1078 | elif self._plot_type_ == 'line': |
1075 | | - pylab.plot(times[key], metrics[key], line_types[count]) |
| 1079 | + pylab.plot(times[key][1:], metrics[key][1:], line_types[count]) |
1076 | 1080 | count = count + 1 |
1077 | 1081 | |
1078 | 1082 | """ Set the figure and font size """ |
— | — | @@ -1106,7 +1110,7 @@ |
1107 | 1111 | pylab.ylabel(ylabel) |
1108 | 1112 | |
1109 | 1113 | pylab.title(title) |
1110 | | - pylab.savefig('./tests/' + fname + '.' + file_format, format=_fig_file_format_) |
| 1114 | + pylab.savefig('./tests/' + fname + '.' + self._fig_file_format_, format=self._fig_file_format_) |
1111 | 1115 | |
1112 | 1116 | |
1113 | 1117 | """ |