From d8eb30e6de3d8cab29bd868c24d226ff3d26a088 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Tue, 5 Feb 2013 11:27:47 +0100 Subject: Improves plot limits calculation when multi labels are used --- agg-plot/plot.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'agg-plot/plot.cpp') diff --git a/agg-plot/plot.cpp b/agg-plot/plot.cpp index 0882d458..04ab38d4 100644 --- a/agg-plot/plot.cpp +++ b/agg-plot/plot.cpp @@ -145,6 +145,17 @@ void plot::compute_user_trans() r = m_rect.is_defined() ? m_rect.rect() : agg::rect_base(0.0, 0.0, 1.0, 1.0); } + if (m_xaxis_hol) + { + for (unsigned k = 0; k < m_xaxis_hol->size(); k++) + { + factor_labels* f = m_xaxis_hol->at(k); + double x1 = f->mark(0), x2 = f->mark(f->labels_number()); + if (k == 0 || x1 < r.x1) r.x1 = x1; + if (k == 0 || x2> r.x2) r.x2 = x2; + } + } + double dx = r.x2 - r.x1, dy = r.y2 - r.y1; double fx = (dx == 0 ? 1.0 : 1/dx), fy = (dy == 0 ? 1.0 : 1/dy); this->m_trans = agg::trans_affine(fx, 0.0, 0.0, fy, -r.x1 * fx, -r.y1 * fy); -- cgit v1.2.3

AltStyle によって変換されたページ (->オリジナル) /