AjaykumarPilla commited on
Commit
6c3ee62
·
verified ·
1 Parent(s): c0cb683

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -33,6 +33,7 @@ try:
33
  )
34
  except Exception as e:
35
  st.error(f"Failed to connect to Salesforce: {str(e)}")
 
36
  sf = None
37
 
38
  # Title
@@ -253,12 +254,20 @@ if submit_button:
253
  <canvas id="{chart_id}" style="max-height: 200px; max-width: 600px;"></canvas>
254
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
255
  <script>
256
- const ctx = document.getElementById('{chart_id}').getContext('2d');
257
- new Chart(ctx, {json.dumps(chart_config)});
 
 
 
 
258
  </script>
259
  """
260
- components.html(chart_html, height=250)
261
- logger.info("Chart.js heatmap rendered")
 
 
 
 
262
 
263
  # Generate matplotlib figure for PDF
264
  fig, ax = plt.subplots(figsize=(8, 2))
 
33
  )
34
  except Exception as e:
35
  st.error(f"Failed to connect to Salesforce: {str(e)}")
36
+ logger.error(f"Salesforce connection failed: {str(e)}")
37
  sf = None
38
 
39
  # Title
 
254
  <canvas id="{chart_id}" style="max-height: 200px; max-width: 600px;"></canvas>
255
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
256
  <script>
257
+ try {{
258
+ const ctx = document.getElementById('{chart_id}').getContext('2d');
259
+ new Chart(ctx, {json.dumps(chart_config)});
260
+ }} catch (e) {{
261
+ console.error('Chart.js failed: ' + e);
262
+ }}
263
  </script>
264
  """
265
+ try:
266
+ components.html(chart_html, height=250)
267
+ logger.info("Chart.js heatmap rendered")
268
+ except Exception as e:
269
+ logger.error(f"Chart.js rendering failed: {str(e)}")
270
+ st.error("Failed to render heatmap; please check your browser settings.")
271
 
272
  # Generate matplotlib figure for PDF
273
  fig, ax = plt.subplots(figsize=(8, 2))