forked from PhilJay/MPAndroidChart
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScatterChartFrag.java
More file actions
57 lines (42 loc) · 1.9 KB
/
ScatterChartFrag.java
File metadata and controls
57 lines (42 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
package com.xxmassdeveloper.mpchartexample.fragments;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.github.mikephil.charting.charts.ScatterChart;
import com.github.mikephil.charting.utils.Legend;
import com.github.mikephil.charting.utils.YLabels;
import com.xxmassdeveloper.mpchartexample.MyMarkerView;
import com.xxmassdeveloper.mpchartexample.R;
public class ScatterChartFrag extends SimpleFragment {
public static Fragment newInstance() {
return new ScatterChartFrag();
}
private ScatterChart mChart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
mChart.setDrawYValues(false);
mChart.setDescription("");
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
YLabels labels = mChart.getYLabels();
labels.setTypeface(tf);
MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
mv.setOffsets(-mv.getMeasuredWidth() / 2, -mv.getMeasuredHeight());
mChart.setMarkerView(mv);
mChart.setHighlightIndicatorEnabled(false);
mChart.setDrawBorder(false);
// mChart.setBorderStyles(new BorderStyle[] { BorderStyle.LEFT });
mChart.setDrawGridBackground(false);
mChart.setDrawVerticalGrid(false);
mChart.setDrawXLabels(false);
mChart.setUnit(" $");
mChart.setData(generateScatterData(3, 10000, 150));
Legend l = mChart.getLegend();
l.setTypeface(tf);
return v;
}
}