网格线绘制始终是从 0 - 1, 数据不足时主动补齐
| 12 | |
| 13 | // 网格线绘制始终是从 0 - 1, 数据不足时主动补齐 |
| 14 | static 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 | |
| 38 | static std::vector<std::string> GetFillColor(const nlohmann::json &config) { |
| 39 | std::vector<string> fill; |