About the "Performance history graph"

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
kodosapiens
Engineer
Engineer
Posts: 5
Joined: 17 Mar 2010 02:43

About the "Performance history graph"

Post by kodosapiens »

Why the vertical scale numbers are not hundreds?
When the company reaches 1000 rating, the scale max number is 1104... how weird. Why display values you can't reach.
Attachments
screenshot
screenshot
openttd rating.PNG (34.49 KiB) Viewed 2569 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: About the "Performance history graph"

Post by Alberth »

The scale of the graph is generally not big enough to read actual values (ie you cannot see the difference between 1000 and 999), therefore its only use is to give a global impression. If you want to know precisely, open the window with the actual number.

Edit: The graph scales automatically to make sure all values fit in the display. Try a few other graphs to see.
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: About the "Performance history graph"

Post by cirdan »

The graph drawing code always makes sure that it can represent values up to 1100. Don't ask me why.

(Or, rather, up to 11/10 of the current maximum, 1000 in your case.)

Code: Select all

// src_graph_gui.cpp:220
current_interval.highest = (11 * current_interval.highest) / 10;
current_interval.lowest =  (11 * current_interval.lowest) / 10;
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: About the "Performance history graph"

Post by Terkhen »

cirdan wrote:The graph drawing code always makes sure that it can represent values up to 1100. Don't ask me why.

(Or, rather, up to 11/10 of the current maximum, 1000 in your case.)

Code: Select all

// src_graph_gui.cpp:220
current_interval.highest = (11 * current_interval.highest) / 10;
current_interval.lowest =  (11 * current_interval.lowest) / 10;
In all other graphics besides the company performance rating, there is no fixed maximum value. Because the graph is scaled taking into account the the current maximum value and the minimum value, and showing the highest and lowest lines too close to the borders seems "ugly", they are arbitrarily separated in a fixed interval from them. So, in short, the reason is because "it looks nice". The code for spacing the lowest value of the interval seems wrong, though.
ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands

Re: About the "Performance history graph"

Post by ZxBiohazardZx »

try drawing a graph yourself, any program will force some white-space above highest value in order to prevent a horizontal line to show a visual illusion of a bounding box/axis rather then an actual function

11/10th is a good rule
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: About the "Performance history graph"

Post by cirdan »

What difference is there between the highest value and the lowest value, so that a gap is nice to have above but not below the graph?
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: About the "Performance history graph"

Post by Eddi »

lowest should probably read 9/10 instead of 11/10...

but maybe there should be a special mode for "fixed maximum" like the performance rating
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: About the "Performance history graph"

Post by cirdan »

Eddi wrote:lowest should probably read 9/10 instead of 11/10...
Not if you have negative values.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: About the "Performance history graph"

Post by Eddi »

ok, so we have three cases:
  1. there is a fixed {lower,upper} bound and the value is close to that bound, use the exact bound
  2. there is no fixed bound, or the value is far away, and the value is {positive,negative}, scale with 11/10 to produce a gap
  3. there is no fixed bound, or the value is far away, and the value is {negative,positive}, scale with 9/10 to produce a gap
did i now gather the problem correctly?

the upper bound is fixed for the performance rating (1000)
the lower bound is fixed for income and performance rating (0), maybe some others

the multiplicative scaling will not work for values close to 0
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: About the "Performance history graph"

Post by cirdan »

You can effectively do away with the 9/10 rule, since all graphs in OpenTTD include 0, which means that you will never get a positive lowest reference value or a negative highest one.

In fact, the current system would work rather well if the 11/10 of the highest value were just clamped to the absolute upper bound when it exists.
Baldy's Boss
Tycoon
Tycoon
Posts: 1396
Joined: 23 Feb 2014 22:02

Re: About the "Performance history graph"

Post by Baldy's Boss »

I see this issue has been around a while.
There may be a case for a small amount of space over 1000 but not for space that stretches with the graph...there should be an upper bound on top-stretch when there's a fixed max.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 5 guests