Skip to content

Commit 33542c2

Browse files
authored
statistics visualize : 折れ線グラフの表示を増やしました (#1663)
* Fix Find User options in scatter plots * `config.toml`: 設定ファイルを削除しました。 * Move cumulative worktime graph first * Use selector for cumulative production graph * Fix cumulative production selector labels * Reorder cumulative production tooltips * Align daily line graph with cumulative UI * Add moving averages for custom production volumes * Align annotation-start line graph UI * Emit renderer changes for line graph selectors
1 parent 3a2f776 commit 33542c2

6 files changed

Lines changed: 680 additions & 338 deletions

File tree

.codex/config.toml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +0,0 @@
1-
sandbox_mode = "workspace-write"
2-
default_permissions = "workspace_no_env"
3-
4-
[permissions.workspace_no_env.filesystem]
5-
":minimal" = "read"
6-
glob_scan_max_depth = 5
7-
8-
[permissions.workspace_no_env.filesystem.":workspace_roots"]
9-
"." = "write"
10-
11-
# repo直下
12-
".env" = "deny"
13-
".env.*" = "deny"
14-
15-
# サブディレクトリ配下
16-
"**/.env" = "deny"
17-
"**/.env.*" = "deny"
18-
"**/*.env" = "deny"
19-
20-
[permissions.workspace_no_env.network]
21-
enabled = true
22-
23-
[permissions.workspace_no_env.network.domains]
24-
"kurusugawa.jp" = "allow"
25-
"api.openai.com" = "allow"
26-
"registry.npmjs.org" = "allow"
27-
"pypi.org" = "allow"
28-
"files.pythonhosted.org" = "allow"
29-
"*.github.com" = "allow"
30-
"objects.githubusercontent.com" = "allow"
31-
32-
[shell_environment_policy]
33-
inherit = "core"
34-
set = { UV_CACHE_DIR = "/tmp/uv-cache" }

annofabcli/statistics/scatter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def __init__(
8888

8989
self.text_glyphs: dict[str, GlyphRenderer] = {}
9090
"""key:user_id, value: 散布図に表示している名前のGlyph"""
91+
self._plotted_users: dict[str, str] = {}
92+
"""key:user_id, value: 散布図に表示しているユーザー名"""
9193
self._scatter_glyphs: dict[str, GlyphRenderer] = {}
9294
"""key:biography, value: 散布図に表示している円形のGlyph"""
9395

@@ -148,6 +150,7 @@ def plot_scatter(
148150
# 1点ごとに`text`で名前を表示している理由:
149151
# `add_multi_choice_widget_for_searching_user`関数で追加したMultiChoice Widgetで、名前の表示スタイルを変更するため
150152
for x, y, username, user_id in zip(source.data[x_column_name], source.data[y_column_name], source.data[username_column_name], source.data[user_id_column_name], strict=False):
153+
self._plotted_users[user_id] = username
151154
self.text_glyphs[user_id] = self.figure.text(
152155
x=x,
153156
y=y,
@@ -202,6 +205,7 @@ def plot_bubble(
202205
# 1点ごとに`text`で名前を表示している理由:
203206
# `add_multi_choice_widget_for_searching_user`関数で追加したMultiChoice Widgetで、名前の表示スタイルを変更するため
204207
for x, y, username, user_id in zip(source.data[x_column_name], source.data[y_column_name], source.data[username_column_name], source.data[user_id_column_name], strict=False):
208+
self._plotted_users[user_id] = username
205209
self.text_glyphs[user_id] = self.figure.text(
206210
x=x,
207211
y=y,
@@ -231,6 +235,10 @@ def process_after_adding_glyphs(self) -> None:
231235
if self._hover_tool is not None and self._scatter_glyphs is not None:
232236
self._hover_tool.renderers = list(self._scatter_glyphs.values())
233237

238+
def get_plotted_users(self) -> list[tuple[str, str]]:
239+
"""散布図に表示しているユーザーのリストを返します。"""
240+
return list(self._plotted_users.items())
241+
234242
def configure_legend(self) -> None:
235243
"""
236244
凡例を設定します。

annofabcli/statistics/visualization/dataframe/user_performance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ def _create_productivity_element_list(
967967
quartile = self._get_quartile_value(df[(f"{worktime_type.value}_worktime_minute/{production_volume_column}", phase)])
968968
scatter_obj.plot_quartile_line(quartile, dimension="width")
969969

970-
scatter_obj.add_multi_choice_widget_for_searching_user(list(zip(df[("user_id", "")], df[("username", "")], strict=False)))
970+
scatter_obj.add_multi_choice_widget_for_searching_user(scatter_obj.get_plotted_users())
971971
scatter_obj.process_after_adding_glyphs()
972972

973973
div_element = self._create_div_element()
@@ -1144,7 +1144,7 @@ def create_scatter_obj(title: str, x_axis_label: str, y_axis_label: str) -> Scat
11441144
scatter_obj.plot_quartile_line(quartile, dimension="width")
11451145

11461146
for scatter_obj in scatter_obj_list:
1147-
scatter_obj.add_multi_choice_widget_for_searching_user(list(zip(df[("user_id", "")], df[("username", "")], strict=False)))
1147+
scatter_obj.add_multi_choice_widget_for_searching_user(scatter_obj.get_plotted_users())
11481148
scatter_obj.process_after_adding_glyphs()
11491149

11501150
div_element = self._create_div_element()
@@ -1280,7 +1280,7 @@ def plot_average_and_quartile_line() -> None:
12801280
plot_average_and_quartile_line()
12811281

12821282
for scatter_obj in scatter_obj_list:
1283-
scatter_obj.add_multi_choice_widget_for_searching_user(list(zip(df[("user_id", "")], df[("username", "")], strict=False)))
1283+
scatter_obj.add_multi_choice_widget_for_searching_user(scatter_obj.get_plotted_users())
12841284
scatter_obj.process_after_adding_glyphs()
12851285

12861286
div_element = self._create_div_element()

0 commit comments

Comments
 (0)