author | Francesco Abbate <francesco.bbt@gmail.com> | 2013年02月05日 11:27:47 +0100 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2013年02月05日 11:27:47 +0100 |
commit | d8eb30e6de3d8cab29bd868c24d226ff3d26a088 (patch) | |
tree | 51a9c6b613c9c1d698f9e4f82caaaf4dedb5675e /agg-plot/plot.cpp | |
parent | dac5106531534f5dbc7e223a30acbdc7a8c686ca (diff) | |
download | gsl-shell-d8eb30e6de3d8cab29bd868c24d226ff3d26a088.tar.gz |
-rw-r--r-- | agg-plot/plot.cpp | 11 |
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<double>(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); |