gauravlochab commited on
Commit
6a3c463
·
1 Parent(s): c4ac80e

keep bar color consistent

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -212,6 +212,13 @@ def create_visualizations():
212
  tx_per_chain["Order"] = tx_per_chain["sending_chain"].apply(lambda x: 0 if x == "Optimism" else 1)
213
  tx_per_chain = tx_per_chain.sort_values(by=["Order", "date"])
214
 
 
 
 
 
 
 
 
215
  fig_tx_chain = px.bar(
216
  tx_per_chain,
217
  x="date",
@@ -220,7 +227,7 @@ def create_visualizations():
220
  title="Chain Daily Activity: Transactions",
221
  labels={"sending_chain": "Transaction Chain", "transaction_count": "Daily Transaction Nr"},
222
  barmode="stack",
223
- color_discrete_sequence=["purple", "darkgreen", "blue"]
224
  )
225
  fig_tx_chain.update_layout(
226
  xaxis_title=None,
@@ -249,7 +256,7 @@ def create_visualizations():
249
  title="Chain Daily Activity: Swaps",
250
  labels={"sending_chain": "Transaction Chain", "swap_count": "Daily Swap Nr"},
251
  barmode="stack",
252
- color_discrete_sequence=["purple", "darkgreen"]
253
  )
254
  fig_swaps_chain.update_layout(
255
  xaxis_title=None,
@@ -278,7 +285,7 @@ def create_visualizations():
278
  title="Chain Daily Activity: Bridges",
279
  labels={"sending_chain": "Transaction Chain", "bridge_count": "Daily Bridge Nr"},
280
  barmode="stack",
281
- color_discrete_sequence=["darkgreen", "purple"]
282
  )
283
  fig_bridges_chain.update_layout(
284
  xaxis_title=None,
@@ -304,7 +311,7 @@ def create_visualizations():
304
  title="Amount of Investment (USD) per Day",
305
  labels={"sending_chain": "Transaction Chain", "sending_amount_usd": "Investment Amount (USD)"},
306
  barmode="stack",
307
- color_discrete_sequence=["purple", "darkgreen"]
308
  )
309
  fig_investment_agent.update_layout(
310
  xaxis_title=None,
 
212
  tx_per_chain["Order"] = tx_per_chain["sending_chain"].apply(lambda x: 0 if x == "Optimism" else 1)
213
  tx_per_chain = tx_per_chain.sort_values(by=["Order", "date"])
214
 
215
+ # Define the color mapping for chains
216
+ color_map = {
217
+ "Optimism": "blue",
218
+ "Ethereum": "darkgreen",
219
+ "Base": "purple"
220
+ }
221
+
222
  fig_tx_chain = px.bar(
223
  tx_per_chain,
224
  x="date",
 
227
  title="Chain Daily Activity: Transactions",
228
  labels={"sending_chain": "Transaction Chain", "transaction_count": "Daily Transaction Nr"},
229
  barmode="stack",
230
+ color_discrete_map=color_map
231
  )
232
  fig_tx_chain.update_layout(
233
  xaxis_title=None,
 
256
  title="Chain Daily Activity: Swaps",
257
  labels={"sending_chain": "Transaction Chain", "swap_count": "Daily Swap Nr"},
258
  barmode="stack",
259
+ color_discrete_map=color_map
260
  )
261
  fig_swaps_chain.update_layout(
262
  xaxis_title=None,
 
285
  title="Chain Daily Activity: Bridges",
286
  labels={"sending_chain": "Transaction Chain", "bridge_count": "Daily Bridge Nr"},
287
  barmode="stack",
288
+ color_discrete_map=color_map
289
  )
290
  fig_bridges_chain.update_layout(
291
  xaxis_title=None,
 
311
  title="Amount of Investment (USD) per Day",
312
  labels={"sending_chain": "Transaction Chain", "sending_amount_usd": "Investment Amount (USD)"},
313
  barmode="stack",
314
+ color_discrete_map=color_map
315
  )
316
  fig_investment_agent.update_layout(
317
  xaxis_title=None,