cancel
Showing results for 
Search instead for 
Did you mean: 

Y Axis sorting

DamianC
8 - Cloud Apps
8 - Cloud Apps

Hi All,

Can anyone help with sorting the Y axis on this scatter. I can see why it's building this way but I need it to be more readable for the end user. 

DamianC_0-1677689572023.png

Additionally is there anyway to hide the empty tool tip or at least include value, X & Y

DamianC_1-1677689825526.png

 

2 REPLIES 2

Benji_PaldiTeam
11 - Data Pipeline
11 - Data Pipeline

Hi @DamianC ,
Take a look at this post by @intapiuser .

Regarding your question about hiding an empty tooltip, try the script suggested in this post.

 

 Feel free to reach out if you have further questions, we're always happy to help (: 
Paldi Solutions - Number #1 Sisense Plugins Developer 

Hi Benji, 

Thanks for the info, I've added in the scripts and tooltip is gone as requested, and sorting on the y axis has been achieved however, this has now re ordered the x axis.

 

DamianC_0-1677841560506.png

 

I've tried to incorporate another script I found but it's not working. Can you provide further assistance please? 

 

widget.on('beforeviewloaded',function(se,ev){
ev.options.chart.type='heatmap'
})

var xOrder = 'desc' //also, this value can be desc
var yOrder = 'asc'

widget.on('beforeviewloaded', function(scope, args) {
var shouldBeExecuted = (order === 'desc' || order === 'asc' )
if (args.widget.type !== 'chart/scatter' || !shouldBeExecuted) {
return
}

var daysOrder = args.options.xAxis.categories.sort();
if (xOrder === 'desc') {
daysOrder.reverse()
}


if (daysOrder.length === args.options.xAxis.categories.length) {
args.options.xAxis.categories = daysOrder
for (i=0; i<daysOrder.length; i++) {
for (k=0; k<args.options.series.length; k++) {
for (j=0; j<args.options.series[k].data.length; j++) {
if (args.options.series[k].data[j].selectionData[0] === daysOrder[i]) {
args.options.series[k].data[j].x = i;
}
}
}
}
}
})


widget.on('beforequery', function(se, ev) {
ev.query.metadata.forEach(function(m) {
if (m.wpanel && m.wpanel === 'y-axis') {
m.jaql.sort = yOrder
}
})
})


var categories= ['00:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00',];

widget.on('queryend',function(se,ev){
ev.rawResult.values.sort(function(a, b){
var aIndex = categories.indexOf(a[0].data.trim());
var bIndex = categories.indexOf(b[0].data.trim());

if (aIndex < bIndex)
return -1;
if (aIndex > bIndex)
return 1;

return 0;
})
})

widget.on("beforedatapointtooltip", function (se, args){
args.cancel=true;
});