calendar
We use the chart type grid to show 24 hours days and day of week. The day of week only shows in Engllish and we can't setup the first day of week.
We need spanish translate and the week starts on monday.
-
AdminTom (Product Manager, MongoDB) commented
Thanks for the feature request. While I agree it would be ideal to support more customisation for date binning in the product, it is possible to get what you want by using calculated fields:
1. Create a new calculated field called "weekDay" with the following formula, replacing "yourDateField" with the name of the field you are using:
{ $dayOfWeek: "$yourDateField" }
2. Create a new calculated field called "spanishWeekday" with the following formula. Note that I am translating the numbers from the first calculated field into Spanish but also prefixing with a new number to influence the sort order.
{
$switch: {
branches: [
{ case: { $eq: [ "$weekDay", 1 ] }, then: "7. Domingo" },
{ case: { $eq: [ "$weekDay", 2 ] }, then: "1. Lunes" },
{ case: { $eq: [ "$weekDay", 3 ] }, then: "2. Martes" },
{ case: { $eq: [ "$weekDay", 4 ] }, then: "3. Miércoles" },
{ case: { $eq: [ "$weekDay", 5 ] }, then: "4. Jueves" },
{ case: { $eq: [ "$weekDay", 6 ] }, then: "5. Viernes" },
{ case: { $eq: [ "$weekDay", 7 ] }, then: "6. Sábado" }
],
default: "n/a"
}
}3. Use the new "spanishWeekday" field on the category axis of you chart, and choose to sort by Category in ascending order.