forked from PhilJay/MPAndroidChart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBubbleChart.java
More file actions
71 lines (53 loc) · 1.9 KB
/
BubbleChart.java
File metadata and controls
71 lines (53 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.github.mikephil.charting.charts;
import android.content.Context;
import android.util.AttributeSet;
import com.github.mikephil.charting.data.BubbleData;
import com.github.mikephil.charting.data.BubbleDataSet;
import com.github.mikephil.charting.interfaces.BubbleDataProvider;
import com.github.mikephil.charting.renderer.BubbleChartRenderer;
/**
* The BubbleChart. Draws bubbles. Bubble chart implementation: Copyright 2015
* Pierre-Marc Airoldi Licensed under Apache License 2.0. In the BubbleChart, it
* is the area of the bubble, not the radius or diameter of the bubble that
* conveys the data.
*
* @author Philipp Jahoda
*/
public class BubbleChart extends BarLineChartBase<BubbleData> implements BubbleDataProvider {
public BubbleChart(Context context) {
super(context);
}
public BubbleChart(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BubbleChart(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void init() {
super.init();
mRenderer = new BubbleChartRenderer(this, mAnimator, mViewPortHandler);
}
@Override
protected void calcMinMax() {
super.calcMinMax();
if (mDeltaX == 0 && mData.getYValCount() > 0)
mDeltaX = 1;
mXChartMin = -0.5f;
mXChartMax = (float) mData.getXValCount() - 0.5f;
if (mRenderer != null) {
for (BubbleDataSet set : mData.getDataSets()) {
final float xmin = set.getXMin();
final float xmax = set.getXMax();
if (xmin < mXChartMin)
mXChartMin = xmin;
if (xmax > mXChartMax)
mXChartMax = xmax;
}
}
mDeltaX = Math.abs(mXChartMax - mXChartMin);
}
public BubbleData getBubbleData() {
return mData;
}
}