com.github.mikephil.charting.highlight.Highlight.setDraw()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中com.github.mikephil.charting.highlight.Highlight.setDraw()方法的一些代码示例,展示了Highlight.setDraw()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Highlight.setDraw()方法的具体详情如下:
包路径:com.github.mikephil.charting.highlight.Highlight
类名称:Highlight
方法名:setDraw

Highlight.setDraw介绍

[英]Sets the x- and y-position (pixels) where this highlight was last drawn.
[中]设置上次绘制此高光的x和y位置(像素)。

代码示例

代码示例来源:origin: PhilJay/MPAndroidChart

/**
 * Sets the drawing position of the highlight object based on the riven bar-rect.
 * @param high
 */
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerX(), bar.top);
}

代码示例来源:origin: PhilJay/MPAndroidChart

@Override
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerY(), bar.right);
}

代码示例来源:origin: PhilJay/MPAndroidChart

trans.pointValuesToPixel(pointBuffer);
high.setDraw(pointBuffer[0], pointBuffer[1]);

代码示例来源:origin: PhilJay/MPAndroidChart

@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
  LineData lineData = mChart.getLineData();
  for (Highlight high : indices) {
    ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())
      continue;
    Entry e = set.getEntryForXValue(high.getX(), high.getY());
    if (!isInBoundsX(e, set))
      continue;
    MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
        .getPhaseY());
    high.setDraw((float) pix.x, (float) pix.y);
    // draw the lines
    drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
  }
}

代码示例来源:origin: PhilJay/MPAndroidChart

@Override
  public void drawHighlighted(Canvas c, Highlight[] indices) {

    ScatterData scatterData = mChart.getScatterData();

    for (Highlight high : indices) {

      IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex());

      if (set == null || !set.isHighlightEnabled())
        continue;

      final Entry e = set.getEntryForXValue(high.getX(), high.getY());

      if (!isInBoundsX(e, set))
        continue;

      MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
          .getPhaseY());

      high.setDraw((float) pix.x, (float) pix.y);

      // draw the lines
      drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
  }
}

代码示例来源:origin: PhilJay/MPAndroidChart

@Override
  public void drawHighlighted(Canvas c, Highlight[] indices) {

    CandleData candleData = mChart.getCandleData();

    for (Highlight high : indices) {

      ICandleDataSet set = candleData.getDataSetByIndex(high.getDataSetIndex());

      if (set == null || !set.isHighlightEnabled())
        continue;

      CandleEntry e = set.getEntryForXValue(high.getX(), high.getY());

      if (!isInBoundsX(e, set))
        continue;

      float lowValue = e.getLow() * mAnimator.getPhaseY();
      float highValue = e.getHigh() * mAnimator.getPhaseY();
      float y = (lowValue + highValue) / 2f;

      MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), y);

      high.setDraw((float) pix.x, (float) pix.y);

      // draw the lines
      drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
  }
}

代码示例来源:origin: PhilJay/MPAndroidChart

pOut);
high.setDraw(pOut.x, pOut.y);

代码示例来源:origin: com.github.PhilJay/MPAndroidChart

@Override
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerY(), bar.right);
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

@Override
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerY(), bar.right);
}

代码示例来源:origin: xiaolongonly/Ticket-Analysis

/**
 * Sets the drawing position of the highlight object based on the riven bar-rect.
 * @param high
 */
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerX(), bar.top);
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

/**
 * Sets the drawing position of the highlight object based on the riven bar-rect.
 *
 * @param high
 */
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerX(), bar.top);
}

代码示例来源:origin: WenWangAndroid/ChartManager

/**
 * Sets the drawing position of the highlight object based on the riven bar-rect.
 * @param high
 */
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerX(), bar.top);
}

代码示例来源:origin: com.github.PhilJay/MPAndroidChart

/**
 * Sets the drawing position of the highlight object based on the riven bar-rect.
 * @param high
 */
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerX(), bar.top);
}

代码示例来源:origin: WenWangAndroid/ChartManager

@Override
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerY(), bar.right);
}

代码示例来源:origin: xiaolongonly/Ticket-Analysis

@Override
protected void setHighlightDrawPos(Highlight high, RectF bar) {
  high.setDraw(bar.centerY(), bar.right);
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

@Override
  public void drawHighlighted(Canvas c, Highlight[] indices) {

    ScatterData scatterData = mChart.getScatterData();

    for (Highlight high : indices) {

      IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex());

      if (set == null || !set.isHighlightEnabled())
        continue;

      final Entry e = set.getEntryForXValue(high.getX(), high.getY());

      if (!isInBoundsX(e, set))
        continue;

      MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
          .getPhaseY());

      high.setDraw((float) pix.x, (float) pix.y);

      // draw the lines
      drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
  }
}

代码示例来源:origin: WenWangAndroid/ChartManager

@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
  LineData lineData = mChart.getLineData();
  for (Highlight high : indices) {
    ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())
      continue;
    Entry e = set.getEntryForXValue(high.getX(), high.getY());
    if (!isInBoundsX(e, set))
      continue;
    MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
        .getPhaseY());
    high.setDraw((float) pix.x, (float) pix.y);
    // draw the lines
    drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
  }
}

代码示例来源:origin: com.github.PhilJay/MPAndroidChart

@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
  LineData lineData = mChart.getLineData();
  for (Highlight high : indices) {
    ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex());
    if (set == null || !set.isHighlightEnabled())
      continue;
    Entry e = set.getEntryForXValue(high.getX(), high.getY());
    if (!isInBoundsX(e, set))
      continue;
    MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
        .getPhaseY());
    high.setDraw((float) pix.x, (float) pix.y);
    // draw the lines
    drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
  }
}

代码示例来源:origin: WallaceXiao/StockChart-MPAndroidChart

@Override
public void drawHighlighted(Canvas c, Highlight[] indices) {
  LineData lineData = mChart.getLineData();
  for (Highlight high : indices) {
    ILineDataSet set = lineData.getDataSetByIndex(high.getDataSetIndex());
    if (set == null || !set.isHighlightEnabled()) {
      continue;
    }
    Entry e = set.getEntryForXValue(high.getX(), high.getY());
    if (isInBoundsX(e, set)) {
      MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX()+ offSet, e.getY() * mAnimator
          .getPhaseY());
      high.setDraw((float) pix.x, (float) pix.y);
      // draw the lines
      drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
  }
}

代码示例来源:origin: WenWangAndroid/ChartManager

@Override
  public void drawHighlighted(Canvas c, Highlight[] indices) {

    ScatterData scatterData = mChart.getScatterData();

    for (Highlight high : indices) {

      IScatterDataSet set = scatterData.getDataSetByIndex(high.getDataSetIndex());

      if (set == null || !set.isHighlightEnabled())
        continue;

      final Entry e = set.getEntryForXValue(high.getX(), high.getY());

      if (!isInBoundsX(e, set))
        continue;

      MPPointD pix = mChart.getTransformer(set.getAxisDependency()).getPixelForValues(e.getX(), e.getY() * mAnimator
          .getPhaseY());

      high.setDraw((float) pix.x, (float) pix.y);

      // draw the lines
      drawHighlightLines(c, (float) pix.x, (float) pix.y, set);
    }
  }
}

相关文章