| 565 | } |
| 566 | |
| 567 | ReturnCode plot_axis( |
| 568 | Context* ctx, |
| 569 | PlotConfig* plot, |
| 570 | AxisDefinition* config) { |
| 571 | const auto& axis = *config; |
| 572 | const auto& bbox = plot_get_clip(plot, layer_get(ctx)); |
| 573 | |
| 574 | ReturnCode rc; |
| 575 | switch (axis.align) { |
| 576 | case AxisAlign::X: |
| 577 | rc = plot_axis_horizontal( |
| 578 | ctx, |
| 579 | plot, |
| 580 | axis, |
| 581 | bbox.y + bbox.h * 0.5, |
| 582 | bbox.x, |
| 583 | bbox.x + bbox.w); |
| 584 | break; |
| 585 | case AxisAlign::TOP: |
| 586 | rc = plot_axis_horizontal( |
| 587 | ctx, |
| 588 | plot, |
| 589 | axis, |
| 590 | bbox.y + bbox.h, |
| 591 | bbox.x, |
| 592 | bbox.x + bbox.w); |
| 593 | break; |
| 594 | case AxisAlign::BOTTOM: |
| 595 | rc = plot_axis_horizontal( |
| 596 | ctx, |
| 597 | plot, |
| 598 | axis, |
| 599 | bbox.y, |
| 600 | bbox.x, |
| 601 | bbox.x + bbox.w); |
| 602 | break; |
| 603 | case AxisAlign::Y: |
| 604 | rc = plot_axis_vertical( |
| 605 | ctx, |
| 606 | plot, |
| 607 | axis, |
| 608 | bbox.x + bbox.w * 0.5, |
| 609 | bbox.y, |
| 610 | bbox.y + bbox.h); |
| 611 | break; |
| 612 | case AxisAlign::LEFT: |
| 613 | rc = plot_axis_vertical( |
| 614 | ctx, |
| 615 | plot, |
| 616 | axis, |
| 617 | bbox.x, |
| 618 | bbox.y, |
| 619 | bbox.y + bbox.h); |
| 620 | break; |
| 621 | case AxisAlign::RIGHT: |
| 622 | rc = plot_axis_vertical( |
| 623 | ctx, |
| 624 | plot, |
no test coverage detected