cancel
Showing results for 
Search instead for 
Did you mean: 

Column Chart - Rename Categories/Break-By

Ophir_Buchman
12 - Data Integration
12 - Data Integration

When creating a column chart you'd sometimes want to rename the categories/break-by fields

Modify the "Break-By" Category Names

Apply the following widget script:

widget.on('processresult', function(widget,result) {
// Translation Dictionary
let dict = {'1':'January', '2':'February', '3':'March', '4':'April', '5':'May', '6':'June', '7':'July', '8':'August', '9':'Septempber', '10':'October', '11':'November', '12':'December'}

result.result.series.forEach(function(ser) {
ser.name = dict[ser.name]
})
})
Before After
 Ophir_Buchman_4-1652684842117.png Ophir_Buchman_5-1652684857959.png

Modify the "Category" Names

Apply the following widget script:

widget.on('processresult', function(widget,result) {
// Translation Dictionary
let dict = {'1':'January', '2':'February', '3':'March', '4':'April', '5':'May', '6':'June', '7':'July', '8':'August', '9':'Septempber', '10':'October', '11':'November', '12':'December'}

for (let i = 0 ; i < result.result.xAxis.categories.length ; i++) {
result.result.xAxis.categories[i] = dict[result.result.xAxis.categories[i]]
}
})

 

Before After
Ophir_Buchman_6-1652684910083.png Ophir_Buchman_7-1652684926006.png
0 REPLIES 0