/**
   * add a new stick data to sticks
   *
   * <p>新しいスティックデータを追加する
   *
   * <p>追加一条新数据
   *
   * @param entity
   *     <p>data
   *     <p>データ
   *     <p>新数据
   */
  public void addData(StickEntity entity) {
    if (null != entity) {
      // data is null or empty
      if (null == StickData || 0 == StickData.size()) {
        StickData = new ArrayList<StickEntity>();
        this.maxValue = ((int) entity.getHigh()) / 100 * 100;
      }

      // add
      this.StickData.add(entity);

      if (this.maxValue < entity.getHigh()) {
        this.maxValue = 100 + ((int) entity.getHigh()) / 100 * 100;
      }

      if (StickData.size() > maxSticksNum) {
        maxSticksNum = maxSticksNum + 1;
      }
    }
  }
  /**
   * draw sticks
   *
   * <p>スティックを書く
   *
   * <p>绘制柱条
   *
   * @param canvas
   */
  protected void drawSticks(Canvas canvas) {
    float stickWidth =
        ((super.getWidth() - super.getAxisMarginLeft() - super.getAxisMarginRight()) / maxSticksNum)
            - 1;
    float stickX = super.getAxisMarginLeft() + 1;

    Paint mPaintStick = new Paint();
    mPaintStick.setColor(stickFillColor);

    if (null != StickData) {

      for (int i = 0; i < StickData.size(); i++) {
        StickEntity ohlc = StickData.get(i);

        float highY =
            (float)
                ((1f - (ohlc.getHigh() - minValue) / (maxValue - minValue))
                        * (super.getHeight() - super.getAxisMarginBottom())
                    - super.getAxisMarginTop());
        float lowY =
            (float)
                ((1f - (ohlc.getLow() - minValue) / (maxValue - minValue))
                        * (super.getHeight() - super.getAxisMarginBottom())
                    - super.getAxisMarginTop());

        // stick or line?
        if (stickWidth >= 2f) {
          canvas.drawRect(stickX, highY, stickX + stickWidth, lowY, mPaintStick);
        } else {
          canvas.drawLine(stickX, highY, stickX, lowY, mPaintStick);
        }

        // next x
        stickX = xAxisOffset + stickX + 1 + stickWidth;
      }
    }
  }