About Amount Totals display in playground Table

Hi,

i’m getting below 2 issue…

  1. while creating chart in Playground table column name showing (TableName columnName) , so how can i edit column name in view.

  2. How i add Totals of Amount, like below
    image

Please help on this!!

Hi @Amit :wave:

Thanks for the question!

  1. I’m afraid it’s not possible in the Playground. You can do it in your frontend app if you will create it.
    There is a code example that might be helpful:
let response = {"query":{"measures":["LineItems.count"],"timezone":"UTC","order":[],"filters":[],"dimensions":[],"timeDimensions":[]},"data":[{"LineItems.count":"20000"}],"lastRefreshTime":"2021-07-22T10:58:48.362Z","annotation":{"measures":{"LineItems.count":{"title":"Line Items Count","shortTitle":"Count","type":"number","drillMembers":["LineItems.id","LineItems.createdAt"],"drillMembersGrouped":{"measures":[],"dimensions":["LineItems.id","LineItems.createdAt"]}}},"dimensions":{},"segments":{},"timeDimensions":{}},"slowQuery":false}

console.log(response.data)

// [{LineItems.count: "20000"}]

console.log(response.data.map(row => Object.fromEntries(Object.entries(row).map(([ key, value ]) => ([ key.split('.')[1], value ])))))

[{count: "20000"}]
  1. The same situation, unfortunately. I think you need to send a second query or calculate the total on the front end.

To make it easier to create a chart like a table, you can read this guide: Tableau-like Charts with MuzeJS, Cube.js, and React - Cube.js Blog

2 Likes

Hi @antonrychkov , Thanks for Reply

will try…