I use the n8n in queue mode with the following settings:
1 main
1 postgresql
1 redis
1 rabbitmq
2 workers
Nginx Proxy Manager (reverse proxy)
What is the error message (if any)?
I want to generate a graph from the data provided by a query in the postgres node.
In the example below, the postgres node returns four values: 79, 82, 98 and 96.
The problem is that the QuickChart node creates the charts but only with vertical data from 0 to 9.
I couldn’t find any option in the QuickChart node to fix this.
Where am I going wrong?
@sidney27 , for each bar to be of a different color, each number has to belong to a different dataset. That is instead of a single array you have to have 4 different and specific arrays. That is instead of
To achieve that, not only you would have to transform a single set of data into four sets with zeros as a “padding”, you would also have to utilize HTTP Request node instead of QuickChart and use a specific data structure as per QuickChart API, which will produce
Taking advantage, ihortomm, another need arose.
I will explain the purpose of the flow for better understanding.
I’m putting together a flow to create graphs using AI.
The idea is to ask chatgpt (using API) to create the postgres SQL query for a given query. This created query is executed by the postgres node and then follows the flow you already know.
The issue is that the data will not always be the same, nor the quantity, as in the example we are using (number of calls per department).
How do I make the creation dynamic according to the amount of data generated?
Below is an example of another query.
Thank you very much in advance for the time you invested in helping me.
You seemed to have missed that count is expected to be turned into an array. You have to use the expression like this, {{ [$json.count] }} instead of just {{ $json.count }}.
You seem to be introducing yet another dimension that needs to be taken into account, namely mes (month). That would require some adjustments reflected in the workflow below.
This, however, assumes that you have data produced for each month and area. For this to work, you need to make sure SQL returns 0 for the areas in that month when there is no data for it.