public int getDataIndex(ChartData data) { return getAllData().indexOf(data); }
public BarLineScatterCandleBubbleData getDataByIndex(int index) { return getAllData().get(index); }
@Override public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) { List<BarLineScatterCandleBubbleData> datas = getAllData(); boolean success = false; for (ChartData data : datas) { success = data.removeDataSet(d); if (success) { break; } } return success; }
@Override protected List<Highlight> getHighlightsAtXValue(float xVal, float x, float y) { mHighlightBuffer.clear(); List<BarLineScatterCandleBubbleData> dataObjects = mChart.getCombinedData().getAllData(); for (int i = 0; i < dataObjects.size(); i++) { ChartData dataObject = dataObjects.get(i); // in case of BarData, let the BarHighlighter take over if (barHighlighter != null && dataObject instanceof BarData) { Highlight high = barHighlighter.getHighlight(x, y); if (high != null) { high.setDataIndex(i); mHighlightBuffer.add(high); } } else { for (int j = 0, dataSetCount = dataObject.getDataSetCount(); j < dataSetCount; j++) { IDataSet dataSet = dataObjects.get(i).getDataSetByIndex(j); // don't include datasets that cannot be highlighted if (!dataSet.isHighlightEnabled()) continue; List<Highlight> highs = buildHighlights(dataSet, j, xVal, DataSet.Rounding.CLOSEST); for (Highlight high : highs) { high.setDataIndex(i); mHighlightBuffer.add(high); } } } } return mHighlightBuffer; }
@Override public void drawHighlighted(Canvas c, Highlight[] indices) { Chart chart = mChart.get(); if (chart == null) return; for (DataRenderer renderer : mRenderers) { ChartData data = null; if (renderer instanceof BarChartRenderer) data = ((BarChartRenderer)renderer).mChart.getBarData(); else if (renderer instanceof LineChartRenderer) data = ((LineChartRenderer)renderer).mChart.getLineData(); else if (renderer instanceof CandleStickChartRenderer) data = ((CandleStickChartRenderer)renderer).mChart.getCandleData(); else if (renderer instanceof ScatterChartRenderer) data = ((ScatterChartRenderer)renderer).mChart.getScatterData(); else if (renderer instanceof BubbleChartRenderer) data = ((BubbleChartRenderer)renderer).mChart.getBubbleData(); int dataIndex = data == null ? -1 : ((CombinedData)chart.getData()).getAllData().indexOf(data); mHighlightBuffer.clear(); for (Highlight h : indices) { if (h.getDataIndex() == dataIndex || h.getDataIndex() == -1) mHighlightBuffer.add(h); } renderer.drawHighlighted(c, mHighlightBuffer.toArray(new Highlight[mHighlightBuffer.size()])); } }
/** * Get dataset for highlight * * @param highlight current highlight * @return dataset related to highlight */ public IBarLineScatterCandleBubbleDataSet<? extends Entry> getDataSetByHighlight(Highlight highlight) { if (highlight.getDataIndex() >= getAllData().size()) return null; BarLineScatterCandleBubbleData data = getDataByIndex(highlight.getDataIndex()); if (highlight.getDataSetIndex() >= data.getDataSetCount()) return null; return (IBarLineScatterCandleBubbleDataSet<? extends Entry>) data.getDataSets().get(highlight.getDataSetIndex()); }
mRightAxisMin = Float.MAX_VALUE; List<BarLineScatterCandleBubbleData> allData = getAllData();
/** * Get the Entry for a corresponding highlight object * * @param highlight * @return the entry that is highlighted */ @Override public Entry getEntryForHighlight(Highlight highlight) { if (highlight.getDataIndex() >= getAllData().size()) return null; ChartData data = getDataByIndex(highlight.getDataIndex()); if (highlight.getDataSetIndex() >= data.getDataSetCount()) return null; // The value of the highlighted entry could be NaN - // if we are not interested in highlighting a specific value. List<Entry> entries = data.getDataSetByIndex(highlight.getDataSetIndex()) .getEntriesForXValue(highlight.getX()); for (Entry entry : entries) if (entry.getY() == highlight.getY() || Float.isNaN(highlight.getY())) return entry; return null; }
public BarLineScatterCandleBubbleData getDataByIndex(int index) { return getAllData().get(index); }
public int getDataIndex(ChartData data) { return getAllData().indexOf(data); }
public BarLineScatterCandleBubbleData getDataByIndex(int index) { return getAllData().get(index); }
public int getDataIndex(ChartData data) { return getAllData().indexOf(data); }
public BarLineScatterCandleBubbleData getDataByIndex(int index) { return getAllData().get(index); }
public BarLineScatterCandleBubbleData getDataByIndex(int index) { return getAllData().get(index); }
public int getDataIndex(ChartData data) { return getAllData().indexOf(data); }
public int getDataIndex(ChartData data) { return getAllData().indexOf(data); }
@Override public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) { List<BarLineScatterCandleBubbleData> datas = getAllData(); boolean success = false; for (ChartData data : datas) { success = data.removeDataSet(d); if (success) { break; } } return success; }
@Override public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) { List<BarLineScatterCandleBubbleData> datas = getAllData(); boolean success = false; for (ChartData data : datas) { success = data.removeDataSet(d); if (success) { break; } } return success; }
@Override public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) { List<BarLineScatterCandleBubbleData> datas = getAllData(); boolean success = false; for (ChartData data : datas) { success = data.removeDataSet(d); if (success) { break; } } return success; }
@Override public boolean removeDataSet(IBarLineScatterCandleBubbleDataSet<? extends Entry> d) { List<BarLineScatterCandleBubbleData> datas = getAllData(); boolean success = false; for (ChartData data : datas) { success = data.removeDataSet(d); if (success) { break; } } return success; }