1
0
Fork 0

Fix #13954: Plotting graphs with limited data to the right. (#13956)

pull/14000/head
John Taylor 2025-04-14 16:57:07 +02:00 committed by GitHub
parent 3dacf46870
commit 069edc1a4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -442,10 +442,14 @@ protected:
y += y_sep;
}
x = rtl ? r.right : r.left;
y = r.bottom + ScaleGUITrad(2);
/* if there are not enough datapoints to fill the graph, align to the right */
x += (this->num_vert_lines - this->num_on_x_axis) * x_sep;
/* Draw x-axis labels and markings for graphs based on financial quarters and years. */
if (this->draw_dates) {
x = rtl ? r.right : r.left;
y = r.bottom + ScaleGUITrad(2);
TimerGameEconomy::Month month = this->month;
TimerGameEconomy::Year year = this->year;
for (int i = 0; i < this->num_on_x_axis; i++) {
@ -471,9 +475,6 @@ protected:
}
} else {
/* Draw x-axis labels for graphs not based on quarterly performance (cargo payment rates, and all graphs when using wallclock units). */
x = rtl ? r.right : r.left;
y = r.bottom + ScaleGUITrad(2);
int16_t iterator;
uint16_t label;
if (this->x_values_reversed) {
@ -512,6 +513,9 @@ protected:
x = r.left + (x_sep / 2);
}
/* if there are not enough datapoints to fill the graph, align to the right */
x += (this->num_vert_lines - this->num_on_x_axis) * x_sep;
uint prev_x = INVALID_DATAPOINT_POS;
uint prev_y = INVALID_DATAPOINT_POS;