Commit e309e8af authored by Paul Asmuth's avatar Paul Asmuth
Browse files

wire up bar chart tooltips

parent 3b7906e0
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -400,7 +400,15 @@ void BarChart3D<TX, TY, TZ>::renderHorizontalBars(
        dh *= (1.0 - kBarPaddingInner);
      }

      target->drawRect(dx, dy, dw, dh, seriesColor(n), "bar");
      target->drawRect(
          dx,
          dy,
          dw,
          dh,
          seriesColor(n),
          "bar",
          bar.label, // FIXPAUL per series label
          series_[n]->name());

      if (dx + dw > label_x) {
        label_x = dx + dw;
@@ -452,7 +460,15 @@ void BarChart3D<TX, TY, TZ>::renderVerticalBars(
        dw *= (1.0 - kBarPaddingInner);
      }

      target->drawRect(dx, dy, dw, dh, seriesColor(n), "bar");
      target->drawRect(
          dx,
          dy,
          dw,
          dh,
          seriesColor(n),
          "bar",
          bar.label, // FIXPAUL per series label
          series_[n]->name());

      if (dy < label_y) {
        label_y = dy;
+3 −1
Original line number Diff line number Diff line
@@ -63,7 +63,9 @@ public:
      double width,
      double height,
      const std::string& color,
      const std::string& class_name = "") = 0;
      const std::string& class_name = "",
      const std::string& label = "",
      const std::string& series = "") = 0;

  virtual void drawPath(
      const std::vector<std::pair<double, double>>& points,
+9 −3
Original line number Diff line number Diff line
@@ -66,18 +66,24 @@ public:
      double width,
      double height,
      const std::string& color,
      const std::string& class_name) override {
      const std::string& class_name,
      const std::string& label,
      const std::string& series) override {
    std::string class_str(class_name);
    class_str += " ";
    class_str += color;

    // FIXPAUL escape me
    appendLine(
        "<rect x='%f' y='%f' width='%f' height='%f' class='%s'></rect>\n",
        "<rect x='%f' y='%f' width='%f' height='%f' class='%s' "
            "fm:series='%s' fm:label='%s'></rect>\n",
        x,
        y,
        width,
        height,
        class_str.c_str());
        class_str.c_str(),
        series.c_str(),
        label.c_str());
  }

  void drawLine(