Hi @noah,
Yes, you can use ChartFactor’s derived fields described here: https://chartfactor.com/doc/1.10/derived_fields/. You could define a derived field as shown below:
let dayOfWeekStr = {
'name': 'day_of_week_str',
'label': 'Day of Week (derived)',
'type': 'ATTRIBUTE',
'dependencies': ['day_of_week'],
'function': (dayOfWeek) => {
let day = {
'7' : { value: 'Sun', order: 1 },
'1' : { value: 'Mon', order: 2 },
'2' : { value: 'Tue', order: 3 },
'3' : { value: 'Wed', order: 4 },
'4' : { value: 'Thu', order: 5 },
'5' : { value: 'Fri', order: 6 },
'6' : { value: 'Sat', order: 7 }
}
return day[dayOfWeek];
}
}
Notice 'function'
that receives the dependency as parameter and returns the new vlue. Notice also the custom order so that Sunday is first.
Then, just plug-in the definition above in your source metadata definition.
var _META_ = {
'sales': {
'fields': {
'day_of_week_str': dayOfWeekStr,
'price_paid': {
'label': "Price"
}
}
}
}
Hope it helps.