Knowledge Base Article

Reverse X-Axis Order In A Line Chart

Introduction

By default, Sisense sorts a line chart in ascending order. The only other way to order the line chart is by the values in the series being plotted. The code in this article will enable you to reverse the chart order.
 

Implementation

The code for this functionality is attached to the post and embedded in this article. You'll implement the code as a widget script. There's more information on adding widget scripts here: https://sisense.dev/guides/customJs/extensions/
Paste the following code into your widget's script editor:
widget.on("processresult",function(w,args){
 for (i=0;i<args.result.series.length;i++) {
  args.result.series[i].data.reverse();
 };
 args.result.xAxis.categories.reverse();
})
Updated 02-16-2024
No CommentsBe the first to comment