Forum Discussion

TheLivingBubba's avatar
TheLivingBubba
Cloud Apps
11-07-2024
Solved

How to add two (or more) Target/Benchmark lines to a chart?

Hi all!

I'm relatively new to Sisense & just finding my way. I've followed the instructions in this post about adding a Target or Benchmark line to a chart (https://www.binextlevel.com/post/add-target-benchmark-line-to-a-chart-in-sisense).

However, I've been asked to find a way to add multiple such lines to a graph, each one to be (preferably) individually configurable by line thickness, pattern, color, etc.),

I would genuinely be so thankful for anything people here can suggest.

Thank you!

  • Hi TheLivingBubba ,

    As you see in the post, the 'ev.result.yAxis[0].plotLines' is an array. So you can add any number of plot lines to it. Here is an example:

    widget.on('processresult', function(se, ev){
    
    	ev.result.yAxis[0].plotLines = [
    			//benchmark line 1
    			{
    				color: '#2ec7b5',
    				dashStyle: 'LongDash',
    				width: 1,
    				value: 800,
    				zIndex: 5,
    				label : {
    					text : 'Target1'
    				}
                },
    		
    			//benchmark line 2
    			{
    				color: 'red',
    				dashStyle: 'Solid',
    				width: 4,
    				value: 2000,
    				zIndex: 5,
    				label : {
    					text : 'Target2'
    				}
                },
    		
    			//benchmark line 3
    			{
    				color: 'yellow',
    				dashStyle: 'LongDash',
    				width: 2,
    				value: 4000,
    				zIndex: 5,
    				label : {
    					text : 'Target3'
    				}
                }
    		]
    })

    And the result is:

    Let me know if that works!

     

    -Hari

    https://www.binextlevel.com/ 

     

     

3 Replies

  • harikm007's avatar
    harikm007
    Data Warehouse

    Hi TheLivingBubba ,

    As you see in the post, the 'ev.result.yAxis[0].plotLines' is an array. So you can add any number of plot lines to it. Here is an example:

    widget.on('processresult', function(se, ev){
    
    	ev.result.yAxis[0].plotLines = [
    			//benchmark line 1
    			{
    				color: '#2ec7b5',
    				dashStyle: 'LongDash',
    				width: 1,
    				value: 800,
    				zIndex: 5,
    				label : {
    					text : 'Target1'
    				}
                },
    		
    			//benchmark line 2
    			{
    				color: 'red',
    				dashStyle: 'Solid',
    				width: 4,
    				value: 2000,
    				zIndex: 5,
    				label : {
    					text : 'Target2'
    				}
                },
    		
    			//benchmark line 3
    			{
    				color: 'yellow',
    				dashStyle: 'LongDash',
    				width: 2,
    				value: 4000,
    				zIndex: 5,
    				label : {
    					text : 'Target3'
    				}
                }
    		]
    })

    And the result is:

    Let me know if that works!

     

    -Hari

    https://www.binextlevel.com/