Skip to main content
Sisense Community logo
  • Community Feedback
  • Chapters
  • Events
  • Forums
    • Help and How To
    • Product Feedback Forum
    • Strategy & Use Cases
  • Blogs
  • KB Docs
    • KB Docs
    • Add-Ons & Plug-Ins
    • APIs
    • Best Practices
    • Blox
    • CDT
    • Cloud Managed Service
    • Data Models
    • Data Sources
    • Embedding Analytics
    • How-Tos & FAQs
    • Onboarding
    • PySisense
    • Security
    • Sisense Administration
    • Sisense Intelligence & AI
    • Troubleshooting
    • Widget & Dashboard Scripts
  • Support
  • Learning
    • Sisense Academy: Free Courses and Certifications
    • Official Developer Documentation
    • Official Product Documentation
    • Official Sisense Youtube Channel
    • Sisense Compose SDK Playground
  • Use Case Gallery
All PostsDiscussionsBlogsIdeasQuestions
Leaderboards
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
  •                    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
Discussions
  • Knowledge Base DocsChevronRightIcon
  • CDTChevronRightIcon
Chart Type -- Number Overlays With Secondary Reference Number
           
Contextualizing KPIs is a must. For instance, if a company has 500 users, how does that compare to the number of users last week? Using Sisense for Cloud Data Teams' Python Integration, we can create customized number overlays to cleanly present this information.

To create the visualization above, we assume that our SQL output generates 1 row of data with 2 columns:
  1. Our KPI. in this case, number of users
  2. The percent change (for proper formatting, use the built-in percent formatter shortcut :%)

Then, we apply the following Python 3.6 code on the SQL output. Here we are also adding some helpful text to describe the KPI and adding some arrows and coloring to contextualize the KPI.
import pandas as pd
import matplotlib.pyplot as plt

fig = plt.figure()
plt.axis('off')

plt.gcf().set_size_inches(8, 2)
plt.xticks([])
plt.yticks([])

if(df.iat[0,1][0]=='-'):
  col='red'
  dir="\u25bc"
  val=df.iat[0,1][1:]
else:
  col='green'
  dir='\u25b2'
  val=df.iat[0,1]

plt.text(.5, .95, 'New Users', fontsize=25, color='black', ha='center')
plt.text(.5, .75, 'This Week', fontsize=12, color='black', ha='center')
plt.text(.5, .25, str(df.iat[0,0]), fontsize=50, color='black', ha='center')
plt.text(.5, 0, dir + ' ' + val +' from prior week', fontsize=15, color=col, ha='center')

periscope.output(plt)
How does your business like to format KPIs in Number Overlays? Comment below!
intapiuser
By
intapiuser
Posted 3 years ago
                                       
         
0 comments

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
               
                                                                                 
  •                                                              
  •                                                              
  •