Commit 75d1ac33 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

fix tests, cleanups

parent f5b42408
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -47,16 +47,6 @@ LegendConfig::LegendConfig() :
    position_horiz(HAlign::LEFT),
    position_vert(VAlign::TOP) {}

void LegendConfig::addEntry(
    const std::string& name,
    const Color& color,
    const std::string& shape /* = "circle" */) {
  LegendItem item;
  item.title = name;
  item.color = color;
  entries.emplace_back(std::move(item));
}

ReturnCode legend_layout(
    const LegendConfig& legend,
    Point origin,
+0 −7
Original line number Diff line number Diff line
@@ -51,14 +51,7 @@ struct LegendItem {
};

struct LegendConfig {

  LegendConfig();

  void addEntry(
      const std::string& name,
      const Color& color,
      const std::string& shape = "circle");

  Color text_color;
  Color border_color;
  FontInfo font;
+1 −0
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@ ReturnCode configure(
    {"y-scale", std::bind(&configure_string, std::placeholders::_1, &layer.y_scale)},
    {"group", std::bind(&configure_string, std::placeholders::_1, &layer.group_key)},
    {"line-color", configure_slot(&layer.line_color)},
    {"line-width", std::bind(&configure_measure_rel, std::placeholders::_1, doc.dpi, doc.font_size, &layer.line_width)},
  };

  if (auto rc = parseAll(*prop.next, pdefs); !rc) {
+3 −4
Original line number Diff line number Diff line
@@ -98,12 +98,10 @@ ReturnCode draw_points(
      return rc;
    }

    auto point_size = 5; // FIXME

    // FIXME point style
    Path path;
    path.moveTo(sx + point_size, sy);
    path.arcTo(sx, sy, point_size, 0, M_PI * 2);
    path.moveTo(sx + config.point_size, sy);
    path.arcTo(sx, sy, config.point_size, 0, M_PI * 2);
    fillPath(layer, clip, path, style);
  }

@@ -125,6 +123,7 @@ ReturnCode configure(const plist::Property& prop, const Document& doc, PlotConfi
    {"y", configure_key(&layer.y_key)},
    {"y-scale", std::bind(&configure_string, std::placeholders::_1, &layer.y_scale)},
    {"point-color", configure_slot(&layer.point_color)},
    {"point-size", std::bind(&configure_measure_rel, std::placeholders::_1, doc.dpi, doc.font_size, &layer.point_size)},
  };

  if (auto rc = parseAll(*prop.next, pdefs); !rc) {
+0 −49
Original line number Diff line number Diff line
city,month,temperature
Tokyo,Dec,9.6
Tokyo,Nov,13.9
Tokyo,Oct,18.3
Tokyo,Sep,23.3
Tokyo,Aug,26.5
Tokyo,Jul,25.2
Tokyo,Jun,21.5
Tokyo,May,18.2
Tokyo,Apr,14.5
Tokyo,Mar,9.5
Tokyo,Feb,6.9
Tokyo,Jan,7.0
New York,Dec,2.5
New York,Nov,8.6
New York,Oct,14.1
New York,Sep,20.1
New York,Aug,24.1
New York,Jul,24.8
New York,Jun,22.0
New York,May,17.0
New York,Apr,11.3
New York,Mar,5.7
New York,Feb,0.8
New York,Jan,-0.2
Berlin,Jan,-0.9
Berlin,Feb,0.6
Berlin,Mar,3.5
Berlin,Apr,8.4
Berlin,May,13.5
Berlin,Jun,17.0
Berlin,Jul,18.6
Berlin,Aug,17.9
Berlin,Sep,14.3
Berlin,Oct,9.0
Berlin,Nov,3.9
Berlin,Dec,1.0
London,Jan,3.9
London,Feb,4.2
London,Mar,5.7
London,Apr,8.5
London,May,11.9
London,Jun,15.2
London,Jul,17.0
London,Aug,16.6
London,Sep,14.2
London,Oct,10.3
London,Nov,6.6
London,Dec,4.8
Loading