示例#1
0
    def draw_polar(self,
                   plotly_layout=None,
                   annotation_df=None,
                   render='html',
                   file_name=None,
                   width=None,
                   height=None,
                   title=None,
                   keep_ui_state=True,
                   property_map=None,
                   **kwargs):
        data = []
        for entity_id, df in self.normal_data.entity_map_df.items():
            for _, row in df.iterrows():
                row = row.apply(lambda x: to_positive_number(x))

                trace = go.Scatterpolar(r=row.to_list(),
                                        theta=df.columns.tolist(),
                                        fill='toself',
                                        name=entity_id,
                                        **kwargs)
                data.append(trace)
                # just support one pie now
                # TODO: group by entity
                break

        return self.show(plotly_data=data,
                         plotly_layout=plotly_layout,
                         annotation_df=annotation_df,
                         render=render,
                         file_name=file_name,
                         width=width,
                         height=height,
                         title=title,
                         keep_ui_state=keep_ui_state)
示例#2
0
文件: chart.py 项目: zhizunbao84/zvt
    def draw_pie(self, plotly_layout=None, annotation_df=None, render='html', file_name=None, width=None, height=None,
                 title=None, keep_ui_state=True, **kwargs):
        data = []
        for entity_id, df in self.normal_data.entity_map_df.items():
            for _, row in df.iterrows():
                row = row.apply(lambda x: to_positive_number(x))
                data.append(go.Pie(name=entity_id, labels=df.columns.tolist(), values=row.tolist(), **kwargs))
                # just support one pie now
                # TODO: group by entity
                break

        return self.show(plotly_data=data, plotly_layout=plotly_layout, annotation_df=annotation_df, render=render,
                         file_name=file_name, width=width,
                         height=height, title=title, keep_ui_state=keep_ui_state)