当前位置: 首页>>代码示例>>Java>>正文


Java LineChart.animateX方法代码示例

本文整理汇总了Java中com.github.mikephil.charting.charts.LineChart.animateX方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.animateX方法的具体用法?Java LineChart.animateX怎么用?Java LineChart.animateX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.mikephil.charting.charts.LineChart的用法示例。


在下文中一共展示了LineChart.animateX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildView

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View buildView(Context context, ViewGroup viewGroup, FragmentManager fragmentManager) {
    this.fragmentManager = fragmentManager;
    LineChart chart = new LineChart(context);
    chart.setDescription(getDescription(context));
    chart.setHighlightEnabled(true);
    chart.setTouchEnabled(true);
    chart.setDragDecelerationFrictionCoef(0.9f);
    chart.setDragEnabled(true);
    chart.setScaleEnabled(true);
    chart.setDrawGridBackground(false);
    chart.setHighlightPerDragEnabled(true);
    chart.setPinchZoom(true);
    chart.animateX(2500);
    chart.animateY(2500);
    viewGroup.addView(chart);
    return chart;
}
 
开发者ID:Tiraza,项目名称:easy-finance,代码行数:19,代码来源:PanelChartBalance.java

示例2: setLineChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
/**
 * Set the line chart pattern
 * @param lineChart chart
 * @param chartData pie chart data
 * @param month data
 * @param typeface Typeface font
 */
public static void setLineChart(Context context, LineChart lineChart, ChartData<?> chartData,
                                final String[] month, Typeface typeface) {
    // apply styling
    lineChart.getDescription().setEnabled(false);
    lineChart.setDrawGridBackground(false);
    // create a custom MarkerView (extend MarkerView) and specify the layout to use for it
    SalaryMarker marker = new SalaryMarker(context, R.layout.marker_salary_detail);
    marker.setChartView(lineChart); // For bounds control
    lineChart.setMarker(marker);
    //fix crash com.github.mikephil.charting.charts.Chart.drawMarkers(Chart.java:731)
    lineChart.setDrawMarkers(false);

    XAxis xAxis = lineChart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setTypeface(typeface);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(true);
    xAxis.setValueFormatter(new LineChartValueFormatter(month));
    xAxis.setLabelCount(month.length / 2, true);//xAxis label count

    YAxis leftAxis = lineChart.getAxisLeft();
    leftAxis.setTypeface(typeface);
    leftAxis.setLabelCount(9, false);
    leftAxis.setAxisMinimum(0f);
    YAxis rightAxis = lineChart.getAxisRight();
    rightAxis.setTypeface(typeface);
    rightAxis.setDrawGridLines(false);
    rightAxis.setAxisMinimum(0f);
    Legend l = lineChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(typeface);
    l.setFormSize(14f);
    l.setTextSize(9f);
    lineChart.setData((LineData) chartData);
    lineChart.animateX(DURATION_SHORT);

}
 
开发者ID:graviton57,项目名称:DOUSalaries,代码行数:45,代码来源:ChartHelper.java

示例3: initTemperatureChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initTemperatureChart(LineChart mChart) {
//        mChart.setOnChartValueSelectedListener(this);
        mChart.setDescription("Skin Temperature");
        mChart.setNoDataTextDescription("You need to provide data for the chart.");
        mChart.setTouchEnabled(true);
        mChart.setDragDecelerationFrictionCoef(0.9f);
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);
        mChart.setDrawGridBackground(false);
        mChart.setHighlightPerDragEnabled(true);
        mChart.setPinchZoom(true);
        mChart.setBackgroundColor(getResources().getColor(R.color.blue_light_pressed));
        mChart.animateX(2500);

        Legend l = mChart.getLegend();
        l.setForm(Legend.LegendForm.LINE);
        l.setTypeface(BandApplication.INSTANCE.getTfLight());
        l.setTextSize(11f);
        l.setTextColor(Color.WHITE);
        l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);

        mChart.getXAxis().setEnabled(false);

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
        leftAxis.setTextColor(Color.RED);
        leftAxis.setDrawGridLines(true);
        leftAxis.setGranularityEnabled(true);

        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
        rightAxis.setTextColor(Color.RED);
        rightAxis.setDrawGridLines(false);
        rightAxis.setDrawZeroLine(false);
        rightAxis.setGranularityEnabled(false);
    }
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:37,代码来源:HeartRateFragment.java

示例4: initResistanceChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initResistanceChart(LineChart mChart) {
    //        mChart.setOnChartValueSelectedListener(this);
    mChart.setDescription("Skin Resistance");
    mChart.setNoDataTextDescription("You need to provide data for the chart.");
    mChart.setTouchEnabled(true);
    mChart.setDragDecelerationFrictionCoef(0.9f);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setDrawGridBackground(false);
    mChart.setHighlightPerDragEnabled(true);
    mChart.setPinchZoom(true);
    mChart.setBackgroundColor(getResources().getColor(R.color.green_pressed));
    mChart.animateX(2500);

    Legend l = mChart.getLegend();
    l.setForm(Legend.LegendForm.LINE);
    l.setTypeface(BandApplication.INSTANCE.getTfLight());
    l.setTextSize(11f);
    l.setTextColor(Color.WHITE);
    l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT);

    mChart.getXAxis().setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    leftAxis.setTextColor(Color.RED);
    leftAxis.setDrawGridLines(true);
    leftAxis.setGranularityEnabled(true);

    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(BandApplication.INSTANCE.getTfLight());
    rightAxis.setTextColor(Color.RED);
    rightAxis.setDrawGridLines(false);
    rightAxis.setDrawZeroLine(false);
    rightAxis.setGranularityEnabled(false);
}
 
开发者ID:qizhenghao,项目名称:Microsoft_Band,代码行数:37,代码来源:HeartRateFragment.java

示例5: setupGraphic

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void setupGraphic(LineChart chart, List<Entry> entries, float axisMinimum, IAxisValueFormatter formatter) {
    LineDataSet dataSet = new LineDataSet(entries, Constants.EMPTY_STRING);
    dataSet.setDrawCircles(false);
    dataSet.setDrawCircleHole(false);
    dataSet.setLineWidth(ResourcesHelper.getDimensionPixelSize(this, R.dimen.half_dp));
    dataSet.setFillColor(getResources().getColor(R.color.colorPrimary));
    dataSet.setDrawFilled(true);
    dataSet.setFillAlpha(Constants.Chart.ALPHA_FILL);
    dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
    dataSet.setColor(getResources().getColor(R.color.colorPrimary));
    dataSet.setDrawValues(false);

    LineData lineData = new LineData(dataSet);

    chart.getDescription().setEnabled(false);
    chart.setTouchEnabled(false);
    chart.getLegend().setEnabled(false);
    chart.getAxisRight().setEnabled(false);

    chart.getXAxis().setDrawLabels(false);
    chart.getXAxis().setDrawGridLines(false);

    chart.getAxisLeft().removeAllLimitLines();
    chart.getAxisLeft().setTextColor(getResources().getColor(R.color.gray));
    chart.getAxisLeft().setAxisMinimum(axisMinimum);
    chart.getAxisLeft().setTextSize(Constants.Chart.LABEL_SIZE);
    chart.getAxisLeft().setValueFormatter(formatter);

    chart.animateX(Constants.Chart.ANIMATION_DURATION, Easing.EasingOption.EaseInSine);

    chart.setData(lineData);
    chart.invalidate();
}
 
开发者ID:santiago-hollmann,项目名称:igcparser,代码行数:34,代码来源:FlightInformationActivity.java

示例6: setupAltitudeChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
protected void setupAltitudeChart(){
    TextView textAltitude = new TextView(this);
    textAltitude.setText("Altitude:");
    textAltitude.setTextColor(getResources().getColor(R.color.hike_blue_grey));
    mAltitudeChartContainer.addView(textAltitude);

    if(mCoordinatesList!=null) {
        int listSize = mCoordinatesList.size();
        if (listSize > 0) {
            mAltitudeChart = new LineChart(this);
            List<Entry> entries = new ArrayList<>(listSize);

            for (int i = 0; i < listSize; i++) {
                entries.add(new Entry((float) mCoordinatesList.get(i).getAltitude(), i));
            }
            LineDataSet altitudePoints = new LineDataSet(entries, "Altitude during Hike");

            mAltitudeChart.setData(new LineData(Collections.nCopies(listSize, ""), altitudePoints));
            mAltitudeChart.setDescription("");
            mAltitudeChart.animateX(3500);
            mAltitudeChart.getAxisLeft().setEnabled(false);
            mAltitudeChart.setTouchEnabled(false);
            mAltitudeChart.setLayoutParams(new LinearLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
            mAltitudeChart.setMinimumHeight(ALTITUDE_CHART_HEIGHT);
            mAltitudeChartContainer.addView(mAltitudeChart);
            mAltitudeChartContainer.setMinimumHeight(ALTITUDE_CHART_HEIGHT);

            return;
        }
    }

    //Else...
    TextView noAltitude = new TextView(this);
    noAltitude.setText("No Altitude Height to Show");
    mAltitudeChartContainer.addView(noAltitude);

}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:40,代码来源:ResultsActivity.java

示例7: setupInstPaceChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
protected void setupInstPaceChart(){
    TextView textInstPace = new TextView(this);
    textInstPace.setText("Pace:");
    textInstPace.setTextColor(getResources().getColor(R.color.hike_blue_grey));
    mInstPaceChartContainer.addView(textInstPace);

    if(mCoordinatesList!=null) {
        int listSize = mCoordinatesList.size();
        if (listSize > 0) {
            mInstPaceChart = new LineChart(this);
            List<Entry> entries = new ArrayList<>(listSize);

            for (int i = 0; i < listSize; i++) {
                //TODO change logic to get the instant pace instead of altidude
                entries.add(new Entry((float) mCoordinatesList.get(i).getAltitude(), i));
            }
            LineDataSet altitudePoints = new LineDataSet(entries, "Pace during Hike");

            mInstPaceChart.setData(new LineData(Collections.nCopies(listSize, ""), altitudePoints));
            mInstPaceChart.setDescription("");
            mInstPaceChart.animateX(3500);
            mInstPaceChart.getAxisLeft().setEnabled(false);
            mInstPaceChart.setTouchEnabled(false);

            mInstPaceChart.setLayoutParams(new LinearLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));
            mInstPaceChart.setMinimumHeight(INST_PACE_CHART_HEIGHT);
            mInstPaceChartContainer.addView(mInstPaceChart);
            mInstPaceChartContainer.setMinimumHeight(INST_PACE_CHART_HEIGHT);

            return;
        }

        //Else...
        TextView noInstaPace = new TextView(this);
        noInstaPace.setText("No Pace to Show");
        mAltitudeChartContainer.addView(noInstaPace);
    }
}
 
开发者ID:foxtrot94,项目名称:DotHike,代码行数:41,代码来源:ResultsActivity.java

示例8: setupChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void setupChart(LineChart chart, LineData data, int color) {

        ((LineDataSet) data.getDataSetByIndex(0)).setCircleColorHole(color);

        // no description text
        chart.getDescription().setEnabled(false);
        
        // mChart.setDrawHorizontalGrid(false);
        //
        // enable / disable grid background
        chart.setDrawGridBackground(false);
//        chart.getRenderer().getGridPaint().setGridColor(Color.WHITE & 0x70FFFFFF);

        // enable touch gestures
        chart.setTouchEnabled(true);

        // enable scaling and dragging
        chart.setDragEnabled(true);
        chart.setScaleEnabled(true);

        // if disabled, scaling can be done on x- and y-axis separately
        chart.setPinchZoom(false);

        chart.setBackgroundColor(color);
        
        // set custom chart offsets (automatic offset calculation is hereby disabled)
        chart.setViewPortOffsets(10, 0, 10, 0);

        // add data
        chart.setData(data);

        // get the legend (only possible after setting data)
        Legend l = chart.getLegend();
        l.setEnabled(false);

        chart.getAxisLeft().setEnabled(false);
        chart.getAxisLeft().setSpaceTop(40);
        chart.getAxisLeft().setSpaceBottom(40);
        chart.getAxisRight().setEnabled(false);

        chart.getXAxis().setEnabled(false);

        // animate calls invalidate()...
        chart.animateX(2500);
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:46,代码来源:LineChartActivityColored.java

示例9: setupChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void setupChart(LineChart chart, LineData data, int color) {
    ((LineDataSet) data.getDataSetByIndex(0)).setCircleColorHole(color);
    chart.getDescription().setEnabled(false);
    chart.setDrawGridBackground(false);
    chart.setTouchEnabled(false);
    chart.setDragEnabled(false);
    chart.setScaleEnabled(true);
    chart.setPinchZoom(false);
    chart.setBackgroundColor(color);
    chart.setViewPortOffsets(0, 23, 0, 0);
    chart.setData(data);
    Legend l = chart.getLegend();
    l.setEnabled(false);

    chart.getAxisLeft().setEnabled(true);
    chart.getAxisLeft().setDrawGridLines(false);
    chart.getAxisLeft().setDrawAxisLine(false);
    chart.getAxisLeft().setSpaceTop(10);
    chart.getAxisLeft().setSpaceBottom(30);
    chart.getAxisLeft().setAxisLineColor(0xFFFFFF);
    chart.getAxisLeft().setTextColor(0xFFFFFF);
    chart.getAxisLeft().setDrawTopYLabelEntry(true);
    chart.getAxisLeft().setLabelCount(10);

    chart.getXAxis().setEnabled(true);
    chart.getXAxis().setDrawGridLines(false);
    chart.getXAxis().setDrawAxisLine(false);
    chart.getXAxis().setAxisLineColor(0xFFFFFF);
    chart.getXAxis().setTextColor(0xFFFFFF);

    Typeface tf = Typeface.DEFAULT;

    // X Axis
    XAxis xAxis = chart.getXAxis();
    xAxis.setTypeface(tf);
    xAxis.removeAllLimitLines();

    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE);

    xAxis.setTextColor(Color.argb(150, 255, 255, 255));

    if (displayType == 1 || displayType == 2) // Week and Month
        xAxis.setValueFormatter(new WeekXFormatter());
    else if (displayType == 0) //  Day
        xAxis.setValueFormatter(new HourXFormatter());
    else
        xAxis.setValueFormatter(new YearXFormatter()); // Year

    // Y Axis
    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.removeAllLimitLines();
    leftAxis.setTypeface(tf);
    leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    leftAxis.setTextColor(Color.argb(150, 255, 255, 255));
    leftAxis.setValueFormatter(new DontShowNegativeFormatter(displayInUsd));
    chart.getAxisRight().setEnabled(false); // Deactivates horizontal lines

    chart.animateX(1300);
    chart.notifyDataSetChanged();
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:61,代码来源:FragmentPrice.java

示例10: onCreate

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_coin_detail);
//        overridePendingTransition(R.anim.right_in, R.anim.stay);
        initToolbar("Coin Details", R.drawable.ic_back_arrow);
        initUserAction("", 0, false);

        Bundle bundle = getIntent().getExtras();

        if (bundle != null) {
            coinTag = bundle.getString(Constants.COIN_TAG, "");
            coinName = bundle.getString(Constants.COIN_NAME, "");
        }

        tvCoinName.setText(coinName);

        mChart = (LineChart) findViewById(R.id.chart);
//        mChart.setPadding(4,4,4,4);

        // FIXME calculate offset for right
        mChart.setViewPortOffsets(6, 30, 90, 60);

        // no description text
        mChart.getDescription().setEnabled(false);
        mChart.setNoDataText("");

        // enable touch gestures
        mChart.setTouchEnabled(true);

        // enable scaling and dragging
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);

        // if disabled, scaling can be done on x- and y-axis separately
        mChart.setPinchZoom(false);

        mChart.setDrawGridBackground(false);
        mChart.setMaxHighlightDistance(300);

        XAxis x = mChart.getXAxis();
        x.setTextColor(ContextCompat.getColor(this, R.color.colorText));
        x.setPosition(XAxis.XAxisPosition.BOTTOM);
        x.setAxisLineColor(Color.TRANSPARENT);
        x.setDrawGridLines(false);
        x.setAxisLineWidth(0f);
        x.setGranularity(1f);
        x.setValueFormatter(new MyXAxisValueFormatter());
        x.setLabelRotationAngle(315);

        YAxis y = mChart.getAxisRight();
//        y.setTypeface();
        y.setLabelCount(6, false);
        y.setTextColor(ContextCompat.getColor(this, R.color.colorText));
        y.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
        y.setDrawGridLines(true);
        y.setAxisLineColor(Color.TRANSPARENT);
        y.setAxisLineWidth(0f);
        y.setValueFormatter(new MyYAxisValueFormatter());

        mChart.getAxisLeft().setEnabled(false);

        // add data
        getCoinDetails(coinTag);

//        setData(45, 100);
        mChart.getLegend().setEnabled(false);
        mChart.animateX(1500);

        // dont forget to refresh the drawing
//        mChart.invalidate();
    }
 
开发者ID:mayuroks,项目名称:Coin-Tracker,代码行数:73,代码来源:CoinDetailsActivity.java

示例11: onCreate

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_coin_details);
        initToolbar("Coin Graph", 0);

        mChart = (LineChart) findViewById(R.id.chart);
        mChart.setBackgroundColor(Color.TRANSPARENT);

        // no description text
        mChart.getDescription().setEnabled(false);

        // enable touch gestures
        mChart.setTouchEnabled(true);

        // enable scaling and dragging
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);

        // if disabled, scaling can be done on x- and y-axis separately
        mChart.setPinchZoom(false);

        mChart.setDrawGridBackground(false);
        mChart.setMaxHighlightDistance(300);

        XAxis x = mChart.getXAxis();
        x.setTextColor(Color.RED);
        x.setPosition(XAxis.XAxisPosition.BOTTOM);
        x.setAxisLineColor(Color.BLUE);
        x.setDrawGridLines(false);
        x.setAxisLineWidth(2f);

        YAxis y = mChart.getAxisRight();
//        y.setTypeface();
        y.setLabelCount(6, false);
        y.setTextColor(Color.RED);
        y.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
        y.setDrawGridLines(false);
        y.setAxisLineColor(Color.BLUE);
        y.setAxisLineWidth(2f);

        mChart.getAxisLeft().setEnabled(false);

        // add data
        setData(45, 100);
        mChart.getLegend().setEnabled(false);
        mChart.animateX(1000);

        // dont forget to refresh the drawing
        mChart.invalidate();

        // TODO Testing
        if (mChart.getData() != null) {
            mChart.getData().setHighlightEnabled(!mChart.getData().isHighlightEnabled());
            mChart.invalidate();
        }
    }
 
开发者ID:mayuroks,项目名称:Coin-Tracker,代码行数:60,代码来源:CubicLineChartActivity.java

示例12: setupChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void setupChart(LineChart chart, LineData data, int color) {

        // no description text
        chart.setDescription("");
        chart.setNoDataTextDescription("You need to provide data for the chart.");
        
        // mChart.setDrawHorizontalGrid(false);
        //
        // enable / disable grid background
        chart.setDrawGridBackground(false);
//        chart.getRenderer().getGridPaint().setGridColor(Color.WHITE & 0x70FFFFFF);

        // enable touch gestures
        chart.setTouchEnabled(true);

        // enable scaling and dragging
        chart.setDragEnabled(true);
        chart.setScaleEnabled(true);

        // if disabled, scaling can be done on x- and y-axis separately
        chart.setPinchZoom(false);

        chart.setBackgroundColor(color);
        
        // set custom chart offsets (automatic offset calculation is hereby disabled)
        chart.setViewPortOffsets(10, 0, 10, 0);

        // add data
        chart.setData(data);

        // get the legend (only possible after setting data)
        Legend l = chart.getLegend();
        l.setEnabled(false);

        chart.getAxisLeft().setEnabled(false);
        chart.getAxisRight().setEnabled(false);

        chart.getXAxis().setEnabled(false);

        // animate calls invalidate()...
        chart.animateX(2500);
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:43,代码来源:LineChartActivityColored.java

示例13: onCreate

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.acitivity_chart);

    mChart = (LineChart) findViewById(R.id.coordinates_chart_cht);

    // if disabled, scaling can be done on x- and y-axis separately
    mChart.setPinchZoom(true);

    // add data
    setData(45, 100);
    mChart.animateX(2500);

    
}
 
开发者ID:talayhan,项目名称:vibeapp,代码行数:17,代码来源:ChartActivity.java

示例14: initStatChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initStatChart() {
    mChart = (LineChart) findViewById(R.id.chart1);

    mChart.setStartAtZero(true);

    // disable the drawing of values into the chart
    mChart.setDrawYValues(false);
    mChart.setDrawXLabels(false);
    mChart.setDrawBorder(false);
    mChart.setBorderPositions(new BarLineChartBase.BorderPosition[] {
            BarLineChartBase.BorderPosition.BOTTOM
    });

    // no description text
    mChart.setNoDataText(getResources().getString(R.string.no_game_data_title));
    mChart.setNoDataTextDescription(getResources().getString(R.string.no_game_data_title_desc));


    // enable value highlighting
    mChart.setHighlightEnabled(true);

    // enable touch gestures
    mChart.setTouchEnabled(true);

    mChart.setDescription("");


    // enable scaling and dragging
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);

    mChart.setPinchZoom(true);

    mChart.setHighlightIndicatorEnabled(false);

    mStatManager = new GameStatManager(getBaseContext());

    mChart.animateX(500);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setValueTextColor(mColor);
    mChart.setDrawLegend(false);

    mChart.setDrawVerticalGrid(false);
    mChart.setDrawGridBackground(false);
    mChart.setGridColor(Color.BLACK & 0x2FFFFFFF);
    mChart.setGridWidth(5f);

    mChart.setBorderColor(mColor);

    YLabels y = mChart.getYLabels();
    y.setTextColor(mColor);
    y.setLabelCount(4);
}
 
开发者ID:furkantektas,项目名称:braingames,代码行数:54,代码来源:StatActivity.java

示例15: onCreateView

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_line, container, false);
    
    mChart = (LineChart) v.findViewById(R.id.lineChart1);
    
    mChart.setDescription("");

    mChart.setDrawGridBackground(false);
    
    mChart.setData(generateLineData());
    mChart.animateX(3000);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    Legend l = mChart.getLegend();
    l.setTypeface(tf);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    leftAxis.setAxisMaxValue(1.2f);
    leftAxis.setAxisMinValue(-1.2f);
    
    mChart.getAxisRight().setEnabled(false);
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);
    
    return v;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:31,代码来源:SineCosineFragment.java


注:本文中的com.github.mikephil.charting.charts.LineChart.animateX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。