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

canvas padding...

parent f415c29e
Loading
Loading
Loading
Loading
+23 −16
Original line number Diff line number Diff line
@@ -386,21 +386,23 @@ void Canvas::renderOutsideLegends(
  for (const auto& legend : legends_) {
    target->beginGroup("legend");

    renderLeftLegend(
    renderRightLegend(
        target,
        viewport,
        legend.get(),
        kLegendOutsideHorizPadding,
        false);
        false,
        true);
    viewport->setPaddingTop(viewport->paddingTop() + kLegendOutsideVertPadding);

    viewport->setPaddingBottom(viewport->paddingBottom() + kLegendOutsideVertPadding);
    renderRightLegend(
    renderLeftLegend(
        target,
        viewport,
        legend.get(),
        kLegendOutsideHorizPadding,
        true,
        true);
    viewport->setPaddingBottom(viewport->paddingBottom() + kLegendOutsideVertPadding);

    target->finishGroup();
  }
@@ -422,13 +424,7 @@ void Canvas::renderInsideLegends(
        viewport,
        legend.get(),
        kLegendInsideHorizPadding,
        true);

    renderRightLegend(
        target,
        viewport,
        legend.get(),
        kLegendInsideHorizPadding,
        true,
        false);

    target->finishGroup();
@@ -442,13 +438,14 @@ void Canvas::renderRightLegend(
    Viewport* viewport,
    LegendDefinition* legend,
    double horiz_padding,
    bool bottom) const {
    bool bottom,
    bool outside) const {
  std::string title = legend->title();

  double height;
  if (bottom) {
    height = viewport->paddingTop() + viewport->innerHeight()  -
      kLegendLineHeight;
      kLegendLineHeight * 0.2f;
  } else {
    height = viewport->paddingTop();
  }
@@ -497,6 +494,10 @@ void Canvas::renderRightLegend(
  }

  if (bottom) {
    if (outside) {
      height -= kLegendLineHeight;
    }

    viewport->setPaddingBottom(
        viewport->innerHeight() + viewport->paddingTop() +
        viewport->paddingBottom() - height);
@@ -511,12 +512,14 @@ void Canvas::renderLeftLegend(
    Viewport* viewport,
    LegendDefinition* legend,
    double horiz_padding,
    bool bottom) const {
    bool bottom,
    bool outside) const {
  std::string title = legend->title();

  double height;
  if (bottom) {
    height = viewport->paddingTop() + viewport->innerHeight() - 5.0f;
    height = viewport->paddingTop() + viewport->innerHeight()  -
      kLegendLineHeight * 0.2f;
  } else {
    height = viewport->paddingTop();
  }
@@ -566,6 +569,10 @@ void Canvas::renderLeftLegend(
  }

  if (bottom) {
    if (outside) {
      height -= kLegendLineHeight;
    }

    viewport->setPaddingBottom(
        viewport->innerHeight() + viewport->paddingTop() +
        viewport->paddingBottom() - height);
+7 −5
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ class RenderTarget;

class Canvas {
public:
  static const int kAxisPadding = 5; // FIXPAUL make configurable
  static const int kAxisPadding = 0; // FIXPAUL make configurable
  static const int kTickLength = 5; // FIXPAUL make configurable
  static const int kAxisLabelHeight = 35.0f; // FIXPAUL make configurable
  static const int kAxisLabelHeight = 20; // FIXPAUL make configurable
  static const int kAxisLabelWidth = 50.0f; // FIXPAUL make configurable
  static const int kAxisTitleLength = 20.0f; // FIXPAUL make configurable
  static const int kCharWidth = 6.0f; // FIXPAUL make configurable
@@ -33,7 +33,7 @@ public:
  static const int kLegendLineHeight = 20.0f; // FIXPAUL make configurable
  static const int kLegendInsideVertPadding = 10.0f;
  static const int kLegendInsideHorizPadding = 15.0f;
  static const int kLegendOutsideVertPadding = 5.0f;
  static const int kLegendOutsideVertPadding = 10.0f;
  static const int kLegendOutsideHorizPadding = 25.0f;
  static const int kLegendPointY = 6;
  static const int kLegendPointWidth = 8;
@@ -179,14 +179,16 @@ protected:
      Viewport* viewport,
      LegendDefinition* legend,
      double horiz_padding,
      bool bottom) const;
      bool bottom,
      bool outside) const;

  void renderLeftLegend(
      RenderTarget* target,
      Viewport* viewport,
      LegendDefinition* legend,
      double horiz_padding,
      bool bottom) const;
      bool bottom,
      bool outside) const;

  // FIXPAUL this belongs into the rendertarget
  int width_;
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ static const std::string kStyleSheetDefault = R"(
  }

  .axis .title {
    font-size: 12px;
    font-size: 10px;
  }

  .legend text {