Back to project page EazeGraph.
The source code is released under:
Apache License
If you think the Android project EazeGraph listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** *//from w ww . j av a 2 s. co m * Copyright (C) 2014 Paul Cech * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.eazegraph.showcase.fragments; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import org.eazegraph.lib.charts.PieChart; import org.eazegraph.lib.communication.IOnItemFocusChangedListener; import org.eazegraph.lib.models.PieModel; import org.eazegraph.showcase.R; public class PieChartFragment extends ChartFragment { public PieChartFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_pie_chart, container, false); mPieChart = (PieChart) view.findViewById(R.id.piechart); loadData(); return view; } @Override public void onResume() { super.onResume(); mPieChart.startAnimation(); } @Override public void restartAnimation() { mPieChart.startAnimation(); } @Override public void onReset() { } private void loadData() { mPieChart.addPieSlice(new PieModel("Freetime", 15, Color.parseColor("#FE6DA8"))); mPieChart.addPieSlice(new PieModel("Sleep", 25, Color.parseColor("#56B7F1"))); mPieChart.addPieSlice(new PieModel("Work", 35, Color.parseColor("#CDA67F"))); mPieChart.addPieSlice(new PieModel("Eating", 9, Color.parseColor("#FED70E"))); mPieChart.setOnItemFocusChangedListener(new IOnItemFocusChangedListener() { @Override public void onItemFocusChanged(int _Position) { // Log.d("PieChart", "Position: " + _Position); } }); } private PieChart mPieChart; }