zavavan commited on
Commit
d729459
·
verified ·
1 Parent(s): 3e91553

Update dashboard.py

Browse files
Files changed (1) hide show
  1. dashboard.py +24 -2
dashboard.py CHANGED
@@ -82,7 +82,29 @@ def create_type_bar_charts(entRelsButton, **kwargs):
82
  dictionary = relationTypesFreqMap
83
  return hv.Bars(dictionary, hv.Dimension('Relation Types'), 'Frequency').opts(framewise=True, xrotation=45,width=1200, height=600)
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
 
86
  def create_ent_bar_charts(ents, **kwargs):
87
  # Create button widgets for each label
88
  drug_buttons = []
@@ -222,7 +244,7 @@ def chordify_triples(rel_grouping, min_val):
222
  # https://tabler-icons.io/
223
  button1 = pn.widgets.Button(name="Introduction", button_type="warning", icon="file-info", styles={"width": "100%"})
224
  button2 = pn.widgets.Button(name="Top Key Entities", button_type="warning", icon="chart-bar", styles={"width": "100%"})
225
- button3 = pn.widgets.Button(name="Entity/Relation Types:", button_type="warning", icon="chart-histogram", styles={"width": "100%"})
226
  button4 = pn.widgets.Button(name="Ontology Coverage", button_type="warning", icon="chart-dots-filled", styles={"width": "100%"})
227
  #button5 = pn.widgets.Button(name="Causal Relation Chord Diagrams", button_type="warning", icon="chart-dots-filled", styles={"width": "100%"})
228
 
@@ -334,7 +356,7 @@ def CreatePage3():
334
  return pn.Column(
335
  pn.pane.Markdown("## Entity/Relation Types "),
336
  entRelsButton,
337
- pn.bind(create_type_bar_charts, entRelsButton),
338
  align="center",
339
  )
340
 
 
82
  dictionary = relationTypesFreqMap
83
  return hv.Bars(dictionary, hv.Dimension('Relation Types'), 'Frequency').opts(framewise=True, xrotation=45,width=1200, height=600)
84
 
85
+ def create_type_pie_charts(entRelsButton, **kwargs):
86
+ if entRelsButton == 'Entity':
87
+ dictionary = entityTypesFreqMap
88
+ return hv.Pie(dictionary, kdims='Entity Types', vdims='Frequency').opts(
89
+ cmap='Category20',
90
+ labels='Frequency',
91
+ legend_position='right',
92
+ width=600,
93
+ height=600,
94
+ fontsize={'labels': 12, 'legend': 10}
95
+ )
96
+ elif entRelsButton == 'Relation':
97
+ dictionary = relationTypesFreqMap
98
+ return hv.Pie(dictionary, kdims='Relation Types', vdims='Frequency').opts(
99
+ cmap='Category20',
100
+ labels='Frequency',
101
+ legend_position='right',
102
+ width=600,
103
+ height=600,
104
+ fontsize={'labels': 12, 'legend': 10}
105
+ )
106
 
107
+
108
  def create_ent_bar_charts(ents, **kwargs):
109
  # Create button widgets for each label
110
  drug_buttons = []
 
244
  # https://tabler-icons.io/
245
  button1 = pn.widgets.Button(name="Introduction", button_type="warning", icon="file-info", styles={"width": "100%"})
246
  button2 = pn.widgets.Button(name="Top Key Entities", button_type="warning", icon="chart-bar", styles={"width": "100%"})
247
+ button3 = pn.widgets.Button(name="Entity/Relation Types", button_type="warning", icon="chart-histogram", styles={"width": "100%"})
248
  button4 = pn.widgets.Button(name="Ontology Coverage", button_type="warning", icon="chart-dots-filled", styles={"width": "100%"})
249
  #button5 = pn.widgets.Button(name="Causal Relation Chord Diagrams", button_type="warning", icon="chart-dots-filled", styles={"width": "100%"})
250
 
 
356
  return pn.Column(
357
  pn.pane.Markdown("## Entity/Relation Types "),
358
  entRelsButton,
359
+ pn.bind(create_type_pie_charts, entRelsButton),
360
  align="center",
361
  )
362