
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
/* global Float32Array */
import createRenderPlanner from '../helper/createRenderPlanner.js';
import { calculateCandleWidth } from '../volPath/volPathLayout.js';
import { error } from '../../util/log.js';
import { map } from 'tvrender/lib/core/util.js';
var VolPathTableLayout = {
  seriesType: 'volPathTable',
  plan: createRenderPlanner(),
  reset: function (seriesModel, ecModel, api) {
    var coordSys = seriesModel.coordinateSystem;
    if (!coordSys) {
      if (process.env.NODE_ENV !== 'production') {
        error('The lines series must have a coordinate system.');
      }
      return;
    }
    var data = seriesModel.getData();
    var cDimIdx = 0;
    // const vDimIdx = 1;
    var coordDims = ['x', 'y'];
    var cDimsI = map(data.mapDimensionsAll(coordDims[cDimIdx]), data.getDimensionIndex, data);
    // const vDimsI = map(data.mapDimensionsAll(coordDims[vDimIdx]), data.getDimensionIndex, data);
    var x1DimI = cDimsI[0];
    var xAxis = coordSys.getAxis('x');
    var bandWidth = calculateCandleWidth(seriesModel, data).bandWidth;
    // if (cDimsI.length < 2 || vDimsI.length < 2) {
    //     return;
    // }
    var height = api.getHeight();
    var width = api.getWidth();
    // coordSys.getBoundingRect();
    // const { buyUnfinishedBg, buyFvgColor, sellFvgColor, sellUnfinishedBg } = seriesModel.get("itemStyle");
    var infoType = seriesModel.get("infoType");
    var isBuyAndSell = infoType === 'buyAndSell';
    var isLadder = infoType === 'ladder';
    var isBuyAndSellLadder = isBuyAndSell || isLadder;
    var offset = isBuyAndSellLadder ? 0 : bandWidth / 2;
    return {
      progress: function (params, volPathTableData) {
        var store = volPathTableData.getStore();
        // const linesPointById: Record<string, number[]> = {};
        // const linesPoints: { points: number[], key: string }[]  = [];
        // const textPointsByColor = new Map<string, DynamicTypedArray>();
        var points = [];
        for (var i = params.start; i < params.end; i++) {
          var x1Val = store.get(x1DimI, i);
          var x = xAxis.toGlobalCoord(xAxis.dataToCoord(x1Val));
          points.push(x + offset);
        }
        volPathTableData.setLayout({
          points: points,
          height: height,
          width: width,
          bandWidth: bandWidth
        });
      }
    };
  }
};
export default VolPathTableLayout;