def __get_chart_type_heatmap__(self):
     graph_list = []
     if self._index in ['', INDICES.ALL]:
         index_list = [
             INDICES.CRYPTO_CCY, INDICES.DOW_JONES, INDICES.NASDAQ100,
             INDICES.Q_FSE
         ]
         # ToDo Check if Q_FSE works...
     else:
         index_list = [self._index]
     for index in index_list:
         index_for_key = index.replace(' ', '_').lower()
         index_for_key = index_for_key if self._index == '' else '{}_{}'.format(
             index_for_key, 'single')
         chart_id = '{}_{}'.format(self._chart_id, index_for_key)
         # print('__get_chart_type_heatmap__: chart_id={}'.format(chart_id))
         chart_name = index
         graph_api = DccGraphApi(chart_id, chart_name)
         graph_api.figure_data = self.__get_heatmap_figure_data__(index)
         graph_api.figure_layout_height = 200
         graph_api.figure_layout_margin = {
             'b': 50,
             'r': 50,
             'l': 50,
             't': 50
         }
         graph_list.append(MyDCC.graph(graph_api))
     return graph_list
Esempio n. 2
0
 def __get_chart_type_pie__(self):
     graph_api_all = DccGraphApi(self._chart_id + '_all', self._chart_name + ' (all)')
     graph_api_all.figure_data = self.__get_pie_figure_data__('all')
     graph_api_winner = DccGraphApi(self._chart_id + '_winner', self._chart_name + ' (winner)')
     graph_api_winner.figure_data = self.__get_pie_figure_data__('winner')
     graph_api_loser = DccGraphApi(self._chart_id + '_loser', self._chart_name + ' (loser)')
     graph_api_loser.figure_data = self.__get_pie_figure_data__('loser')
     w_h, l_h = self.__get_winner_loser_heights__(graph_api_winner.values_total, graph_api_loser.values_total)
     graph_api_all.figure_layout_height = 800
     graph_api_winner.figure_layout_height = 800
     graph_api_loser.figure_layout_height = 800
     graph_api_loser.figure_layout_height *= w_h
     graph_api_loser.figure_layout_height *= l_h
     graph_api_all.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     graph_api_winner.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     graph_api_loser.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     return [MyDCC.graph(graph_api_all), MyDCC.graph(graph_api_winner), MyDCC.graph(graph_api_loser)]
    def __get_chart_type_mood__(self):
        graph_list = []
        if self._index in ['', INDICES.ALL]:
            index_list = [
                INDICES.CRYPTO_CCY, INDICES.DOW_JONES, INDICES.NASDAQ100,
                INDICES.Q_FSE
            ]
            # ToDo Check INDICES.Q_FSE
        else:
            index_list = [self._index]

        for index in index_list:
            index_for_key = index.replace(' ', '_').lower()
            index_for_key = index_for_key if self._index == '' else '{}_{}'.format(
                index_for_key, 'single')
            chart_id = '{}_{}'.format(self._chart_id, index_for_key)
            # print('__get_chart_type_heatmap__: chart_id={}'.format(chart_id))
            chart_name = index
            graph_api = DccGraphApi(chart_id, chart_name)
            figure_data, max_value = self.__get_mood_chart_figure_data__(index)
            max_value = int(round(max_value + 5, -1))
            value_interval = max(10, int(round(max_value / 3, -1)))
            tick_vals = list(range(-max_value, max_value, value_interval))
            tick_text = [abs(value) for value in tick_vals]
            graph_api.figure_data = figure_data
            graph_api.figure_layout_height = 300
            graph_api.figure_layout_margin = {
                'b': 50,
                'r': 50,
                'l': 50,
                't': 50
            }
            graph_api.figure_layout_barmode = 'overlay'
            graph_api.figure_layout_bargap = 0.1
            graph_api.figure_layout_x_axis_dict = {}
            graph_api.figure_layout_y_axis_dict = {
                'range': 'Date',
                'tickvals': tick_vals,
                'ticktext': tick_text
            }
            graph_list.append(MyDCC.graph(graph_api))
        return graph_list
 def __get_chart_type_pie__(self):
     graph_api = DccGraphApi(self._chart_id, self._chart_name)
     graph_api.figure_data = self.__get_pie_figure_data__('all')
     graph_api.figure_layout_height = 800
     graph_api.figure_layout_margin = {'b': 200, 'r': 50, 'l': 50, 't': 50}
     return [MyDCC.graph(graph_api)]