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

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

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

Highlight.getStackIndex介绍

[英]Only needed if a stacked-barchart entry was highlighted. References the selected value within the stacked-entry.
[中]仅当堆叠条形图条目高亮显示时才需要。参照堆叠条目中的选定值。

代码示例

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

@Override
public void onValueSelected(Entry e, Highlight h) {
  BarEntry entry = (BarEntry) e;
  Log.i("VAL SELECTED",
      "Value: " + Math.abs(entry.getYVals()[h.getStackIndex()]));
}

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

@Override
public void onValueSelected(Entry e, Highlight h) {
  BarEntry entry = (BarEntry) e;
  if (entry.getYVals() != null)
    Log.i("VAL SELECTED", "Value: " + entry.getYVals()[h.getStackIndex()]);
  else
    Log.i("VAL SELECTED", "Value: " + entry.getY());
}

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

@Override
public void refreshContent(Entry e, Highlight highlight) {
  if (e instanceof BarEntry) {
    BarEntry be = (BarEntry) e;
    if(be.getYVals() != null) {
      // draw the stack value
      tvContent.setText(Utils.formatNumber(be.getYVals()[highlight.getStackIndex()], 0, true));
    } else {
      tvContent.setText(Utils.formatNumber(be.getY(), 0, true));
    }
  } else {
    tvContent.setText(Utils.formatNumber(e.getY(), 0, true));
  }
  super.refreshContent(e, highlight);
}

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

mHighlightPaint.setAlpha(set.getHighLightAlpha());
boolean isStack = (high.getStackIndex() >= 0  && e.isStacked()) ? true : false;
    Range range = e.getRanges()[high.getStackIndex()];

代码示例来源:origin: zhuanghongji/mp-android-chart

@Override
public void onValueSelected(Entry e, Highlight h) {
  BarEntry entry = (BarEntry) e;
  Log.i("VAL SELECTED",
      "Value: " + Math.abs(entry.getYVals()[h.getStackIndex()]));
}

代码示例来源:origin: zhuanghongji/mp-android-chart

@Override
public void onValueSelected(Entry e, Highlight h) {
  BarEntry entry = (BarEntry) e;
  if (entry.getYVals() != null)
    Log.i("VAL SELECTED", "Value: " + entry.getYVals()[h.getStackIndex()]);
  else
    Log.i("VAL SELECTED", "Value: " + entry.getY());
}

代码示例来源:origin: SecUSo/privacy-friendly-netmonitor

@Override
public void onValueSelected(Entry e, Highlight h) {
  //extra cacheList to only show the reports to the selected value in the chart
  List<ReportEntity> cacheList = new ArrayList<ReportEntity>();
  if (e.getY() != 0) {
    for (ReportEntity cacheEntity : filtered_Entities) {
      int daysBetween = getDaysBetween(dateBefore1month, getEntityDate(cacheEntity));
      if (daysBetween == e.getX()) {
        if (h.getStackIndex() == 0 && cacheEntity.getConnectionInfo().contains("Unknown")) {
          cacheList.add(cacheEntity);
        }
        if (h.getStackIndex() == 1 && cacheEntity.getConnectionInfo().contains("Encrypted")) {
          cacheList.add(cacheEntity);
        }
        if (h.getStackIndex() == 2 && cacheEntity.getConnectionInfo().contains("Unencrypted")) {
          cacheList.add(cacheEntity);
        }
      }
    }
    fillRecyclerList(view, cacheList); //method to show conn. according to the value
  }
}

代码示例来源:origin: SecUSo/privacy-friendly-netmonitor

int cacheEntityHour = (getEntityHour(cacheEntity) + shift) % 24;
if (cacheEntityHour == e.getX()) {
  if (h.getStackIndex() == 0 && cacheEntity.getConnectionInfo().contains("Unknown")) {
    cacheList.add(cacheEntity);
  if (h.getStackIndex() == 1 && cacheEntity.getConnectionInfo().contains("Encrypted")) {
    cacheList.add(cacheEntity);
  if (h.getStackIndex() == 2 && cacheEntity.getConnectionInfo().contains("Unencrypted")) {
    cacheList.add(cacheEntity);

代码示例来源:origin: SecUSo/privacy-friendly-netmonitor

@Override
public void onValueSelected(Entry e, Highlight h) {
  //Handling the current time in Hour
  int currentDay = currentDate.getDate();
  int shift = currentDay - 6; //the shift that is needed to get the correct connections
  //extra cacheList to only show the reports to the selected value in the chart
  List<ReportEntity> cacheList = new ArrayList<ReportEntity>();
  if (e.getY() != 0) {
    for (ReportEntity cacheEntity : filtered_Entities) {
      int daysBetween = getDaysBetween(dateBefore1week, getEntityDate(cacheEntity));
      if (daysBetween == e.getX()) {
        if (h.getStackIndex() == 0 && cacheEntity.getConnectionInfo().contains("Unknown")) {
          cacheList.add(cacheEntity);
        }
        if (h.getStackIndex() == 1 && cacheEntity.getConnectionInfo().contains("Encrypted")) {
          cacheList.add(cacheEntity);
        }
        if (h.getStackIndex() == 2 && cacheEntity.getConnectionInfo().contains("Unencrypted")) {
          cacheList.add(cacheEntity);
        }
      }
    }
    fillRecyclerList(view, cacheList); //method to show conn. according to the value
  }
}

代码示例来源:origin: zhuanghongji/mp-android-chart

@Override
public void refreshContent(Entry e, Highlight highlight) {
  if (e instanceof BarEntry) {
    BarEntry be = (BarEntry) e;
    if(be.getYVals() != null) {
      // draw the stack value
      tvContent.setText("" + Utils.formatNumber(be.getYVals()[highlight.getStackIndex()], 0, true));
    } else {
      tvContent.setText("" + Utils.formatNumber(be.getY(), 0, true));
    }
  } else {
    tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
  }
  super.refreshContent(e, highlight);
}

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

@Override
public void onValueSelected(Entry e, Highlight h) {
  barChart.highlightValue(h);
  Highlight highlight = new Highlight(h.getX(), 0, h.getStackIndex());
  highlight.setDataIndex(1);
  candleChart.highlightValues(new Highlight[]{highlight});
  updateText(e.getXIndex(), true);
}

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

@Override
public void onValueSelected(Entry e, Highlight h) {
  candleChart.highlightValue(h);
  if (barChart.getData().getBarData().getDataSets().size() != 0) {
    Highlight highlight = new Highlight(h.getX(), h.getDataSetIndex(), h.getStackIndex());
    highlight.setDataIndex(h.getDataIndex());
    barChart.highlightValues(new Highlight[]{highlight});
  } else {
    Highlight highlight = new Highlight(h.getX(), 2, h.getStackIndex());
    highlight.setDataIndex(0);
    barChart.highlightValues(new Highlight[]{highlight});
  }
  updateText(e.getXIndex(), true);
}

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

mHighlightPaint.setStrokeWidth(Utils.convertDpToPixel(set.getHighlightLineWidth()));
boolean isStack = (high.getStackIndex() >= 0 && e.isStacked()) ? true : false;
    Range range = e.getRanges()[high.getStackIndex()];

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

mHighlightPaint.setAlpha(set.getHighLightAlpha());
boolean isStack = (high.getStackIndex() >= 0  && e.isStacked()) ? true : false;
    Range range = e.getRanges()[high.getStackIndex()];

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

mHighlightPaint.setAlpha(set.getHighLightAlpha());
boolean isStack = (high.getStackIndex() >= 0  && e.isStacked()) ? true : false;
    Range range = e.getRanges()[high.getStackIndex()];

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

mHighlightPaint.setAlpha(set.getHighLightAlpha());
boolean isStack = (high.getStackIndex() >= 0  && e.isStacked()) ? true : false;
    Range range = e.getRanges()[high.getStackIndex()];

相关文章