Skip to content
This repository was archived by the owner on Feb 18, 2021. It is now read-only.
This repository was archived by the owner on Feb 18, 2021. It is now read-only.

[Question] Order BarChart by value's desc order #380

@fms-santos

Description

@fms-santos

Hi,

I'm trying to build a custom dashboard with some analytics coming in from a chatbot I've built.
My problem is that I can't figure out how to show a bar chart with the values in descending order.

The query is

  query: ({ granularity }) => `
     extend cslen=customDimensions.callstack_length, value=tostring(customDimensions.ID_Fornecedor) 
    | where name=='ChatbotFornecedores.InvoiceSearch' and (cslen == 0 or strlen(cslen) == 0) and strlen(value) > 0 
    | summarize faturas=count() by value
    | order by faturas desc`,
    filters: [{ dependency: "selectedFornecedores", queryProperty: "customDimensions.ID_Fornecedor" }],
      format: { type: "bars", args: { barsField: "value", valueField: "faturas", seriesField: "value" } },
  props: { nameKey: "values" }
}

The Data that shows up on the bar chart is exatly what I want:

[
  {
    "value": "1000478",
    "faturas": 7
  },
  {
    "value": "1020080",
    "faturas": 6
  },
  {
    "value": "1000968",
    "faturas": 4
  },
  {
    "value": "1000969",
    "faturas": 2
  }
]

But the bar chart itself shows up in this way:
bar_chart

It orders by ID and not by the "faturas" count.
I've played around with the props and args properties of the bar chart but I can't figure it out a way to solve this.
I've also checked here Ibex-Components-BarChart and here Rechart-BarChartProps.

Thank you for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions