| 642 | } |
| 643 | |
| 644 | void xg::axis::AxisController::DrawLine(XChart &chart, std::array<util::Point, 2> &&line, const nlohmann::json &lineCfg) { |
| 645 | float lineWidth = lineCfg["lineWidth"].get<float>() * chart.GetCanvasContext().GetDevicePixelRatio(); |
| 646 | if(lineCfg["type"] == "line") { |
| 647 | std::unique_ptr<xg::shape::Element> _line = xg::make_unique<xg::shape::Line>(line[0], line[1], lineWidth, lineCfg["color"]); |
| 648 | this->container_->AddElement(std::move(_line)); |
| 649 | } else if(lineCfg["type"] == "dash") { |
| 650 | std::vector<util::Point> _points = {line[0], line[1]}; |
| 651 | auto l = xg::make_unique<xg::shape::Polyline>(lineWidth, _points, false); |
| 652 | l->SetStorkColor(lineCfg["color"]); |
| 653 | l->SetZIndex(-1); |
| 654 | std::vector<float> dash = xg::json::ParseDashArray(lineCfg["dash"], chart.GetCanvasContext().GetDevicePixelRatio()); |
| 655 | l->SetDashLine(dash); |
| 656 | this->container_->AddElement(std::move(l)); |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | void xg::axis::AxisController::DrawLabel(XChart &chart, std::unique_ptr<xg::axis::Axis> &axis, canvas::CanvasContext &context) { |
| 661 | // xg::util::Point start = GetOffsetPoint(axis, label.value); |
nothing calls this directly
no test coverage detected