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

Method GetScaleTicks

core/graphics/XChart.cpp:470–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470std::string XChart::GetScaleTicks(const std::string &field) noexcept {
471 nlohmann::json rst = {};
472 if (!canvasContext_ || !canvasContext_->IsValid()) {
473 return rst.dump();
474 }
475
476 scale::AbstractScale &scale = this->GetScale(field);
477 std::vector<scale::Tick> ticks = scale.GetTicks(this);
478
479 for(std::size_t i = 0; i < ticks.size(); ++i) {
480 scale::Tick &tick = ticks[i];
481 nlohmann::json item = {{"text", tick.text}, {"tickValue", tick.tickValue}, {"value", tick.value}};
482 rst.push_back(item);
483 }
484 return rst.dump();
485}
486
487bool XChart::Render() {
488 this->logTracer_->trace("#Render %s", "start render");

Callers 2

InvokeMethodMethod · 0.80
GetChartScaleTicksFunction · 0.80

Calls 5

dumpMethod · 0.80
GetTicksMethod · 0.80
push_backMethod · 0.80
IsValidMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected