MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / rectCoordAxisBuildSplitArea

Function rectCoordAxisBuildSplitArea

libs/echarts/echarts.simple.js:41368–41454  ·  view source on GitHub ↗
(axisView, axisGroup, axisModel, gridModel)

Source from the content-addressed store, hash-verified

41366*/
41367
41368function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
41369 var axis = axisModel.axis;
41370
41371 if (axis.scale.isBlank()) {
41372 return;
41373 }
41374
41375 var splitAreaModel = axisModel.getModel('splitArea');
41376 var areaStyleModel = splitAreaModel.getModel('areaStyle');
41377 var areaColors = areaStyleModel.get('color');
41378
41379 var gridRect = gridModel.coordinateSystem.getRect();
41380
41381 var ticksCoords = axis.getTicksCoords({
41382 tickModel: splitAreaModel,
41383 clamp: true
41384 });
41385
41386 if (!ticksCoords.length) {
41387 return;
41388 }
41389
41390 // For Making appropriate splitArea animation, the color and anid
41391 // should be corresponding to previous one if possible.
41392 var areaColorsLen = areaColors.length;
41393 var lastSplitAreaColors = axisView.__splitAreaColors;
41394 var newSplitAreaColors = createHashMap();
41395 var colorIndex = 0;
41396 if (lastSplitAreaColors) {
41397 for (var i = 0; i < ticksCoords.length; i++) {
41398 var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
41399 if (cIndex != null) {
41400 colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
41401 break;
41402 }
41403 }
41404 }
41405
41406 var prev = axis.toGlobalCoord(ticksCoords[0].coord);
41407
41408 var areaStyle = areaStyleModel.getAreaStyle();
41409 areaColors = isArray(areaColors) ? areaColors : [areaColors];
41410
41411 for (var i = 1; i < ticksCoords.length; i++) {
41412 var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
41413
41414 var x;
41415 var y;
41416 var width;
41417 var height;
41418 if (axis.isHorizontal()) {
41419 x = prev;
41420 y = gridRect.y;
41421 width = tickCoord - x;
41422 height = gridRect.height;
41423 prev = x + width;
41424 }
41425 else {

Callers 1

echarts.simple.jsFile · 0.70

Calls 8

createHashMapFunction · 0.70
isArrayFunction · 0.70
defaultsFunction · 0.70
getModelMethod · 0.45
getMethod · 0.45
getRectMethod · 0.45
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected