MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / assembleShapes

Method assembleShapes

src/common/overlay/Bar3D.js:160–335  ·  view source on GitHub ↗

* @function FeatureThemeBar3D.prototype.assembleShapes * @description 图形装配实现(扩展接口)。

()

Source from the content-addressed store, hash-verified

158 * @description 图形装配实现(扩展接口)。
159 */
160 assembleShapes() {
161 // 图表配置对象
162 var sets = this.setting;
163
164 // 默认数据视图框
165 if (!sets.dataViewBoxParameter) {
166 if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
167 sets.dataViewBoxParameter = [45, 25, 20, 20];
168 } else {
169 sets.dataViewBoxParameter = [5, 5, 5, 5];
170 }
171 }
172
173 // 3d 柱图的坐标轴默认使用坐标轴箭头
174 sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
175 sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
176
177 // 重要步骤:初始化参数
178 if (!this.initBaseParameter()) {
179 return;
180 }
181
182 // 值域
183 var codomain = this.DVBCodomain;
184 // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
185 this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
186 // 数据视图域
187 var dvb = this.dataViewBox;
188 // 用户数据值
189 var fv = this.dataValues;
190 if (fv.length < 1) {
191 return;
192 } // 没有数据
193
194 // 数据溢出值域范围处理
195 for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
196 if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
197 return;
198 }
199 }
200
201 // 获取 x 轴上的图形信息
202 var xShapeInfo = this.calculateXShapeInfo();
203 if (!xShapeInfo) {
204 return;
205 }
206 // 每个柱条 x 位置
207 var xsLoc = xShapeInfo.xPositions;
208 // 柱条宽度
209 var xsWdith = xShapeInfo.width;
210
211 // 坐标轴, 默认启用
212 if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
213 this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
214 }
215
216 // 坐标轴
217 if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {

Callers

nothing calls this directly

Calls 8

calculateXShapeInfoMethod · 0.95
pushMethod · 0.80
BackgroundMethod · 0.80
GraphAxisMethod · 0.80
ShapeStyleToolMethod · 0.80
createShapeMethod · 0.80
initBaseParameterMethod · 0.45

Tested by

no test coverage detected