Skip to content

Commit ceaa517

Browse files
committed
viz: set default colorscheme for barcharts
1 parent 519b495 commit ceaa517

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

viz.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@
2323
99.990% 0.024 sec.
2424
"""
2525

26-
DEFAULT_QUERY = """SELECT * FROM messages WHERE service_id = 40 LIMIT 50;"""
2726

2827
STATUS_REGEX = re.compile(
2928
r"([\w.-]+:\d+),\s*queries:\s*(\d+),\s*QPS:\s*([\d.]+),\s*RPS:\s*([\d.]+),\s*MiB/s:\s*([\d.]+),\s*result RPS:\s*([\d.]+),\s*result MiB/s:\s*([\d.]+)"
3029
)
31-
30+
DEFAULT_QUERY = """SELECT * FROM messages WHERE service_id = 40 LIMIT 50;"""
3231
PERCENTILE_REGEX = re.compile(r"(\d+\.?\d*)%\s+(\d+\.\d+)\s+sec")
33-
3432
KEY_PERCENTILES = [50.0, 95.0, 99.0]
33+
COLORSCHEME = px.colors.qualitative.D3
3534

3635

3736
def format_sql(query: str) -> str:
@@ -79,6 +78,7 @@ def create_bar_chart(data: list, title: str, x_label: str, y_label: str) -> go.F
7978
title=title,
8079
labels={"value": y_label, "variable": "Query"},
8180
barmode="group",
81+
color_discrete_sequence=COLORSCHEME[:2],
8282
)
8383
fig.update_layout(bargap=0.2, bargroupgap=0.1)
8484
return fig
@@ -113,7 +113,7 @@ def create_performance_metrics_charts(status_data1: dict, status_data2: dict) ->
113113
labels={"Value": title},
114114
text="Value",
115115
color="Query",
116-
color_discrete_sequence=px.colors.qualitative.D3[:2],
116+
color_discrete_sequence=COLORSCHEME[:2],
117117
height=400,
118118
)
119119
fig.update_traces(texttemplate="%{text:.2f}", textposition="outside")

0 commit comments

Comments
 (0)