Forum Discussion

BIQ's avatar
BIQ
Cloud Apps
01-23-2023
Solved

Script to hide specific values from chart

I have a line chart with two metrics. I want to show the value of the first metric and hide the value of the second metric by default. Can someone help with a script to achieve this?

  • Hi BIQ ,

    If you are looking for a script to display value labels of only one matric, try this solution:

    Disable the 'Value Label' option in design panel.

     

    And add below script to widget. (update the variable panelIndex with index panel whose values need to be displayed)

    widget.on('processresult', function(se, ev){
    	let panelIndex = 0 //index of panel whose labels should be displayed
    	ev.result.series[0].dataLabels = {enabled:true}
    });   
    

    result:

     

    -Hari

     

1 Reply

Replies have been turned off for this discussion
  • harikm007's avatar
    harikm007
    Data Warehouse

    Hi BIQ ,

    If you are looking for a script to display value labels of only one matric, try this solution:

    Disable the 'Value Label' option in design panel.

     

    And add below script to widget. (update the variable panelIndex with index panel whose values need to be displayed)

    widget.on('processresult', function(se, ev){
    	let panelIndex = 0 //index of panel whose labels should be displayed
    	ev.result.series[0].dataLabels = {enabled:true}
    });   
    

    result:

     

    -Hari