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

Method MakeLinearScaleByType

tests/unit/scale/ScaleController.h:51–61  ·  view source on GitHub ↗

通过指定的type来创建scale

Source from the content-addressed store, hash-verified

49
50 //通过指定的type来创建scale
51 static bool MakeLinearScaleByType() {
52 //y轴数据为null的情况 创建的scale是identity
53 nlohmann::json data = {{{"field", nullptr}}};
54 scale::ScaleController ctrl(nullptr);
55 //指定创建的类型
56 ctrl.UpdateColConfig("field", {{"type", "linear"}});
57 auto coord = ScaleController::MakeCoord();
58 auto &scale = ctrl.CreateScale("field", data, ScaleController::MakeTracer(), coord);
59 bool isLinear = (*scale).GetType() == scale::ScaleType::Linear;
60 return isLinear;
61 }
62
63 //通过数据来创建category
64 static bool MakeCategoryScale() {

Callers

nothing calls this directly

Calls 2

UpdateColConfigMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected