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

Method UpdateFollowScale

core/graphics/interaction/InteractionContext.cpp:140–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void interaction::InteractionContext::UpdateFollowScale(scale::AbstractScale &pinchScale,
141 nlohmann::json &pinchValues,
142 std::size_t valueStart,
143 std::size_t valueEnd) {
144
145// const std::string &pinchField = pinchScale.field;
146
147 std::string followField = this->chart_->getYScaleFields()[0];
148
149 // nlohmann::json pinchValuesMap;
150 // for(std::size_t index = 0; index < pinchValues.size(); ++index) {
151 // nlohmann::json item = pinchValues[index];
152 // pinchValuesMap[item.dump()] = true;
153 // }
154
155 // 根据主轴的 value 值找到从轴的 value 值
156 // nlohmann::json values;
157 // const std::size_t dataSize = chart_->GetData().size();
158 // for(std::size_t index = 0; index < dataSize; ++index) {
159 // nlohmann::json item = chart_->GetData()[index];
160
161 // nlohmann::json &value = item[pinchField];
162 // if(pinchValuesMap.contains(value.dump())) {
163 // nlohmann::json followValue = item[followField];
164 // values.push_back(followValue);
165 // }
166 // }
167
168 double rangeMin = DBL_MAX, rangeMax = DBL_MIN;
169 std::for_each(this->chart_->geoms_.begin(), this->chart_->geoms_.end(), [&](auto &geom) -> void {
170 util::JsonRangeInGeomDataArray(geom->GetDataArray(), followField, valueStart, valueEnd, &rangeMin, &rangeMax);
171 });
172 UpdateScale(followField, {{"min", rangeMin}, {"max", rangeMax}, {"nice", true}});
173}
174
175void interaction::InteractionContext::UpdateScale(const std::string &field, nlohmann::json cfg) {
176 auto &scale = this->chart_->GetScale(field);

Callers

nothing calls this directly

Calls 4

JsonRangeInGeomDataArrayFunction · 0.85
getYScaleFieldsMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected