LuaGuiElement for graphs like production/electricity

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

LuaGuiElement for graphs like production/electricity

Post by sparr »

I'd like to be able to present a multi-series line graph in a mod gui, like the built-in graphs for production and electricity. I imagine this would involve a new LuaGuiElement type, and a new method for updating the graph data.

Code: Select all

data = {
    foo={5,5,5,7,5,6,6,6,8},
    bar={1,2,3,1,2,3,1,2,3},
}
graph = someframe.add{type="graph"}
graph.update_data(data)
... [one or many ticks later] ...
graph.update_data(new_data)
The vertical axis would automatically scale and label based on the data, like the existing graphs.

Some way to provide horizontal axis labels would be needed, but I suspect the internal representation of the graph would lend itself to some specific lua representation that I don't want to guess at.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: LuaGuiElement for graphs like production/electricity

Post by raiguard »

+1. I would like to use graphs as well!
Don't forget, you're here forever.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: LuaGuiElement for graphs like production/electricity

Post by Rseding91 »

I could implement this but it would have absolutely terrible performance and most likely a super complex/annoying API to use... both of those combined means it would take a lot of time to do and very few people would make use of it.

So, I don't really see this happening.
If you want to get ahold of me I'm almost always on Discord.

sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: LuaGuiElement for graphs like production/electricity

Post by sparr »

For anyone who comes here later looking for this feature, here's a mod with some functionality you might be able to use:

https://mods.factorio.com/mod/timeseries
https://mods.factorio.com/mod/timeseries_fixfor110

Post Reply

Return to “Modding interface requests”