cancel
Showing results for 
Search instead for 
Did you mean: 

Column Chart - Reorder X-Axis

Ophir_Buchman
Sisense Team Member
Sisense Team Member

When creating a column chart you'd sometimes want to reorder the category fields

Apply the following widget script:

widget.on('processresult', function(widget,result) {
// Wanted Order
let order = ['New','Used','Refurbished','Unspecified']

// For each series
result.result.series.forEach(function(series) {
let newData = new Array(series.data.length);
for (let i = 0 ; i < series.data.length ; i++) {
let categoryName = series.data[i].selectionData[0]
let shouldBeAt = order.indexOf(categoryName)
newData[shouldBeAt] = series.data[i]
}
series.data = newData
})

// Replace X-Axis Labels
result.result.xAxis.categories = order
})
Before After
Ophir_Buchman_0-1652946574383.png Ophir_Buchman_1-1652946592071.png
0 REPLIES 0
Voice of Customer
Impact Business Intelligence (BI) and Analytics Market Research

Click Here & Complete Dresner's Wisdom of Crowds® Market Study Survey Today!

Community Toolbox

Recommended quick links to assist you in optimizing your community experience:

Need additional support?:

Community Support Request

Don't miss out:

Earn a BETA Launch Challenge Badge!