CChart displays nothing, when the series is constant or any value is Infinity.
This patch fixes this by assuming Infinityis 1.5 * the highest value.
The constant series bug is fixed by increasing the value range in this case by 1.
Details
- Reviewers
vladislavbelov - Commits
- rP19408: Fix CChart scaling edgecases (constant value and infinity)
- Trac Tickets
- #3403
Display a graph with a constant series and one with an infinite value.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/414/ for more details.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/421/ for more details.
Wouldn't it make more sense for nothing to be displayed in the case of an infinite value?
I am not against it, but what would be the benefits?
(because the current approach is much easier to implement)
Well, it seems strange to use some random value for an infinite value, and infinite values should in practice not be displayed on the chart.
X-values should have a check for infinity too, because the chart is a common object, so it could draw not only math functions, but vertical graphics too and any kind of poly-line.
The rest of the patch looks good for me.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/723/ for more details.
source/gui/CChart.cpp | ||
---|---|---|
136 ↗ | (On Diff #1174) | Should be if (!vertices.empty()), as wraitii said. |
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/724/ for more details.
Perhaps, elexis will want to split it in two commits: adding const and fixing infinity. But in this case I don't mind for single commit.
I like it.
source/gui/CChart.cpp | ||
---|---|---|
136 ↗ | (On Diff #1197) | Not fixed. |
source/gui/CChart.cpp | ||
---|---|---|
136 ↗ | (On Diff #1197) | Seems like I forgot to save :/ |
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/736/ for more details.
The good one, also this helper really should be as non-static method, because it could be used in future to draw lines in different styles.
Build is green
Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK!
http://jw:8080/job/phabricator/742/ for more details.
Splitting the kind of unrelated Shader changes to D315 was a good decision IMO.
Thanks for taking care of those edge cases without using the workaround hack!