MCPcopy
hub / github.com/apache/echarts / createProgressiveLayout

Function createProgressiveLayout

src/layout/barGrid.ts:380–508  ·  view source on GitHub ↗
(seriesType: string)

Source from the content-addressed store, hash-verified

378
379// TODO: Do not support stack in large mode yet.
380export function createProgressiveLayout(seriesType: string): StageHandler {
381 return {
382 seriesType,
383
384 plan: createRenderPlanner(),
385
386 reset: function (seriesModel: BaseBarSeriesModel) {
387 if (!isCartesian2DInjectedAsDataCoordSys(seriesModel)) {
388 return;
389 }
390
391 const data = seriesModel.getData();
392
393 const cartesian = seriesModel.coordinateSystem as Cartesian2D;
394 const baseAxis = cartesian.getBaseAxis();
395 const valueAxis = cartesian.getOtherAxis(baseAxis);
396 const valueDimIdx = data.getDimensionIndex(data.mapDimension(valueAxis.dim));
397 const baseDimIdx = data.getDimensionIndex(data.mapDimension(baseAxis.dim));
398 const drawBackground = (seriesModel as BarSeriesModel).get('showBackground', true);
399 const valueDim = data.mapDimension(valueAxis.dim);
400 const stackResultDim = data.getCalculationInfo('stackResultDimension');
401 const stacked = isDimensionStacked(data, valueDim) && !!data.getCalculationInfo('stackedOnSeries');
402 const isValueAxisH = valueAxis.isHorizontal();
403
404 const valueAxisStart = valueAxis.toGlobalCoord(valueAxis.dataToCoord(getStartValue(valueAxis)));
405
406 const isLarge = isInLargeMode(seriesModel);
407 const barMinHeight = seriesModel.get('barMinHeight') || 0;
408
409 const stackedDimIdx = stackResultDim && data.getDimensionIndex(stackResultDim);
410
411 // Layout info.
412 const columnWidth = data.getLayout('size');
413 const columnOffset = data.getLayout('offset');
414
415 return {
416 progress: function (params, data) {
417 const count = params.count;
418 const largePoints = isLarge && createFloat32Array(count * 3);
419 const largeBackgroundPoints = isLarge && drawBackground && createFloat32Array(count * 3);
420 const largeDataIndices = isLarge && createFloat32Array(count);
421 const coordLayout = cartesian.master.getRect();
422 const bgSize = isValueAxisH ? coordLayout.width : coordLayout.height;
423
424 let dataIndex;
425 const store = data.getStore();
426
427 let idxOffset = 0;
428
429 while ((dataIndex = params.next()) != null) {
430 const value = store.get(stacked ? stackedDimIdx : valueDimIdx, dataIndex);
431 const baseValue = store.get(baseDimIdx, dataIndex) as number;
432 let baseCoord = valueAxisStart;
433 let stackStartValue;
434
435 // Because of the barMinHeight, we can not use the value in
436 // stackResultDimension directly.
437 if (stacked) {

Callers 2

installFunction · 0.90
installFunction · 0.90

Calls 15

isDimensionStackedFunction · 0.90
getStartValueFunction · 0.90
createFloat32ArrayFunction · 0.90
createRenderPlannerFunction · 0.85
isInLargeModeFunction · 0.85
getDimensionIndexMethod · 0.80
mapDimensionMethod · 0.80
getCalculationInfoMethod · 0.80
dataToCoordMethod · 0.80
getStoreMethod · 0.80
nextMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…