File size: 955 Bytes
5e9d70a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import numpy as np
import plotly.graph_objects as go


def draw_radar_chart(data, categories):
    arr = np.array(data, dtype='int')
    fig = go.Figure()
    fig.add_trace(go.Scatterpolar(
        r=arr,
        theta=categories,
        fill='toself'
    ))
    fig.update_layout(
        polar=dict(
            radialaxis=dict(
                visible=True,
                range=(0, 100)
            )),
        showlegend=False
    )
    return fig


def draw_multi_radar_chart(data, categories):
    # arr = np.array(data, dtype='int')
    # categories = ['A', 'B', 'C', 'D', 'E']

    fig = go.Figure()
    for arr in data:
        fig.add_trace(go.Scatterpolar(
            r=arr,
            theta=categories,
            fill='toself'
        ))

    fig.update_layout(
        polar=dict(
            radialaxis=dict(
                visible=True,
                range=(0, 100)
            )),
        showlegend=False
    )

    return fig