Pie chart data from database specified line

I am trying to use a pie chart with data from my database but i am new to this application and JS (java script) and i have tried a few things but they dont work.
This is the script i used wich didnt work:

{{table1.data['Actueel aantal in meters'][table1.selectedRow.index]}} {{table1.data['Order totaal in meters'][table1.selectedRow.index]}}

I got an error message with "the value has to be of type 'object' , you provided a value of type 'string'".
I need to get data from the database in the pie chart but the data must be from the selected line in the table.

Can anyone help me with this?

@Tcj
Welcome to the forum!
Can you take a screenshot of the Inspect panel for the pie chart?
Are you using the UI form? Or Plotly JSON?

Hi there @ScottR and thank you,
I have taken 2 screenshots.


In the Data source field you may want to enter the table row data in the second screenshot instead...assuming Miraflex.data is the result for the entire table?
but surround it with [ and ] like:

[{{table1.selectedRow.data.Amount}}]

New script
I now have this in data source, the first line works the second line doesnt.
It says: The value has to be of type 'object', you provided a value of type 'string'.
This only happens when i add the second line of the script.

use only one set around both values not for each - that might work - I am not an expert on charts at a granular level :slight_smile:

No error this time but no values either.

table1.selectedRow.data['Actueel aantal in meters']['Order totaal in meters']

  • undefined

The ['Order totaal in meters'] is * undefined.
So it gives me the value [null].

Are you trying to get the values from column names?
if so it would be table2.selectedRow.data.id (or whatever the name of the column that is in the database in the original payload from the query....

More screenshots of query and table columns would help me help you :slight_smile:

I am trying to get 2 values from table1 wich have to be from the row i selected.
In this table i need to get "actueel aantal" and "Order totaal".
I want to get these 2 values on a pie chart so the customer can see the difference between the actual produced products and the amount they wanted to produce.
I am trying to get the values from 1 row (which i can select) and 2 different collums yes, they will always be the same collums.






New script

I had to reply twice to upload al the pictures.

try:
[{{table1.selectedRow.data.Actueel aantal in meters}} {{table1.selectedRow.data.Order totaal in meters}}]

I have used [{{table1.selectedRow.data.Actueel aantal in meters}} {{table1.selectedRow.data.Order totaal in meters}}]
but now i get
{"message ":" JSON5: invalid character '{' at 1:55","payload":[true,true]}