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

Function FormatTicks

core/graphics/axis/AxisController.cpp:14–36  ·  view source on GitHub ↗

网格线绘制始终是从 0 - 1, 数据不足时主动补齐

Source from the content-addressed store, hash-verified

12
13// 网格线绘制始终是从 0 - 1, 数据不足时主动补齐
14static std::vector<xg::scale::Tick> FormatTicks(std::vector<xg::scale::Tick> ticks) {
15 std::vector<xg::scale::Tick> rst(ticks);
16 if(rst.size() > 0) {
17 const xg::scale::Tick &first = rst[0];
18 if(!xg::IsZero(first.value)) {
19 xg::scale::Tick t;
20 t.text = "";
21 t.tickValue = "";
22 t.value = 0.0;
23 rst.insert(rst.begin(), std::move(t));
24 }
25
26 const xg::scale::Tick &last = rst[rst.size() - 1UL];
27 if(!xg::IsEqual(last.value, 1.0)) {
28 xg::scale::Tick t;
29 t.text = "";
30 t.tickValue = "";
31 t.value = 1.0;
32 rst.push_back(std::move(t));
33 }
34 }
35 return rst;
36}
37
38static std::vector<std::string> GetFillColor(const nlohmann::json &config) {
39 std::vector<string> fill;

Callers 1

InitAxisConfigMethod · 0.85

Calls 6

IsZeroFunction · 0.85
IsEqualFunction · 0.85
insertMethod · 0.80
beginMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected