use of com.github.mikephil.charting.charts.Chart in project MPAndroidChart by PhilJay.
the class MarkerImage method getOffsetForDrawingAtPoint.
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {
MPPointF offset = getOffset();
mOffset2.x = offset.x;
mOffset2.y = offset.y;
Chart chart = getChartView();
float width = mSize.width;
float height = mSize.height;
if (width == 0.f && mDrawable != null) {
width = mDrawable.getIntrinsicWidth();
}
if (height == 0.f && mDrawable != null) {
height = mDrawable.getIntrinsicHeight();
}
if (posX + mOffset2.x < 0) {
mOffset2.x = -posX;
} else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
mOffset2.x = chart.getWidth() - posX - width;
}
if (posY + mOffset2.y < 0) {
mOffset2.y = -posY;
} else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
mOffset2.y = chart.getHeight() - posY - height;
}
return mOffset2;
}
use of com.github.mikephil.charting.charts.Chart in project MPAndroidChart by PhilJay.
the class MarkerView method getOffsetForDrawingAtPoint.
@Override
public MPPointF getOffsetForDrawingAtPoint(float posX, float posY) {
MPPointF offset = getOffset();
mOffset2.x = offset.x;
mOffset2.y = offset.y;
Chart chart = getChartView();
float width = getWidth();
float height = getHeight();
if (posX + mOffset2.x < 0) {
mOffset2.x = -posX;
} else if (chart != null && posX + width + mOffset2.x > chart.getWidth()) {
mOffset2.x = chart.getWidth() - posX - width;
}
if (posY + mOffset2.y < 0) {
mOffset2.y = -posY;
} else if (chart != null && posY + height + mOffset2.y > chart.getHeight()) {
mOffset2.y = chart.getHeight() - posY - height;
}
return mOffset2;
}
use of com.github.mikephil.charting.charts.Chart in project MPAndroidChart by PhilJay.
the class CombinedChartRenderer method drawHighlighted.
@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()]));
}
}
Aggregations