當前位置: 首頁>>代碼示例>>Java>>正文


Java BarChart.animateY方法代碼示例

本文整理匯總了Java中com.github.mikephil.charting.charts.BarChart.animateY方法的典型用法代碼示例。如果您正苦於以下問題:Java BarChart.animateY方法的具體用法?Java BarChart.animateY怎麽用?Java BarChart.animateY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.mikephil.charting.charts.BarChart的用法示例。


在下文中一共展示了BarChart.animateY方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setHorizontalBarChart

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
/**
 * Set the horizontal bar pattern
 * @param barChart chart
 * @param chartData horizontal bar chart data
 * @param jobs string array of job titles
 * @param typeface Typeface font
 */
public static void setHorizontalBarChart(BarChart barChart, final ChartData<?> chartData,
                                         final String[] jobs, Typeface typeface) {
    barChart.setDrawGridBackground(false);
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    //xAxis.setLabelCount(chartData.getEntryCount());
    xAxis.setLabelCount(jobs.length);
    xAxis.setTypeface(typeface);
    xAxis.setDrawAxisLine(true);
    xAxis.setDrawGridLines(false);
    xAxis.setGranularity(1f);

    YAxis leftAxis = barChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setSpaceTop(15f);
    leftAxis.setAxisMinimum(0f);
    leftAxis.setGranularity(1f);
    leftAxis.setDrawAxisLine(true);
    leftAxis.setDrawGridLines(true);
    YAxis axisRight = barChart.getAxisRight();
    axisRight.setTypeface(typeface);
    axisRight.setDrawAxisLine(true);
    axisRight.setDrawGridLines(false);
    axisRight.setGranularity(1f);
    axisRight.setAxisMinimum(0f);

    final Legend legend = barChart.getLegend();
    legend.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM);
    legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
    legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
    legend.setDrawInside(false);
    legend.setFormSize(8f);
    legend.setXEntrySpace(4f);
    barChart.setData((BarData) chartData);
    barChart.setFitBars(true);
    barChart.animateY(DURATION_LONG);
    xAxis.setValueFormatter(new HorizontalBarValueFormatter(jobs));
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:46,代碼來源:ChartHelper.java

示例2: setVerticalBarChart

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
/**
 * Set the vertical bar  pattern
 * @param barChart chart
 * @param chartData pie chart data
 * @param typeface Typeface font
 */
public static void setVerticalBarChart(Context context, BarChart barChart, ChartData<?> chartData,
                                        Typeface typeface) {
    // create a custom MarkerView (extend MarkerView) and specify the layout to use for it
    ExperienceMarker marker = new ExperienceMarker(context, R.layout.marker_exp_age);
    marker.setChartView(barChart); // For bounds control
    barChart.setMarker(marker);
    //fix crash com.github.mikephil.charting.charts.Chart.drawMarkers(Chart.java:731)
    barChart.setDrawMarkers(false);

    barChart.getDescription().setEnabled(false);
    barChart.setDrawGridBackground(false);
    barChart.setDrawBarShadow(false);
    XAxis xAxis = barChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    //Sets the number of labels for the x-axis (display all the x-axis values)
   // xAxis.setLabelCount(chartData.getEntryCount());
    xAxis.setTypeface(typeface);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(true);
    YAxis leftAxis = barChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setSpaceTop(20f);
    leftAxis.setAxisMinimum(0f);

    YAxis rightAxis = barChart.getAxisRight();
    rightAxis.setTypeface(typeface);
    rightAxis.setSpaceTop(20f);
    rightAxis.setAxisMinimum(0f);
    chartData.setValueTypeface(typeface);
    barChart.setData((BarData) chartData);
    barChart.setFitBars(true);
    barChart.animateY(DURATION_SHORT);
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:40,代碼來源:ChartHelper.java

示例3: initChart

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
/**
 * initiliaze chart
 */
private void initChart() {
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);
    mChart.setDescription("");
    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);
    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setDescriptionColor(Color.parseColor("#000000"));

    XAxis xAxis = mChart.getXAxis();
    xAxis.setDrawGridLines(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setSpaceBetweenLabels(0);

    YAxisValueFormatter custom = new DataAxisFormatter("%");

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setValueFormatter(custom);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setValueFormatter(custom);
    rightAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);

    leftAxis.setDrawGridLines(true);
    rightAxis.setDrawGridLines(false);

    mChart.animateY(1000);

    mChart.getLegend().setEnabled(true);

    mChart.setVisibility(View.GONE);
}
 
開發者ID:bertrandmartel,項目名稱:bluetooth-le-analyzer,代碼行數:41,代碼來源:AnalyzerActivity.java

示例4: setupTemperatureChart

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
protected void setupTemperatureChart(){
    EnvStatistic temperature = mHDD.getSessionData().getCurrentStats().getTemperature();
    if(temperature!=null && temperature.isValid()){
        mTempChart = new BarChart(this);
        List<BarEntry> statVals = new ArrayList<>(3);

        statVals.add(new BarEntry((float) temperature.getMin(), 0));
        statVals.add(new BarEntry((float) temperature.getAvg(), 1));
        statVals.add(new BarEntry((float) temperature.getMax(), 2));

        BarDataSet summary = new BarDataSet(statVals,"Temperature");

        mTempChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
        mTempChart.setDescription("");
        mTempChart.animateY(2000);
        mTempChart.getAxisRight().setEnabled(false);
        mTempChart.setTouchEnabled(false);

        mTempChart.setLayoutParams(new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mTempChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
        mTempChartContainer.addView(mTempChart);
    }
    else{
        TextView noGraph = new TextView(this);
        noGraph.setText("No Temperature Statistics to Show");
        noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
        mTempChartContainer.addView(noGraph);
    }
}
 
開發者ID:foxtrot94,項目名稱:DotHike,代碼行數:32,代碼來源:ResultsActivity.java

示例5: setupPressureChart

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
protected void setupPressureChart(){
    EnvStatistic pressure = mHDD.getSessionData().getCurrentStats().getPressure();
    if(pressure!=null && pressure.isValid()){
        mPressureChart = new BarChart(this);
        List<BarEntry> statVals = new ArrayList<>(3);

        statVals.add(new BarEntry((float) pressure.getMin(),0));
        statVals.add(new BarEntry((float) pressure.getAvg(), 1));
        statVals.add(new BarEntry((float) pressure.getMax(), 2));

        BarDataSet summary = new BarDataSet(statVals,"Pressure");

        mPressureChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
        mPressureChart.setDescription("");
        mPressureChart.animateY(2000);
        mPressureChart.getAxisRight().setEnabled(false);
        mPressureChart.setTouchEnabled(false);

        mPressureChart.setLayoutParams(new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mPressureChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
        mPressureChartContainer.addView(mPressureChart);
    }
    else{
        TextView noGraph = new TextView(this);
        noGraph.setText("No Pressure Statistics to Show");
        noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
        mPressureChartContainer.addView(noGraph);
    }
}
 
開發者ID:foxtrot94,項目名稱:DotHike,代碼行數:32,代碼來源:ResultsActivity.java

示例6: setupHumidityChart

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
protected void setupHumidityChart(){
    EnvStatistic humidity = mHDD.getSessionData().getCurrentStats().getHumidity();
    if(humidity!=null && humidity.isValid()){
        mHumidityChart = new BarChart(this);
        List<BarEntry> statVals = new ArrayList<>(3);

        statVals.add(new BarEntry((float) humidity.getMin(), 0));
        statVals.add(new BarEntry((float) humidity.getAvg(), 1));
        statVals.add(new BarEntry((float) humidity.getMax(), 2));

        BarDataSet summary = new BarDataSet(statVals,"Humidity");

        mHumidityChart.setData(new BarData(new String[]{"Min", "Avg", "Max"}, summary));
        mHumidityChart.setDescription("");
        mHumidityChart.animateY(2000);
        mHumidityChart.getAxisRight().setEnabled(false);
        mHumidityChart.setTouchEnabled(false);

        mHumidityChart.setLayoutParams(new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        mHumidityChart.setMinimumHeight(STATISTIC_CHART_HEIGHT);
        mHumidityChartContainer.addView(mHumidityChart);
    }
    else{
        TextView noGraph = new TextView(this);
        noGraph.setText("No Humidity Statistics to Show");
        noGraph.setGravity(View.TEXT_ALIGNMENT_CENTER);
        mHumidityChartContainer.addView(noGraph);
    }
}
 
開發者ID:foxtrot94,項目名稱:DotHike,代碼行數:32,代碼來源:ResultsActivity.java

示例7: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_barchart);

    tvX = (TextView) findViewById(R.id.tvXMax);
    tvY = (TextView) findViewById(R.id.tvYMax);

    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarX.setOnSeekBarChangeListener(this);

    mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
    mSeekBarY.setOnSeekBarChangeListener(this);

    mChart = (BarChart) findViewById(R.id.chart1);

    mChart.getDescription().setEnabled(false);

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawBarShadow(false);
    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);
    
    mChart.getAxisLeft().setDrawGridLines(false);

    // setting data
    mSeekBarX.setProgress(10);
    mSeekBarY.setProgress(100);

    // add a nice and smooth animation
    mChart.animateY(2500);
    
    mChart.getLegend().setEnabled(false);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:46,代碼來源:AnotherBarActivity.java

示例8: onCreate

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_barchart);

    tvX = (TextView) findViewById(R.id.tvXMax);
    tvY = (TextView) findViewById(R.id.tvYMax);

    mSeekBarX = (SeekBar) findViewById(R.id.seekBar1);
    mSeekBarX.setOnSeekBarChangeListener(this);

    mSeekBarY = (SeekBar) findViewById(R.id.seekBar2);
    mSeekBarY.setOnSeekBarChangeListener(this);

    mChart = (BarChart) findViewById(R.id.chart1);

    mChart.setDescription("");

    // if more than 60 entries are displayed in the chart, no values will be
    // drawn
    mChart.setMaxVisibleValueCount(60);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawBarShadow(false);
    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setSpaceBetweenLabels(0);
    xAxis.setDrawGridLines(false);
    
    mChart.getAxisLeft().setDrawGridLines(false);

    // setting data
    mSeekBarX.setProgress(10);
    mSeekBarY.setProgress(100);

    // add a nice and smooth animation
    mChart.animateY(2500);
    
    mChart.getLegend().setEnabled(false);

    // Legend l = mChart.getLegend();
    // l.setPosition(LegendPosition.BELOW_CHART_CENTER);
    // l.setFormSize(8f);
    // l.setFormToTextSpace(4f);
    // l.setXEntrySpace(6f);

    // mChart.setDrawLegend(false);
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:55,代碼來源:AnotherBarActivity.java

示例9: onCreateView

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
@Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_stats, container, false);

            // page index
            int pageIndex = getArguments().getInt(ARG_SECTION_NUMBER);

            // init stats for this page
            initStats(pageIndex);

            TextView textView = (TextView) rootView.findViewById(R.id.section_label);

            String playerName;
            if (pageIndex < 2) {
                playerName = getString(R.string.all_players);
            } else {
                playerName = game.getPlayer(pageIndex - 2).getName();
            }

            // fill text using format string template from resource
            textView.setText(getString(
                    R.string.section_format,
                    playerName,
                    createStatsText(pageIndex)
            ));

            // To make vertical bar chart, initialize graph id this way
            barChart = (BarChart) rootView.findViewById(R.id.chart);
            barChart.animateY(1000);
            barChart.getXAxis().setLabelsToSkip(0);
            barChart.setDescription(null);
            barChart.getLegend().setPosition(Legend.LegendPosition.ABOVE_CHART_LEFT);
            barChart.getLegend().setTextSize(14);

            if (pageIndex == 0) {
                // fill chart with stacked bars showing player vs. player
                createBarChartStackedPlayers(barChart);
            } else {
                // fill chart with stacked bars showing single vs. double roll
                createBarChartStacked(barChart);
                // fill chart
//                createBarChart(barChart);
            }

            return rootView;
        }
 
開發者ID:thilo20,項目名稱:MachiKoroPad,代碼行數:48,代碼來源:StatsActivity.java

示例10: onCreateView

import com.github.mikephil.charting.charts.BarChart; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.charts_fragment, container, false);

    TextView month = (TextView) v.findViewById(R.id.current_month);
    long ts = getArguments().getLong(DB.TIMESTAMP);
    month.setText(SDF_MONTH.format(new Date(ts * 1000)));

    // отображение статистики за текущий месяц
    BarChart barChart = (BarChart) v.findViewById(R.id.bar_chart);
    barChart.setDescription("");

    Paint mInfoPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mInfoPaint.setColor(getResources().getColor(R.color.primary));
    mInfoPaint.setTextAlign(Paint.Align.CENTER);
    mInfoPaint.setTextSize(com.github.mikephil.charting.utils.Utils.convertDpToPixel(16f));
    barChart.setPaint(mInfoPaint, Chart.PAINT_INFO);
    barChart.setNoDataText(getString(R.string.charts_no_data));

    barChart.setDrawBarShadow(false);
    barChart.setDrawGridBackground(false);
    barChart.setDrawValueAboveBar(false);

    barChart.setPinchZoom(false);
    barChart.setScaleEnabled(false);
    barChart.setDoubleTapToZoomEnabled(false);

    barChart.getXAxis().disableGridDashedLine();
    barChart.getXAxis().setDrawGridLines(false);
    barChart.getXAxis().setEnabled(false);

    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getAxisLeft().setEnabled(false);

    barChart.getAxisRight().setDrawGridLines(false);
    barChart.getAxisRight().removeAllLimitLines();
    barChart.getAxisRight().setValueFormatter(new FinanceFormatter());

    barChart.getLegend().setEnabled(false);
    barChart.setData(generateMonthlyData());
    // если данных нет, не показывать ось
    barChart.getAxisRight().setEnabled(!barChart.isEmpty());

    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setX(mv.getMeasuredWidth());
    barChart.setMarkerView(mv);


    Utils.log("getYMin = " + barChart.getBarData().getYMin());
    Utils.log("getYMax = " + barChart.getBarData().getYMax());

    barChart.animateY(ANIMATION_TIME);
    return v;
}
 
開發者ID:Sash0k,項目名稱:Thrift-box,代碼行數:55,代碼來源:ChartsFragment.java


注:本文中的com.github.mikephil.charting.charts.BarChart.animateY方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。