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

linechart: invert y axis

parent 433b8dfc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ ReturnCode drawSeries(
    auto x = series.xs[i];
    auto y = series.ys[i];
    auto sx = clip.x + domain_translate(domain_x, x) * clip.w;
    auto sy = clip.y + domain_translate(domain_y, y) * clip.h;
    auto sy = clip.y + (1.0 - domain_translate(domain_y, y)) * clip.h;

    if (i == 0) {
      path.moveTo(sx, sy);
+2 −2
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ static Status renderAxisVertical(

  /* draw ticks */
  for (const auto& tick : axis_config.ticks) {
    auto y = y0 + (y1 - y0) * tick;
    auto y = y0 + (y1 - y0) * (1.0 - tick);
    StrokeStyle style;
    strokeLine(
        target,
@@ -109,7 +109,7 @@ static Status renderAxisVertical(
  auto label_padding = from_rem(*target, axis_config.label_padding_rem);
  for (const auto& label : axis_config.labels) {
    auto [ tick, label_text ] = label;
    auto sy = y0 + (y1 - y0) * tick;
    auto sy = y0 + (y1 - y0) * (1.0 - tick);
    auto sx = x + label_padding * label_placement;

    TextStyle style;
+18 −0
Original line number Diff line number Diff line
linechart {
  axis-top: manual;
  axis-right: manual;
  axis-bottom: manual;
  axis-left: manual;

  series {
    xs: 10   20   30   40   50   60    70   80  90  100;
    ys: 1.23 4.32 3.23 6.43 3.45 11.32 8.14 5.2 3.5 2.2;
    colour: #06c;
  }

  series {
    xs: 10   15   30   50   70   80    90   90 95  100;
    ys: 1.23 4.32 3.23 6.43 5.45 12.32 8.14 5.2 3.5 2.2;
    colour: #6c0;
  }
}
+73 KiB
Loading image diff...