Temporary data calculation and visualization

Hello everyone! I met an interesting case - I need to read intermediate data according to certain conditions (formulas) for visualization in the form of a graph based on data in the database, for example, the number of orders per hour throughout the day. I display the graph with the Chart Element plugin and, accordingly, need to feed the data source. Is it possible to somehow create a “virtual” data source, into which the values can be calculated using formulas and merged into a graph?