|
|
|
|
@@ -1035,7 +1035,7 @@ void Graphic::drawAction() {
|
|
|
|
|
void Graphic::drawGrid() {
|
|
|
|
|
int gbx = gridborder.x(), gby = gridborder.y(), cwid = canvas->width(), chei = canvas->height();
|
|
|
|
|
double px, py, range, step, start;
|
|
|
|
|
int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt;
|
|
|
|
|
int wid = cwid - gbx - 5, hei = chei - gby - 5, cx, cy, cnt, right = cwid + gbx;
|
|
|
|
|
QRect rect;
|
|
|
|
|
QPair<QString, QString> str;
|
|
|
|
|
|
|
|
|
|
@@ -1099,7 +1099,7 @@ void Graphic::drawGrid() {
|
|
|
|
|
if (axis_type_x == Graphic::Numeric) {
|
|
|
|
|
if (grad_x == Graphic::Auto) step = splitRange(range, wid / gridx / font_sz.width() * 1.4);
|
|
|
|
|
else step = gridx;
|
|
|
|
|
start = roundTo(canvas2realX(wid), step) + step;
|
|
|
|
|
start = roundTo(canvas2realX(right), step);
|
|
|
|
|
px = start + step;
|
|
|
|
|
if (step > 0.) {
|
|
|
|
|
cnt = 1000;
|
|
|
|
|
@@ -1107,7 +1107,7 @@ void Graphic::drawGrid() {
|
|
|
|
|
px -= step;
|
|
|
|
|
if (fabs(px) < step * .5) px = 0.;
|
|
|
|
|
cx = real2canvasX(px);
|
|
|
|
|
if (cx > cwid) continue;
|
|
|
|
|
if (cx > right) continue;
|
|
|
|
|
if (cx < gbx) break;
|
|
|
|
|
painter->setPen(grid_pen);
|
|
|
|
|
painter->drawLine(cx, hei + 5, cx, 0);
|
|
|
|
|
@@ -1126,7 +1126,7 @@ void Graphic::drawGrid() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cx = real2canvasX(0.);
|
|
|
|
|
if (cx <= cwid && cx >= gbx) {
|
|
|
|
|
if (cx <= right && cx >= gbx) {
|
|
|
|
|
QPen _p(grid_pen);
|
|
|
|
|
_p.setStyle(Qt::SolidLine);
|
|
|
|
|
painter->setPen(_p);
|
|
|
|
|
@@ -1135,7 +1135,7 @@ void Graphic::drawGrid() {
|
|
|
|
|
} else {
|
|
|
|
|
int cur_scl[7] = {0,0,0,0,0,0,0};
|
|
|
|
|
step = splitRangeDate(range, wid / gridx / font_sz.width() * 1.4, &df, cur_scl);
|
|
|
|
|
start = roundTo(canvas2realX(wid), step) + step;
|
|
|
|
|
start = roundTo(canvas2realX(right), step);
|
|
|
|
|
px = start + step;
|
|
|
|
|
QDateTime cd = QDateTime::fromMSecsSinceEpoch(px * grid_numbers_x);
|
|
|
|
|
roundDateTime(cd, cur_scl);
|
|
|
|
|
@@ -1145,7 +1145,7 @@ void Graphic::drawGrid() {
|
|
|
|
|
while (cnt-- > 0) {
|
|
|
|
|
addDateTime(cd, cur_scl, -1);
|
|
|
|
|
cx = real2canvasX(cd.toMSecsSinceEpoch() / grid_numbers_x);
|
|
|
|
|
if (cx > cwid) continue;
|
|
|
|
|
if (cx > right) continue;
|
|
|
|
|
if (cx < gbx) break;
|
|
|
|
|
painter->setPen(grid_pen);
|
|
|
|
|
painter->drawLine(cx, hei + 5, cx, 0);
|
|
|
|
|
|