How to sort month/day properly in Canvas

Hello everyone, got a problem working with the canvas. The date isn't showing properly (organized by month then day) and I was wondering if theres anything I could use to have it fixed.

Here is how the chart is looking like:

And here is the Expression Editor at the moment:

filters ungrouped=true
| essql 
  query="SELECT count(1) as qtd_acessos,  convert(create_time, date)  as ano_mes, CASE WHEN actual_reservation_duration is not null THEN 'Manual' ELSE 'Automatic' END as \"Tipos de Teste\" FROM \"database\"
group by ano_mes, \"Tipos de Teste\""
| mapColumn name="ano_mes" expression={getCell "ano_mes" | formatdate "MMM/D"}
| pointseries x="ano_mes" y="qtd_acessos" color="Tipos de Teste" text="qtd_acessos"
| plot defaultStyle={seriesStyle lines="3" points="3"} 
  font={font align="left" color="#FFFFFF" family="'Open Sans', Helvetica, Arial, sans-serif" italic=false size=14 underline=false weight="normal"} yaxis=false legend="nw" palette={palette "red" "blue" gradient=true}
| render css=".canvasRenderEl .valueLabel { margin-top: -5px; color: white;}"

Thanks in advance!


What is the format in which you wanted date to get displayed?


1 Like

Just date, with no time data. But everytime I use format so the time wont show up that mess of days happens...

Made it with some formating and css.

First by treating the create_time with substring:

substring(convert(create_time, varchar),6,5)

This way the date order got a bit fixed but generated another problem that the dates now was completed inverted:

image 1(639)

But even though it was inverted, since it was in order I could use css properly so I made it.

Here is the css:`

 css=".canvasRenderEl .flot-base {
    transform: scale(-1, 1);

.canvasRenderEl .flot-x-axis div{
    transform: scaleX(-1);
.canvasRenderEl .flot-x-axis{
    margin-top: -10px;
    position: left;
    transform: scaleX(-1);

And here is the result:

image 2)

Since it worked I'll be posting as a solution, in any case thanks for reaching out @bhavyarm.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.