top of page

Format data labels

Here is a script to format data labels of widgets.

Supported widget types : Line chart, Bar chart, Column chart, Area chart






Steps:

  1. Create a widget

  2. Add below script to widget. Update the variable `borderColor` and 'backgroundColor' if required.

  3. Save the script and refresh the widget


widget.on('processresult', function(se, ev){

	$.each(ev.result.series, function(seriesIndex, seriesValue){
		
			if(seriesIndex == 0){
				borderColor = '#94FF77'
				backgroundColor = 'rgba(148, 255, 119, 0.2)'
			}else if(seriesIndex == 1){
				borderColor = '#FFB4B4'
				backgroundColor = 'rgba(255, 180, 180, 0.2)'
			}
		
		
			seriesValue.dataLabels = {
										borderColor: borderColor,
										backgroundColor: backgroundColor,
										borderWidth: 1,
										borderRadius:3,
										padding: 3,
										style: {
											fontWeight: 'bold'
										}
			}

	})

})

244 views0 comments

Commentaires

Noté 0 étoile sur 5.
Pas encore de note

Ajouter une note
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