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://www.sisense.com/documentation/extending-dashboard-functionality-javascript/
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(); })
reverse_line_chart.js
-
I had success with the original script to reverse order of the x-axis:
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(); })
However, I'm wondering if anything was ever developed for the same functionality y-axis?
Please sign in to leave a comment.
Comments
10 comments