/** * Constructor with initialization parameters. * * @param chart instance of the chart * @param touchMatrix the touch-matrix of the chart * @param dragTriggerDistance the minimum movement distance that will be interpreted as a "drag" gesture in dp (3dp equals * to about 9 pixels on a 5.5" FHD screen) */ public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix, float dragTriggerDistance) { super(chart); this.mMatrix = touchMatrix; this.mDragTriggerDist = Utils.convertDpToPixel(dragTriggerDistance); this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f); }
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) { super(chart); this.mMatrix = touchMatrix; // this equals to about 9 pixels on a 5.5" FHD screen this.mDragTriggerDist = Utils.convertDpToPixel(3f); this.mMinScalePointerDistance = Utils.convertDpToPixel(3.5f); }
@Override protected BarLineScatterCandleBubbleData getData() { return mChart.getBarData(); }
/** * Returns a list of Highlight objects representing the entries closest to the given xVal. * The returned list contains two objects per DataSet (closest rounding up, closest rounding down). * * @param xVal the transformed x-value of the x-touch position * @param x touch position * @param y touch position * @return */ protected List<Highlight> getHighlightsAtXValue(float xVal, float x, float y) { mHighlightBuffer.clear(); BarLineScatterCandleBubbleData data = getData(); if (data == null) return mHighlightBuffer; for (int i = 0, dataSetCount = data.getDataSetCount(); i < dataSetCount; i++) { IDataSet dataSet = data.getDataSetByIndex(i); // don't include DataSets that cannot be highlighted if (!dataSet.isHighlightEnabled()) continue; mHighlightBuffer.addAll(buildHighlights(dataSet, i, xVal, DataSet.Rounding.CLOSEST)); } return mHighlightBuffer; }
protected BarLineScatterCandleBubbleData getData() { return mChart.getData(); }
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends IBarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) { super(chart); this.mMatrix = touchMatrix; }
public BarLineChartTouchListener(BarLineChartBase<? extends BarLineScatterCandleBubbleData<? extends BarLineScatterCandleBubbleDataSet<? extends Entry>>> chart, Matrix touchMatrix) { super(chart); this.mMatrix = touchMatrix; }
@Override protected List<Highlight> getHighlightsAtXPos(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; Highlight s1 = buildHighlight(dataSet, j, xVal, DataSet.Rounding.CLOSEST); s1.setDataIndex(i); mHighlightBuffer.add(s1); // Highlight s2 = buildHighlight(dataSet, j, xVal, DataSet.Rounding.DOWN); // s2.setDataIndex(i); // vals.add(s2); } } } return mHighlightBuffer; }
/** * Returns a list of Highlight objects representing the entries closest to the given xVal. * The returned list contains two objects per DataSet (closest rounding up, closest rounding down). * * @param xVal the transformed x-value of the x-touch position * @param x touch position * @param y touch position * @return */ protected List<Highlight> getHighlightsAtXPos(float xVal, float x, float y) { mHighlightBuffer.clear(); BarLineScatterCandleBubbleData data = getData(); if (data == null) return mHighlightBuffer; for (int i = 0, dataSetCount = data.getDataSetCount(); i < dataSetCount; i++) { IDataSet dataSet = data.getDataSetByIndex(i); // dont include datasets that cannot be highlighted if (!dataSet.isHighlightEnabled()) continue; Highlight high = buildHighlight(dataSet, i, xVal, DataSet.Rounding.CLOSEST); if(high != null) mHighlightBuffer.add(high); //vals.add(buildHighlight(dataSet, i, xVal, DataSet.Rounding.DOWN)); } return mHighlightBuffer; }
BarLineScatterCandleBubbleData getData();