Search in sources :

Example 11 with PointValue

use of lecho.lib.hellocharts.model.PointValue in project hellocharts-android by lecho.

the class ComboLineColumnChartView method callTouchListener.

@Override
public void callTouchListener() {
    SelectedValue selectedValue = chartRenderer.getSelectedValue();
    if (selectedValue.isSet()) {
        if (SelectedValueType.COLUMN.equals(selectedValue.getType())) {
            SubcolumnValue value = data.getColumnChartData().getColumns().get(selectedValue.getFirstIndex()).getValues().get(selectedValue.getSecondIndex());
            onValueTouchListener.onColumnValueSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), value);
        } else if (SelectedValueType.LINE.equals(selectedValue.getType())) {
            PointValue value = data.getLineChartData().getLines().get(selectedValue.getFirstIndex()).getValues().get(selectedValue.getSecondIndex());
            onValueTouchListener.onPointValueSelected(selectedValue.getFirstIndex(), selectedValue.getSecondIndex(), value);
        } else {
            throw new IllegalArgumentException("Invalid selected value type " + selectedValue.getType().name());
        }
    } else {
        onValueTouchListener.onValueDeselected();
    }
}
Also used : PointValue(lecho.lib.hellocharts.model.PointValue) SubcolumnValue(lecho.lib.hellocharts.model.SubcolumnValue) SelectedValue(lecho.lib.hellocharts.model.SelectedValue)

Example 12 with PointValue

use of lecho.lib.hellocharts.model.PointValue in project CoCoin by Nightonke.

the class SplashActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    mContext = this;
    chart = (LineChartView) findViewById(R.id.chart);
    List<Line> lines = new ArrayList<Line>();
    for (int i = 0; i < NUMBER_OF_LINES; ++i) {
        List<PointValue> values = new ArrayList<PointValue>();
        values.add(new PointValue(0, 0));
        values.add(new PointValue(1, 15));
        values.add(new PointValue(2, 10));
        values.add(new PointValue(3, 23));
        values.add(new PointValue(3.5f, 48));
        values.add(new PointValue(5, 60));
        Line line = new Line(values);
        line.setColor(Color.WHITE);
        line.setShape(ValueShape.CIRCLE);
        line.setCubic(false);
        line.setFilled(false);
        line.setHasLabels(false);
        line.setHasLabelsOnlyForSelected(false);
        line.setHasLines(true);
        line.setHasPoints(true);
        lines.add(line);
    }
    data = new LineChartData(lines);
    data.setBaseValue(Float.NEGATIVE_INFINITY);
    chart.setLineChartData(data);
    image = (ImageView) findViewById(R.id.image);
    appName = (TextView) findViewById(R.id.app_name);
    appName.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    loadingText = (TextView) findViewById(R.id.loading_text);
    loadingText.setTypeface(CoCoinUtil.getInstance().typefaceLatoLight);
    reveal = (RevealFrameLayout) findViewById(R.id.reveal);
    ly = (LinearLayout) findViewById(R.id.ly);
    new InitData().execute();
}
Also used : Line(lecho.lib.hellocharts.model.Line) PointValue(lecho.lib.hellocharts.model.PointValue) ArrayList(java.util.ArrayList) LineChartData(lecho.lib.hellocharts.model.LineChartData)

Aggregations

PointValue (lecho.lib.hellocharts.model.PointValue)12 Paint (android.graphics.Paint)5 Line (lecho.lib.hellocharts.model.Line)5 LineChartData (lecho.lib.hellocharts.model.LineChartData)4 ArrayList (java.util.ArrayList)3 SelectedValue (lecho.lib.hellocharts.model.SelectedValue)2 SliceValue (lecho.lib.hellocharts.model.SliceValue)2 SubcolumnValue (lecho.lib.hellocharts.model.SubcolumnValue)2 Point (android.graphics.Point)1 ViewPager (android.support.v4.view.ViewPager)1 DisplayMetrics (android.util.DisplayMetrics)1 View (android.view.View)1 ViewTreeObserver (android.view.ViewTreeObserver)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 DotsView (com.dev.sacot41.scviewpager.DotsView)1 SCPositionAnimation (com.dev.sacot41.scviewpager.SCPositionAnimation)1 SCViewAnimation (com.dev.sacot41.scviewpager.SCViewAnimation)1