Transport Fever 2

Transport Fever 2

Create your own game world!
Give your game a personal touch and change it to your liking. Create, share and install mods. Customize the game with new landscapes, vehicles, stations, assets and more.
bezousek 1 26 May, 2023 @ 2:49pm
Mod to create chart
Hi I try to create my custom chart but I am unable to make this working. Documentation doesn't provide any details.

Here is my code:
local chart = api.gui.comp.Chart.new()
chart:setId("myChart")
chart:setAxis(0, 1850, 1870, {1850, 1860, 1870})
chart:setAxis(1, -2000000, 2000000, { -2000000, -1000000, 0, 1000000, 2000000 })
chart:addSeries({1850, 1851, 1852}, {1500000, 0, -1500000})
chart:setSeriesLabels({ "aa", "bb" })
chart:setType(0, "LINE")

Unfortunately I always receive an assertion that format function is missing.
Assertion Failure: Assertion `m_data->axes[0].formatFn` failed.

Any idea or better documentation?

Thanks a lot
< >
Showing 1-3 of 3 comments
okeating 22 6 Jun, 2023 @ 9:57am 
I have been hitting exactly the same issue - I even searched for all of the subscribed mods to see if anyone else has written a chart - without success. I will let you know if I find anything useful
bezousek 1 7 Jun, 2023 @ 7:54am 
Thanks for a comment. I wrote to developers to help, but without success.
bezousek 1 11 Jul, 2023 @ 1:47pm 
Just the reference for the others. Dev team found a bug in the source code and they provide a fix in near future.
< >
Showing 1-3 of 3 comments
Per page: 1530 50