MCPcopy Create free account
hub / github.com/antvis/F2Native / InitAxisConfig

Method InitAxisConfig

core/graphics/axis/AxisController.cpp:448–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448void 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
478void xg::axis::AxisController::UpdateLayout(xg::XChart &chart) {
479 std::array<double, 4> &userPadding = chart.padding_;

Callers

nothing calls this directly

Calls 12

CurrentTimestampAtMMFunction · 0.85
FormatTicksFunction · 0.85
beginMethod · 0.80
endMethod · 0.80
GetTicksMethod · 0.80
push_backMethod · 0.80
traceMethod · 0.80
GetLogTracerMethod · 0.80
PointClass · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
ConvertPointMethod · 0.45

Tested by

no test coverage detected