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
  • Help and How-ToChevronRightIcon
Edits to script for changing widget values by buttons
                 
           

Summary: NancySummit is seeking help with modifying a script to change widget values in a line chart without using an indicator widget. They are facing an issue where buttons do not show the selected color. Assaf Hanina suggests that the script should work with line charts as is, without adjustment, and asks for more details about the display issue to assist further. The discussion includes an exchange of replies and clarifications.

I followed the instructions in this post... https://community.sisense.com/t5/knowledge-base/changing-measures-in-the-entire-dashboard-using-blox-user/tac-p/26261#M3953

It works great but I've been trying to modify this to work on a line chart (widget.type == 'lineChart' in the SwitchMeasure action) -- I don't want an indicator widget on the dashboard -- and I just can't get it to work without including an indicator widget. The line chart changes between 3 values perfectly without the indicator widget type but the buttons won't show the designated selected color when I click on them w/out the indicator widget in the dashboard. Anyone have some ideas? My javascript is beginner level if that. Thanks for any help!

NancySummit
NancySummit
Posted 1 year ago · Edited 1 month ago·Last reply 1 year ago
                                       
         
7 comments

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
               
           
                   
                                                                                                                                                                                                       
           
                   
                                                                                                                                                                                                       
           
                   
                                                                                                                                                                                                       
NancySummit

NancySummit

OP1 year ago

Thanks so much!!

                                       
NancySummit

NancySummit

OP1 year ago

Wow that works great!!  And much simpler.  Thank you so much!  Now I need know if I can show TWO measures at one time on a chart -- like Revenue AND Profit in your example.  I'm guessing that needs to be a separate post?  Thanks again!!

                                       
Assaf Hanina

Assaf Hanina

·1 year ago · Edited

Hey NancySummit ,

I'm happy to hear it's resolve the issue!

You can specify 2 measures in the same chart.
The blox action will replace the first measure as it hard-coded for (Item[0])
In case needed, you may consider duplicating the action with different name and set hard coded to item[1] for replacing the secondary measure if needed. 

Here is an example with secondary measure: Selecting the Revenue

AssafHanina_0-1739226170091.png

Selecting the Quantity

AssafHanina_1-1739226263741.png

Best Regards

                                       
Assaf Hanina

Assaf Hanina

·1 year ago · Edited

Hey NancySummit ,

The Action Shared in the Community article should work for Line Chart as well without the need of readjusting the Action or even if there's not an Indicator.
In the Blox Action there's a differentiate between Indicator or the rest of the Widget types. 
AssafHanina_0-1738598564095.png
The Sisense widgets has different panels for Rows, Measures, Columns, Filters. 
the Panels Can be different between Widget types.

Indicator widgets doesn't have Rows/Group by so the measure switcher Code refer to the Panels[0].items[0] which is the Primary indicator. 

For Other widget types, such as Column Chart, Bar Chart, Line Chart, Area Chart - the Panels[1].items[0] refer to the First measure as present below. 
Therefore, it's not require additional adjustment for Line Chart and it shall work. 

AssafHanina_1-1738598857590.png

For the Buttons to Display, can you please share an example of the related issue?

Best Regards

fyi DRay 

                                       
NancySummit

NancySummit

OP1 year ago

Thank you!  I follow what you're saying about the "else" and I verified my code is the same as yours (to make sure I didn't accidentally edit it). But as soon as I delete my indicator widget from the dashboard, the buttons just stay in the default as indicated in the widget script for the line chart.  The line chart values change correctly when the buttons are clicked, but the button colors do not cycle along with it.  In the image below, the first button "Avg MSA Med Exp" was clicked.  The line chart reflects that value but the button is the default gray as indicated in the widget script of the line chart.  

I'm attaching the line chart widget script.  The only edits I made to this part from the original post was to add another button.  Appreciate your help!

                                       
                                                                                 
  •                                                              
  •                                                              
  •