| 446 | } |
| 447 | |
| 448 | void xg::axis::AxisController::InitAxisConfig(xg::XChart &chart) { |
| 449 | auto ts = xg::CurrentTimestampAtMM(); |
| 450 | std::for_each(axes.begin(), axes.end(), [&](std::unique_ptr<xg::axis::Axis> &axis) { |
| 451 | const std::vector<xg::scale::Tick> &ticks = axis->ticks; |
| 452 | |
| 453 | // grid Points |
| 454 | if(axis->gridCfg.is_object() && !axis->verticalField.empty()) { |
| 455 | std::vector<xg::scale::Tick> verticalTicks = FormatTicks(chart.GetScale(axis->verticalField).GetTicks(&chart)); |
| 456 | |
| 457 | for(std::size_t index = 0; index < ticks.size(); ++index) { |
| 458 | auto &tick = ticks[index]; |
| 459 | std::vector<util::Point> linePoints; |
| 460 | |
| 461 | for(std::size_t position = 0; position < verticalTicks.size(); ++position) { |
| 462 | auto &verticalTick = verticalTicks[position]; |
| 463 | double x = axis->dimType == "x" ? tick.value : verticalTick.value; |
| 464 | double y = axis->dimType == "x" ? verticalTick.value : tick.value; |
| 465 | if(x >= 0 && x <= 1 && y >= 0 && y <= 1) { |
| 466 | util::Point rt = chart.GetCoord().ConvertPoint(util::Point(x, y)); |
| 467 | linePoints.push_back(std::move(rt)); |
| 468 | } |
| 469 | } |
| 470 | axis->gridPoints.push_back(std::move(linePoints)); |
| 471 | } |
| 472 | } |
| 473 | }); |
| 474 | |
| 475 | chart.GetLogTracer()->trace("#InitAxisesConfig %lums", (xg::CurrentTimestampAtMM() - ts)); |
| 476 | } |
| 477 | |
| 478 | void xg::axis::AxisController::UpdateLayout(xg::XChart &chart) { |
| 479 | std::array<double, 4> &userPadding = chart.padding_; |
nothing calls this directly
no test coverage detected