diff options
-rw-r--r-- | js/RrdDataFile.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/js/RrdDataFile.js b/js/RrdDataFile.js index 2c0e846..08cc3ae 100644 --- a/js/RrdDataFile.js +++ b/js/RrdDataFile.js | |||
@@ -60,11 +60,13 @@ RrdDataFile.prototype = { | |||
60 | for (i = 0; i < rra_cnt; i++) { | 60 | for (i = 0; i < rra_cnt; i++) { |
61 | rra = rrd.getRRAInfo(i); | 61 | rra = rrd.getRRAInfo(i); |
62 | if (RrdGraphDesc.cf_conv(rra.getCFName()) === cf_idx) { | 62 | if (RrdGraphDesc.cf_conv(rra.getCFName()) === cf_idx) { |
63 | cal_end = (rrd.getLastUpdate() - (rrd.getLastUpdate() % (rra.getPdpPerRow() * rra.pdp_step))); | 63 | /* covered seconds in this RRA */ |
64 | cal_start = (cal_end - (rra.getPdpPerRow() * rra.row_cnt * rra.pdp_step)); | 64 | var range_secs = rra.getStep(); |
65 | cal_end = rrd.getLastUpdate() - (rrd.getLastUpdate() % range_secs); | ||
66 | cal_start = cal_end - (range_secs * rra.row_cnt); | ||
65 | full_match = gdp.end - gdp.start; | 67 | full_match = gdp.end - gdp.start; |
66 | 68 | ||
67 | tmp_step_diff = Math.abs(ft_step - (rrd.getMinStep() * rra.pdp_cnt)); | 69 | tmp_step_diff = Math.abs(ft_step - range_secs); |
68 | if (cal_start <= gdp.start) { | 70 | if (cal_start <= gdp.start) { |
69 | if (first_full || (tmp_step_diff < best_full_step_diff)) { | 71 | if (first_full || (tmp_step_diff < best_full_step_diff)) { |
70 | first_full = 0; | 72 | first_full = 0; |
@@ -91,7 +93,7 @@ RrdDataFile.prototype = { | |||
91 | var rra_info = rrd.getRRAInfo(chosen_rra); | 93 | var rra_info = rrd.getRRAInfo(chosen_rra); |
92 | rra = rrd.getRRA(chosen_rra); | 94 | rra = rrd.getRRA(chosen_rra); |
93 | 95 | ||
94 | ft_step = rrd.rrd_header.pdp_step * rra_info.getPdpPerRow(); | 96 | ft_step = rra_info.getStep(); |
95 | gdp.start -= (gdp.start % ft_step); | 97 | gdp.start -= (gdp.start % ft_step); |
96 | gdp.end += (ft_step - gdp.end % ft_step); | 98 | gdp.end += (ft_step - gdp.end % ft_step); |
97 | rows = (gdp.end - gdp.start) / ft_step + 1; | 99 | rows = (gdp.end - gdp.start) / ft_step + 1; |