Back to project page AndroidCharts.
The source code is released under:
MIT License
If you think the Android project AndroidCharts listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.dacer.androidchartsexample; /*from www . ja va2s .c o m*/ import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import com.dacer.androidcharts.ClockPieHelper; import com.dacer.androidcharts.ClockPieView; import java.util.ArrayList; /** * Created by Dacer on 11/16/13. */ public class ClockPieFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_pie, container, false); final ClockPieView clockPieView = (ClockPieView)rootView.findViewById(R.id.pie_view); Button button = (Button)rootView.findViewById(R.id.pie_button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { randomSet(clockPieView); } }); set(clockPieView); return rootView; } private void randomSet(ClockPieView clockPieView){ ArrayList<ClockPieHelper> clockPieHelperArrayList = new ArrayList<ClockPieHelper>(); for(int i=0; i<20; i++){ int startHour = (int)(24*Math.random()); int startMin = (int)(60*Math.random()); int duration = (int)(50*Math.random()); clockPieHelperArrayList.add(new ClockPieHelper(startHour,startMin,0,startHour,startMin+duration,0)); } clockPieView.setDate(clockPieHelperArrayList); } private void set(ClockPieView clockPieView){ ArrayList<ClockPieHelper> clockPieHelperArrayList = new ArrayList<ClockPieHelper>(); clockPieHelperArrayList.add(new ClockPieHelper(1,50,2,30)); clockPieHelperArrayList.add(new ClockPieHelper(6,50,8,30)); clockPieView.setDate(clockPieHelperArrayList); } }