Project

General

Profile

Bug #33 ยป logaxis_minAbove0.patch

Pieter Libin, 07/17/2009 01:24 PM

View differences:

src/Wt/Chart/WAxis.C
class ExtremesIterator : public SeriesIterator
{
public:
ExtremesIterator(Axis axis)
: axis_(axis),
ExtremesIterator(Axis axis, AxisScale scale)
: axis_(axis),scale_(scale),
minimum_(WAxis::AUTO_MINIMUM),
maximum_(WAxis::AUTO_MAXIMUM)
{ }
......
virtual void newValue(const WDataSeries& series, double x, double y,
double stackY)
{
if (!Utils::isNaN(y)) {
if (!Utils::isNaN(y) && (scale_!=LogScale || y>0.0)) {
maximum_ = std::max(y, maximum_);
minimum_ = std::min(y, minimum_);
}
......
private:
Axis axis_;
AxisScale scale_;
double minimum_, maximum_;
};
......
}
}
} else {
ExtremesIterator iterator(axis_);
ExtremesIterator iterator(axis_, scale_);
renderer.iterateSeries(&iterator);
minimum = iterator.minimum();
......
if (findMinimum)
segment.renderMinimum
= std::pow(10,
(std::floor(std::log10(segment.renderMinimum - 1E-4))));
(std::floor(std::log10(segment.renderMinimum) - 4)));
if (findMaximum)
segment.renderMaximum
= std::pow(10,
(std::ceil(std::log10(segment.renderMaximum + 1E-4))));
(std::ceil(std::log10(segment.renderMaximum) + 4)));
} else {
if (findMinimum)
segment.renderMinimum = std::floor(segment.renderMinimum - 1E-4);
    (1-1/1)