Commit 8edae777 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

handle the case where all a domain's max value is equal to the min value (i.e....

handle the case where all a domain's max value is equal to the min value (i.e. all values are the same)
parent b6ea0452
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -281,6 +281,9 @@ template <typename TX, typename TY, typename TZ>
void AreaChart3D<TX, TY, TZ>::render(
    RenderTarget* target,
    Viewport* viewport) const {
  x_domain_.get()->build();
  y_domain_.get()->build();

  target->beginGroup("areas");

  for (const auto& area : areas_) {
+3 −0
Original line number Diff line number Diff line
@@ -339,6 +339,9 @@ template <typename TX, typename TY, typename TZ>
void BarChart3D<TX, TY, TZ>::render(
    RenderTarget* target,
    Viewport* viewport) const {
  x_domain_.get()->build();
  y_domain_.get()->build();

  if (data_.size() == 0) {
    RAISE(kRuntimeError, "BarChart3D#render called without any data");
  }
+16 −9
Original line number Diff line number Diff line
@@ -177,6 +177,13 @@ public:
    padding_.second = max_padding;
  }

  void build() {
    if (min_value_ == max_value_) {
      max_value_ += 1.0f;
      min_value_ -= 1.0f;
    }
  }

protected:

  std::pair<double, double> getRangeWithPadding() const {
+2 −0
Original line number Diff line number Diff line
@@ -116,6 +116,8 @@ public:
    is_inverted_ = inverted;
  }

  void build() {}

protected:
  bool is_inverted_;
  std::vector<T> categories_;
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ public:

  virtual void setInverted(bool inverted) = 0;

  virtual void build() = 0;

};

/**
Loading