
/*
* 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.
*/
import { __extends } from "tslib";
/**
 * Line path for bezier and straight line draw
 */
import * as graphic from '../../util/graphic.js';
// const straightLineProto = graphic.Line.prototype;
// const bezierCurveProto = graphic.BezierCurve.prototype;
var HistogramPlotShape = /** @class */function () {
  function HistogramPlotShape() {
    this.points = [];
    this.baseY = 0;
  }
  return HistogramPlotShape;
}();
function isPointNull(point) {
  if (point instanceof Array) {
    return isNaN(point[0]) || isNaN(point[1]);
  }
  return false;
}
var HistogramPlotPath = /** @class */function (_super) {
  __extends(HistogramPlotPath, _super);
  function HistogramPlotPath(opts) {
    var _this = _super.call(this, opts) || this;
    _this.type = 'HistogramPlot';
    return _this;
  }
  HistogramPlotPath.prototype.getDefaultStyle = function () {
    return {
      stroke: 'transparent',
      fill: '#000'
    };
  };
  HistogramPlotPath.prototype.getDefaultShape = function () {
    return new HistogramPlotShape();
  };
  HistogramPlotPath.prototype.buildPath = function (ctx, shape) {
    var points = shape.points,
      baseY = shape.baseY,
      stroke = shape.stroke,
      isWebviewRender = shape.isWebviewRender;
    for (var index = 0; index < points.length; index++) {
      var point = points[index];
      if (point === 0 || isPointNull(point)) {
        continue;
      }
      var _a = point,
        x = _a[0],
        y = _a[1];
      ctx.moveTo(x, y);
      ctx.lineTo(x, baseY);
      if (isWebviewRender && stroke && index % 5 === 0) {
        ctx.strokeStyle(stroke);
        ctx.beginPathFill();
      }
    }
  };
  return HistogramPlotPath;
}(graphic.Path);
export default HistogramPlotPath;