Changeset 41376
- Timestamp:
- Jun 22, 2020, 10:56:43 AM (6 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 8 edited
-
include/structures.h (modified) (1 diff)
-
src/DrawFrame.c (modified) (1 diff)
-
src/Graphs.c (modified) (1 diff)
-
src/LoadFrame.c (modified) (1 diff)
-
src/PDF_Frame.c (modified) (1 diff)
-
src/SetGraphData.c (modified) (1 diff)
-
src/TickMarks.c (modified) (5 diffs)
-
src/bDrawFrame.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/include/structures.h
r41344 r41376 165 165 double fLabelRange; 166 166 double fMinor; 167 double dMajor; 167 168 int color; 168 169 } Axis; -
trunk/Ohana/src/kapa2/src/DrawFrame.c
r41344 r41376 18 18 Py = 0.5 * (1 + 0.25*graph[0].axis[1].lweight) * (hypot (graph[0].axis[1].dfx, graph[0].axis[1].dfy) + hypot (graph[0].axis[1].dfx, graph[0].axis[1].dfy)); 19 19 int P = MIN (Px, Py); 20 // fprintf (stderr, "P: %d\n", P); 20 21 21 22 /* each axis is drawn independently, but ticks and labels are placed according to perpendicular distance. */ -
trunk/Ohana/src/kapa2/src/Graphs.c
r41344 r41376 25 25 graph[0].axis[i].fLabelRange = 1.0; 26 26 graph[0].axis[i].fMinor = 5.0; 27 graph[0].axis[i].dMajor = NAN; 27 28 memset (graph[0].axis[i].format, 0, 16); 28 29 } -
trunk/Ohana/src/kapa2/src/LoadFrame.c
r41344 r41376 42 42 graph[0].axis[3].fLabelRange = graph[0].data.fLabelRangeYp; 43 43 44 // fMinor and dMajor should have defaults of NAN 45 // with default behavior defined in TickMarks.c 46 // for one axis (x or y), if both + and - are 47 // NAN, keep the default behavior, but if one 48 // is NOT NAN, use that for both (synchronization) 49 44 50 graph[0].axis[0].fMinor = graph[0].data.fMinorXm; 45 51 graph[0].axis[1].fMinor = graph[0].data.fMinorYm; 46 52 graph[0].axis[2].fMinor = graph[0].data.fMinorXp; 47 53 graph[0].axis[3].fMinor = graph[0].data.fMinorYp; 54 55 graph[0].axis[0].dMajor = graph[0].data.dMajorXm; 56 graph[0].axis[1].dMajor = graph[0].data.dMajorYm; 57 graph[0].axis[2].dMajor = graph[0].data.dMajorXp; 58 graph[0].axis[3].dMajor = graph[0].data.dMajorYp; 48 59 49 60 strcpy (graph[0].axis[0].format, graph[0].data.formatXm); -
trunk/Ohana/src/kapa2/src/PDF_Frame.c
r41344 r41376 86 86 87 87 if (tick->IsMajor) { 88 size = MIN (0.50*P, MAX (0.0 30 * P, 10.0));88 size = MIN (0.50*P, MAX (0.010 * P, 10.0)); 89 89 } else { 90 size = MIN (0.25*P, MAX (0.0 15 * P, 5.0));90 size = MIN (0.25*P, MAX (0.005 * P, 5.0)); 91 91 } 92 92 dir = ((naxis == 2) || (naxis == 3)) ? -1 : +1; -
trunk/Ohana/src/kapa2/src/SetGraphData.c
r41344 r41376 37 37 graph[0].axis[2].fMinor = graph[0].data.fMinorXp; 38 38 graph[0].axis[3].fMinor = graph[0].data.fMinorYp; 39 40 graph[0].axis[0].dMajor = graph[0].data.dMajorXm; 41 graph[0].axis[1].dMajor = graph[0].data.dMajorYm; 42 graph[0].axis[2].dMajor = graph[0].data.dMajorXp; 43 graph[0].axis[3].dMajor = graph[0].data.dMajorYp; 39 44 40 45 strcpy (graph[0].axis[0].format, graph[0].data.formatXm); -
trunk/Ohana/src/kapa2/src/TickMarks.c
r41344 r41376 19 19 20 20 // be a little generous 21 NTICKS = (int)(fabs(range / minor)) + 2;21 NTICKS = MIN((int)(fabs(range / minor)) + 2, 1000); 22 22 ALLOCATE (ticks, TickMarkData, NTICKS); 23 23 … … 101 101 double lrange, factor, mantis, fmantis, power; 102 102 103 // range is the full range of the plot axis (e.g., 10 - 1010 : range = 1000) 103 104 *range = axis->fLabelRange*(axis[0].max - axis[0].min); 104 105 if (fabs(*range) < MIN_RANGE) { … … 106 107 } 107 108 109 // lrange : log of the full range (e.g., 3000 -> ~3.5) 108 110 lrange = log10(MAX(fabs(*range), MIN_RANGE)); 109 111 double truncRange = ((int) ((lrange + 0.005) * 1000)) / 1000.0; 110 112 lrange = truncRange; 111 113 114 // split the lrange into the integer and fractional portions 115 // e.g., range = 3000, lrange ~ 3.5, factor = 3, mantis = 0.5 116 // if lrange is negative (range < 1), and mantis is negative, shift so mantis positive 117 // e.g., range = 0.2, lrange = -0.69, mantis = -0.69, factor = 0 -> factor = -1, mantis = 0.301 (2 x 0.1 instead of 0.2 x 1) 112 118 mantis = modf (lrange, &factor); 113 119 if (mantis < 0.0) { … … 115 121 factor -= 1.0; 116 122 } 117 123 118 124 // how many significant digits are needed? 119 125 126 // power is 10^factor above, e.g., range = 3000, factor = 3, power = 1000 (integer power-of-ten) 127 // fmantis is the 10^mantis above, e.g., range = 3000, mantis = 0.5, fmantis = 3 120 128 power = MAX(pow(10.0, factor), MIN_RANGE); 121 129 fmantis = pow(10.0, mantis); 122 130 *major = MAX(0.5 * power, MIN_RANGE); 123 *minor = MAX(0.1 * power, MIN_RANGE);124 131 125 132 if ((fmantis >= 1.0) && (fmantis < 1.999)) { … … 183 190 } 184 191 } 192 if (isfinite(axis->dMajor)) *major = axis->dMajor; 193 185 194 *minor = *major / axis->fMinor; 186 195 } -
trunk/Ohana/src/kapa2/src/bDrawFrame.c
r41344 r41376 16 16 int Py = 0.5 * (1 + 0.25*graph[0].axis[1].lweight) * (hypot (graph[0].axis[1].dfx, graph[0].axis[1].dfy) + hypot (graph[0].axis[1].dfx, graph[0].axis[1].dfy)); 17 17 int P = MIN (Px, Py); 18 // fprintf (stderr, "P: %d\n", P); 18 19 19 20 /* each axis is drawn independently */ … … 81 82 82 83 if (tick->IsMajor) { 83 size = MIN (0.50*P, MAX (0.0 30 * P, 10.0));84 size = MIN (0.50*P, MAX (0.010 * P, 10.0)); 84 85 } else { 85 size = MIN (0.25*P, MAX (0.0 15 * P, 5.0));86 size = MIN (0.25*P, MAX (0.005 * P, 5.0)); 86 87 } 87 88 dir = ((naxis == 0) || (naxis == 3)) ? -1 : +1;
Note:
See TracChangeset
for help on using the changeset viewer.
