Hi the great sisense community, I need a lot of help on making a combo chart in Sisense. Below is what I want to create: The purpose of this chart is to show my main baseball team (Yankees) in b...
Thanks for your reply and I appreciate the help. Your answer would help achieve the basic chart but it is missing 2 of the most critical requirements:
My team would change dynamically when the end user filter to a different team (in the dashboard filter). How to write the script in a way that it will highlight a different team every time the dashboard filter is changed?
How to hide the team names of all the blue bars but let the red team name visible. This also needs to be dynamic as the user can choose "red sox" this time but "yankees" next time.
Let's make a few changes to the widget script, where we will detect the selected dashboard filters related to the first category item and then change the color and replace the xAxis text appropriately:
let myColor = "red"
widget.on('processresult', (w, args) => {
let categoryItem = widget.metadata.panels[0].items[0].jaql.dim
let myTeams = widget.dashboard.filters.item(categoryItem).jaql.filter.members
for (let i = 0; i < myTeams.length; i++) {
let myTeam = myTeams[i]
args.result.series[0].data.find((d) => { return d.selectionData[0] === myTeam }).color = myColor
}
for (let j = 0; j < args.result.xAxis.categories.length; j++) {
if (!myTeams.includes(args.result.xAxis.categories[j])) {
args.result.xAxis.categories[j] = ''
}
}
})
Secondly, lets make sure the widget filters behaviour is set to 'Highlight':