def _lut_manager_properties(lut_manager, **props): """ Internal function used to apply properties to a colorbar. """ need_redraw = False orientation = props.get('orientation', None) if orientation is not None: _orient_colorbar(lut_manager, orientation) colorbar = lut_manager.scalar_bar title = props.get('title', None) if title is not None: colorbar.title = title need_redraw = True label_fmt = props.get('label_fmt', None) if label_fmt is not None: colorbar.label_format = label_fmt need_redraw = True nb_labels = props.get('nb_labels', None) if nb_labels is not None: colorbar.number_of_labels = nb_labels need_redraw = True nb_colors = props.get('nb_colors', None) if nb_colors is not None: colorbar.maximum_number_of_colors = nb_colors need_redraw = True if need_redraw: draw()
def _orient_colorbar(lut_mgr, orientation): """Orients the given LUTManager (make it horizontal or vertical). """ rep = lut_mgr.scalar_bar_representation colorbar = lut_mgr.scalar_bar if orientation == "vertical": if rep is None: # VTK < 5.2 colorbar.orientation = "vertical" else: rep.orientation = 1 rep.position = (0.01, 0.15) rep.position2 = (0.1, 0.8) colorbar.width = 0.1 colorbar.height = 0.8 colorbar.position = (0.01, 0.15) elif orientation == "horizontal": if rep is None: colorbar.orientation = "horizontal" else: rep.orientation = 0 rep.position = (0.1, 0.01) rep.position2 = (0.8, 0.17) colorbar.width = 0.8 colorbar.height = 0.17 colorbar.position = (0.1, 0.01) else: raise ValueError("Unknown orientation: %s" % orientation) draw()
def paintEvent(self, e): painter = QPainter() painter.begin(self) for figure in data.figures: if figure != None: figure.draw(painter) painter.end()
#!/usr/bin/python # -*- coding: utf-8 -*- import fund_list import fl import hold import figure from itertools import islice def chunks(data, SIZE=10000): it = iter(data) for i in range(0, len(data), SIZE): yield {k: data[k] for k in islice(it, SIZE)} if __name__ == "__main__": hold_data = hold.get_hold_data_from_excel() print('hold_data:', hold_data) l = fund_list.get_fund_list() for item in chunks(hold_data, 9): print('9item', item) figure.draw(item, l) figure.show()