top of page

Add bands to Line Chart in Sisense

There can be scenarios where we need to understand in which level/band the value or category belongs to and the analysis will be easier if there is an option to add bands to the widget.


We can achieve this by adding below widget script


widget.on('ready', function(se, ev){
	$('svg .highcharts-plot-bands-labels-0', element).insertAfter('svg .highcharts-plot-bands-0', element)
})

widget.on('processresult', function(se, ev){
	
	ev.result.yAxis[0].plotBands = [{
			from:0,
			to:2500,
			color:'#9ffff6',
			label: {
					text: 'Low',
					style: {
						color: '#888a89'
					}
				}
		},
		{
			from:2501,
			to:5000,
			color:'#daf1ce',
			label: {
					text: 'Medium',
					style: {
						color: '#888a89'
					}
				}
		},
		{
			from:5001,
			to:7500,
			color:'#fff2c6',
			label: {
					text: 'High-1',
					style: {
						color: '#888a89'
					}
				}
			},
		{
			from:7501,
			to:15000,
			color:'#fcd9e2',
			label: {
					text: 'High-2',
					style: {
						color: '#888a89'
					}
				}
		},
		{
			from:15000,
			to:25000,
			color:'#f6cde3',
			label: {
					text: 'High-3',
					style: {
						color: '#888a89'
					}
				}
		}]
})

(Update from, to, color and text based on your requirement)



1 Comment

Rated 0 out of 5 stars.
No ratings yet

Add a rating
Guest
Feb 26

Is it possible to add variables to the ranges? I have a slider to set up the max and min and I want to send that parameter to the script.

Like
BI Next Level white logo

BI Next Level is your trusted resource for BI customization, data solutions, and expert insights. Explore practical tips, scripts, and tutorials for tools like Sisense, Python, and SQL. Let’s transform your data into impactful insights together.

Quick Links
Connect with us
Copyright © 2024. All Rights Reserved. Designed, Developed & Maintained  by Intertoons
bottom of page