通过指定的type来创建scale
| 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() { |
nothing calls this directly
no test coverage detected