Smart multiline chart struggle

## Feature(s) impacted
Smart charts, sql queries, multiple line charts

## Observed behavior
I observed that in a simple query time chart I couldnt have multiple lines.
But when I send my query to postgre, I received two different data set that are not understood. See Img 1.

image

When I use the smart chart builder, I want to have a json formatted data set that I don’t know how to implement.
I used the fetchData() function but the link : /forest/… I can’t manage to get the data I want.

I also tried to use the documentation on this link : Create multiple line charts - Woodshop

But I could not manage to write the component section of the smart chart builder correctly.

What I could manage to do is a multiple line chart with a data set in json that I wrote but these are not the data I wanted.
I used the D3 library to visualize the chart through the builder (Template and Component).

## Expected behavior
I want to have a superposition of the users in a time chart. In order to make my dashboard more efficient.

## Failure Logs
I had this log when I tried to use the documentation above in the component section of the smart chart builder.

## Context

  • Project name: ExplorJob
  • Team name: Interface developpers
  • Database type: postgre sql

Thanks for your help !

Hi @Nils_Guicherd :wave:

I observed that in a simple query time chart I couldnt have multiple lines.

You’r right! It is not possible today.

The best and easiest way to do that is to use an API line chart.
You must create a route on your express app like below

And after that create the chart just like below

Let me know if that help :pray:

Thanks, so where do I create this api route ? What do you mean by express app ? :innocent:

Then I have to send an sql query and transform the response into the json body you wrote right ?

You must create this route inside your forest-express-sequelize agent code, on your server. (is what i mean by express app :slight_smile:)

And instead of datas object on my screen you must get your datas you want form your database and format it this way.

great thanks for your support :pray:

1 Like

Is it working like you want now?
Can i close the topic?

i guess so, just waiting for some internal processes to make it work but it should be fine.
thanks,

1 Like

I figured it out how to implement a new route for an API time based chart with the documentation but the request is obliged to be a POST ? Why not a GET ?

See here below my code :

The query functions as I tested it before in a query chart, but I get only one line.

This is what I get from the console :slight_smile:

Have you any idea why I get this error ?