Ajay98 commited on
Commit
3bf516e
·
verified ·
1 Parent(s): e63e009

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -238,8 +238,8 @@ def pull_data_from_salesforce():
238
  security_token=SALESFORCE_SECURITY_TOKEN
239
  )
240
 
241
- query_inventory = "SELECT Product_Name__c, Current_Stocks__c, soldstock__c FROM Inventory_Management__c LIMIT 100"
242
- query_unbillable = "SELECT Product_Name__c, Current_Stock__c, soldstock__c FROM Un_Billable__c LIMIT 100"
243
 
244
  response_inventory = sf.query_all(query_inventory)
245
  response_unbillable = sf.query_all(query_unbillable)
@@ -257,7 +257,6 @@ def pull_data_from_salesforce():
257
  # Rename columns for better readability
258
  df_inventory.rename(columns={
259
  "Product_Name__c": "Product Name (Inventory)",
260
- "Modal_Name__c": "Model Name (Inventory)",
261
  "Current_Stocks__c": "Current Stocks (Inventory)",
262
  "soldstock__c": "Sold Stock (Inventory)"
263
  }, inplace=True)
@@ -277,8 +276,9 @@ def pull_data_from_salesforce():
277
 
278
  # Generate interactive vertical bar graph using Matplotlib
279
  fig, ax = plt.subplots(figsize=(12, 8))
280
- df_inventory.plot(kind='bar', x="Product Name (Inventory)", y="Current Stocks (Inventory)", ax=ax, legend=False, color='blue', position=0, width=0.4)
281
- df_unbillable.plot(kind='bar', x="Product Name (Unbillable)", y="Current Stocks (Unbillable)", ax=ax, legend=False, color='red', position=1, width=0.4)
 
282
  ax.set_title("Stock Distribution by Product Name")
283
  ax.set_xlabel("Product Name")
284
  ax.set_ylabel("Current Stocks")
 
238
  security_token=SALESFORCE_SECURITY_TOKEN
239
  )
240
 
241
+ query_inventory = "SELECT Product_Name__c, Current_Stocks__c, soldstock__c FROM Inventory_Management__c LIMIT 100"
242
+ query_unbillable = "SELECT Product_Name__c,Current_Stock__c, soldstock__c FROM Un_Billable__c LIMIT 100"
243
 
244
  response_inventory = sf.query_all(query_inventory)
245
  response_unbillable = sf.query_all(query_unbillable)
 
257
  # Rename columns for better readability
258
  df_inventory.rename(columns={
259
  "Product_Name__c": "Product Name (Inventory)",
 
260
  "Current_Stocks__c": "Current Stocks (Inventory)",
261
  "soldstock__c": "Sold Stock (Inventory)"
262
  }, inplace=True)
 
276
 
277
  # Generate interactive vertical bar graph using Matplotlib
278
  fig, ax = plt.subplots(figsize=(12, 8))
279
+ width = 0.4 # Width of the bars
280
+ df_inventory.plot(kind='bar', x="Product Name (Inventory)", y="Current Stocks (Inventory)", ax=ax, legend=True, color='blue', position=0, width=width)
281
+ df_unbillable.plot(kind='bar', x="Product Name (Unbillable)", y="Current Stocks (Unbillable)", ax=ax, legend=True, color='red', position=1, width=width)
282
  ax.set_title("Stock Distribution by Product Name")
283
  ax.set_xlabel("Product Name")
284
  ax.set_ylabel("Current Stocks")