Hi,
I construct my data like this:
const data = query1.data.map((obj) => {
const date = new Date(obj.PaymentDate);
const month = date.toLocaleString('en-US', { month: 'short' });
return {
AmountGBP: obj.AmountGBP * 0.01,
AccountType: obj.AccountType,
CustomerName: obj.CustomerName,
Month:month
};
});
return data
My plotly JSON looks like this:
[
{
"name": "AmountGBP",
"x": {{formatDataAsObject(allPaymentsPerMonth.data).Month}},
"y": {{formatDataAsObject(allPaymentsPerMonth.data).AmountGBP}},
"type": "bar",
"hovertemplate": "<b>%{x}</b><br>%{text}: %{y} <extra></extra>",
"text": {{formatDataAsObject(allPaymentsPerMonth.data).CustomerName}},
"transforms": [
{
"type": "sort",
"target": {{ formatDataAsObject(allPaymentsPerMonth.data).Month.map(month => {
return new Date(`01 ${month} 2023`);
}) }},
"order": "ascending"
},
{
"type": "groupby",
"groups": {{formatDataAsObject(allPaymentsPerMonthFiltered.data)['AccountType']}},
},
{
"type": "aggregate",
"groups": {{formatDataAsObject(allPaymentsPerMonth.data).Month}},
"aggregations": [
{
"target": "y",
"func": "count",
"enabled": true
},
]
}
]
}
]
For some reason the order of the months change when I change "groups": {{formatDataAsObject(allPaymentsPerMonthFiltered.data)['AccountType']}}
to "groups": {{formatDataAsObject(allPaymentsPerMonthFiltered.data)['CustomerName']}},
. It is in correct order for AccountType but not for CustomerName. Is this a bug or am I doing something wrong?