herobwl2000
Posts: 3
Joined: Sun Apr 07, 2024 5:03 am

Add DataTable object to Dashboard.board component

Hello guys, I have a function setupConnector and return a DataTable object like this

async function fetchData() {
var dataPool = new Dashboards.DataPool();
dataPool.setConnectorOptions({
id: "data",
type: "JSON",
options: {
dataUrl: "/home-tab/get-chart-data",
columnNames: ["id", "Time", "name_humid", "humid", "name_temp", "temp"],
dataRefreshRate: 10,
enablePolling: true,
firstRowAsNames: false,
},
});
const table = await dataPool.getConnectorTable("data");
const count = table.getRowCount();
table.renameColumn("id", "id1");
console.log(table, count);
return table.modified;
}

The question is how can i use table.modified in my Dashboard components since my data need to be filtered/preprocessed to show up on chart. Any helps will be appreciate! Thank you.
User avatar
dawid.d
Posts: 911
Joined: Thu Oct 06, 2022 11:31 am

Re: Add DataTable object to Dashboard.board component

Hello,

Welcome to our forum and thanks for contacting us with your question!

Do you really need to manage your data table at this level? If you want to create a dashboard, you can pass data to dataPool and automatically the components will get modified data tables from it.

Demo: https://jsfiddle.net/BlackLabel/ba6jtLve/

Let me know if that's not enough for you, I will try to help as best I can!
Best regards
Dawid Draguła
Highcharts Developer
herobwl2000
Posts: 3
Joined: Sun Apr 07, 2024 5:03 am

Re: Add DataTable object to Dashboard.board component

Thank you for your reply and your valuable information. I had looked into highcharts dashboard reference and saw that it has DataTable object and can do filter/concat on columns, so i want to use this method/function to modify the DataTable before taking it to the DataPool. My questions are:

1. Can it be done?
2. If can, how can i filter columns based on values on DataTable as in the reference?
3. And, how can i pass that filtered DataTable on the DataPool?

Sorry for my english since im not good at it, i really appreciate for your help, and have a nice weekend.
User avatar
dawid.d
Posts: 911
Joined: Thu Oct 06, 2022 11:31 am

Re: Add DataTable object to Dashboard.board component

Thanks for the explanation!

This is not a standard approach, but it is definitely possible. You just need to transfer the data table to the board in an appropriate way. There is no direct connector type that accepts a data table, but if you think it would be useful, let me know!

Demo: https://jsfiddle.net/BlackLabel/hq9apke7/

If you have any questions about the demo above, please don't hesitate to ask.
Best regards!
Dawid Draguła
Highcharts Developer
herobwl2000
Posts: 3
Joined: Sun Apr 07, 2024 5:03 am

Re: Add DataTable object to Dashboard.board component

Thank you so much for your replies, you just give too much valuable information for me. You and your teams are doing great, keep it up. Hope all the best to you! Maybe i will need your help very soon :v

Return to “Highcharts Dashboards”