projects
/
ctsim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
85c4062
)
Fix axis_scale when min==max
author
Kevin Rosenberg
<kevin@rosenberg.net>
Mon, 3 Aug 2009 15:34:19 +0000
(09:34 -0600)
committer
Kevin Rosenberg
<kevin@rosenberg.net>
Mon, 3 Aug 2009 15:34:19 +0000
(09:34 -0600)
libctgraphics/ezplot.cpp
patch
|
blob
|
history
diff --git
a/libctgraphics/ezplot.cpp
b/libctgraphics/ezplot.cpp
index 099eff5ded8d050d0d067b225adfce18823b4429..ca32b8fea239fee9e86f3897afc696336e863689 100644
(file)
--- a/
libctgraphics/ezplot.cpp
+++ b/
libctgraphics/ezplot.cpp
@@
-1161,10
+1161,19
@@
EZPlot::symbol (int sym, double symwidth, double symheight)
int
EZPlot::axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp)
{
int
EZPlot::axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp)
{
- if (
min >= max ||
nint < 1) {
- sys_error (ERR_WARNING, "
Invalid params: min=%lf, max=%lf, num intervals=%d [axis_scale]", min, max
, nint);
+ if (nint < 1) {
+ sys_error (ERR_WARNING, "
No intervals to plot: num intervals=%d [axis_scale]"
, nint);
return (FALSE);
}
return (FALSE);
}
+ if (min >= max) {
+ double scaled = fabs(max) / 10;
+ if (scaled == 0)
+ scaled = 0.1;
+ *minp = min - scaled;
+ *maxp = max + scaled;
+ *nintp = 2;
+ return (TRUE);
+ }
double eps = 0.025;
double a = fabs(min);
double eps = 0.025;
double a = fabs(min);