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

Method GetTickText

core/graphics/scale/Scale.cpp:14–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12using namespace xg::scale;
13
14std::string AbstractScale::GetTickText(const nlohmann::json &item, XChart *chart, std::size_t index) {
15 if(!this->tickCallbackId.empty() && chart) {
16 nlohmann::json content{{"content", item}};
17 auto rst = xg::json::ParseString((chart->InvokeFunction(this->tickCallbackId, content.dump())));
18 if(rst.is_object() && rst.contains("content")) {
19 return rst["content"];
20 }
21 }
22
23 if(item.is_string()) {
24 return item.get<std::string>();
25 } else if(item.is_number()) {
26 return std::to_string(item.get<int>());
27 } else {
28 return ""; // TODO get Tick text from callback
29 }
30}

Callers 8

GetTicksMethod · 0.95
ShowToolTipsMethod · 0.45
ShowToolTipMethod · 0.45
InvertYTipMethod · 0.45
ScaleMethod · 0.45
InvalidTimeRangeMethod · 0.45
InvalidTimeRange2Method · 0.45
InvalidTimeRange3Method · 0.45

Calls 4

ParseStringFunction · 0.85
InvokeFunctionMethod · 0.80
dumpMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected