Grafana custom time range for custom Graph Panel

Hello,

I have a custom Graph panel which takes the data from the PostgreSQL datasource and processes it in an external server before plotting it. The new data is from the future, and I would like to have a dashboard with a graph filled with the actual data with the dashboard time range (now - now-90d) and my custom graph with a future time range (i.e. now - now+30d).

Possible solutions I’ve already tried:
1. Add a relative time in the PostgreSQL Datasource query options: This solution seemed to be the one, but I need to take past data from the DB, so although the custom graph was correctly showing the future time range, no data was being queried and therefore no data was being processed.

2. Editing graph.ts and module.ts in custom graph plugin: I’ve been trying to set a manual time range in the code in order to get it set in the custom graph, but every change I’ve been making in methods buildFlotOptions(), addTimeAxis() and addXSeriesAxis() have no effect in the plot, it still takes the dashboard time range.

3. Longer dashboard time range: Setting the dashboard time range to now-90d - now+30d shows all the data I want, but the last 30d of the first graph and the first 90d of the second one are empty.

now-90d - now+30d time range display:

Thank you for your help.

Solved! All I had to do is modify addTimeAxis() function as I mentioned in the second possible solution (I had an import problem, that’s why I couldn’t see its changes).

I modified ‘min’ and ‘max’ variables there before they were sent to the panels options and it’s all working now.