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


Java YAxis.setDrawZeroLine方法代码示例

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


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

示例1: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_linechart_noseekbar);

    mChart = (LineChart) findViewById(R.id.chart1);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setGridBackgroundColor(mFillColor);
    mChart.setDrawGridBackground(true);

    mChart.setDrawBorders(true);

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

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

    Legend l = mChart.getLegend();
    l.setEnabled(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(false);

    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setAxisMaximum(900f);
    leftAxis.setAxisMinimum(-250f);
    leftAxis.setDrawAxisLine(false);
    leftAxis.setDrawZeroLine(false);
    leftAxis.setDrawGridLines(false);

    mChart.getAxisRight().setEnabled(false);

    // add data
    setData(100, 60);

    mChart.invalidate();
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:41,代码来源:FilledLineActivity.java

示例2: setupYAxes

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void setupYAxes(BarLineChartBase chart) {
    YAxis y = chart.getAxisLeft();
    y.setDrawZeroLine(true);
    y.setDrawLabels(false);
    y.setDrawGridLines(false);
    y.setDrawAxisLine(false);
    y.setAxisMinimum(0);
    y = chart.getAxisRight();
    y.setDrawZeroLine(true);
    y.setDrawLabels(false);
    y.setDrawGridLines(false);
    y.setDrawAxisLine(false);
    y.setAxisMinimum(0);
}
 
开发者ID:jasonwyatt,项目名称:SQLite-Performance,代码行数:15,代码来源:TestSuiteFragment.java

示例3: init

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
        getDescription().setEnabled(false);
        LimitLine llXAxis = new LimitLine(10f, "Index 10");
        llXAxis.setLineWidth(4f);
        llXAxis.enableDashedLine(10f, 10f, 0f);
        llXAxis.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
        llXAxis.setTextSize(10f);

        XAxis xAxis = getXAxis();
//        xAxis.enableGridDashedLine(10f, 10f, 0f);
        xAxis.setDrawGridLines(false);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setTextColor(Color.GRAY);

        LimitLine ll1 = new LimitLine(80f, "Avg");
        ll1.setLineWidth(1f);
        ll1.enableDashedLine(10f, 10f, 0f);
        ll1.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
        ll1.setTextSize(10f);

        YAxis leftAxis = getAxisLeft();
        leftAxis.removeAllLimitLines();
        leftAxis.addLimitLine(ll1);
        leftAxis.setAxisMaximum(160f);
        leftAxis.setAxisMinimum(0f);
        leftAxis.setDrawGridLines(false);
        leftAxis.setDrawZeroLine(false);
        leftAxis.setTextColor(Color.GRAY);

        leftAxis.setDrawLimitLinesBehindData(true);

        getAxisRight().setEnabled(false);

        Legend l = getLegend();
        l.setForm(Legend.LegendForm.LINE);
    }
 
开发者ID:VidyaSastry,项目名称:Opal-Chat-AnalyticsDashboard,代码行数:37,代码来源:MyLineChart.java

示例4: initTemperatureChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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

示例5: initResistanceChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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

示例6: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_bubblechart);

    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 = (BubbleChart) findViewById(R.id.chart1);
    mChart.getDescription().setEnabled(false);

    mChart.setOnChartValueSelectedListener(this);

    mChart.setDrawGridBackground(false);

    mChart.setTouchEnabled(true);

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

    mChart.setMaxVisibleValueCount(200);
    mChart.setPinchZoom(true);

    mSeekBarX.setProgress(10);
    mSeekBarY.setProgress(50);

    Legend l = mChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(false);
    l.setTypeface(mTfLight);

    YAxis yl = mChart.getAxisLeft();
    yl.setTypeface(mTfLight);
    yl.setSpaceTop(30f);
    yl.setSpaceBottom(30f);
    yl.setDrawZeroLine(false);
    
    mChart.getAxisRight().setEnabled(false);

    XAxis xl = mChart.getXAxis();
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setTypeface(mTfLight);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:55,代码来源:BubbleChartActivity.java

示例7: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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_noseekbar);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setExtraTopOffset(-30f);
    mChart.setExtraBottomOffset(10f);
    mChart.setExtraLeftOffset(70f);
    mChart.setExtraRightOffset(70f);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.getDescription().setEnabled(false);

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

    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setTextColor(Color.LTGRAY);
    xAxis.setTextSize(13f);
    xAxis.setLabelCount(5);
    xAxis.setCenterAxisLabels(true);
    xAxis.setGranularity(1f);

    YAxis left = mChart.getAxisLeft();
    left.setDrawLabels(false);
    left.setSpaceTop(25f);
    left.setSpaceBottom(25f);
    left.setDrawAxisLine(false);
    left.setDrawGridLines(false);
    left.setDrawZeroLine(true); // draw a zero line
    left.setZeroLineColor(Color.GRAY);
    left.setZeroLineWidth(0.7f);
    mChart.getAxisRight().setEnabled(false);
    mChart.getLegend().setEnabled(false);

    // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT
    final List<Data> data = new ArrayList<>();
    data.add(new Data(0f, -224.1f, "12-29"));
    data.add(new Data(1f, 238.5f, "12-30"));
    data.add(new Data(2f, 1280.1f, "12-31"));
    data.add(new Data(3f, -442.3f, "01-01"));
    data.add(new Data(4f, -2280.1f, "01-02"));

    xAxis.setValueFormatter(new IAxisValueFormatter() {
        @Override
        public String getFormattedValue(float value, AxisBase axis) {
            return data.get(Math.min(Math.max((int) value, 0), data.size()-1)).xAxisValue;
        }
    });

    setData(data);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:66,代码来源:BarChartPositiveNegative.java

示例8: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_bubblechart);

    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 = (BubbleChart) findViewById(R.id.chart1);
    mChart.setDescription("");

    tf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");

    mChart.setOnChartValueSelectedListener(this);

    mChart.setDrawGridBackground(false);

    mChart.setTouchEnabled(true);

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

    mChart.setMaxVisibleValueCount(200);
    mChart.setPinchZoom(true);

    mSeekBarX.setProgress(5);
    mSeekBarY.setProgress(50);

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.RIGHT_OF_CHART);
    l.setTypeface(tf);

    YAxis yl = mChart.getAxisLeft();
    yl.setTypeface(tf);
    yl.setSpaceTop(30f);
    yl.setSpaceBottom(30f);
    yl.setDrawZeroLine(false);
    
    mChart.getAxisRight().setEnabled(false);

    XAxis xl = mChart.getXAxis();
    xl.setPosition(XAxis.XAxisPosition.BOTTOM);
    xl.setTypeface(tf);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:54,代码来源:BubbleChartActivity.java

示例9: onCreate

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的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_noseekbar);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    mChart = (BarChart) findViewById(R.id.chart1);
    mChart.setBackgroundColor(Color.WHITE);
    mChart.setExtraTopOffset(-30f);
    mChart.setExtraBottomOffset(10f);
    mChart.setExtraLeftOffset(70f);
    mChart.setExtraRightOffset(70f);

    mChart.setDrawBarShadow(false);
    mChart.setDrawValueAboveBar(true);

    mChart.setDescription("");

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

    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setTypeface(mTf);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setSpaceBetweenLabels(2);
    xAxis.setTextColor(Color.LTGRAY);
    xAxis.setTextSize(13f);

    YAxis left = mChart.getAxisLeft();
    left.setDrawLabels(false);
    left.setStartAtZero(false);
    left.setSpaceTop(25f);
    left.setSpaceBottom(25f);
    left.setDrawAxisLine(false);
    left.setDrawGridLines(false);
    left.setDrawZeroLine(true); // draw a zero line
    left.setZeroLineColor(Color.GRAY);
    left.setZeroLineWidth(0.7f);
    mChart.getAxisRight().setEnabled(false);
    mChart.getLegend().setEnabled(false);

    // THIS IS THE ORIGINAL DATA YOU WANT TO PLOT
    List<Data> data = new ArrayList<>();
    data.add(new Data(0, -224.1f, "12-29"));
    data.add(new Data(1, 238.5f, "12-30"));
    data.add(new Data(2, 1280.1f, "12-31"));
    data.add(new Data(3, -442.3f, "01-01"));
    data.add(new Data(4, -2280.1f, "01-02"));

    setData(data);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:58,代码来源:BarChartPositiveNegative.java

示例10: SetupChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public void SetupChart() {
    lineChart = (LineChart) myLayout.findViewById(R.id.chart);
    lineChart.setDescription("");
    lineChart.setDrawBorders(false);
    lineChart.setNoDataTextDescription("You need to provide data for the chart.");
    lineChart.setDrawGridBackground(false);
    lineChart.setOnChartValueSelectedListener(this);
    lineChart.setTouchEnabled(true);
    lineChart.setDragEnabled(false);
    lineChart.setPinchZoom(false);
    lineChart.setScaleXEnabled(true);
    lineChart.setScaleYEnabled(true);
    lineChart.invalidate();
    LineData data = new LineData();
    data.setValueTextColor(Color.WHITE);
    // add empty data
    lineChart.setData(data);
    // get the legend (only possible after setting data)
    Legend l = lineChart.getLegend();
    l.setEnabled(false);
    // x axis setup
    XAxis xl = lineChart.getXAxis();
    xl.setTextColor(Color.WHITE);
    xl.setDrawGridLines(false);
    xl.setAvoidFirstLastClipping(false);
    xl.setSpaceBetweenLabels(3);
    xl.setEnabled(true);
    xl.setDrawAxisLine(false);
    xl.removeAllLimitLines();
    //right y axis setup
    YAxis rightAxis = lineChart.getAxisRight();
    rightAxis.setEnabled(false);
    //left y axis setup
    YAxis leftAxis = lineChart.getAxisLeft();
    leftAxis.setTextColor(Color.WHITE);
    leftAxis.setLabelCount(6, true);
    leftAxis.setAxisMaxValue(400f);
    leftAxis.setAxisMinValue(0f);
    leftAxis.setDrawGridLines(false);
    leftAxis.setStartAtZero(false);
    leftAxis.setEnabled(true);
    leftAxis.setDrawAxisLine(false);
    leftAxis.setDrawZeroLine(false);
    leftAxis.setGranularityEnabled(false);
    //define min max line
    LimitLine max = new LimitLine(150f);
    max.enableDashedLine(10f, 10f, 0f);
    LimitLine min = new LimitLine(50f);
    min.enableDashedLine(10f, 10f, 0f);
    // reset all limit lines to avoid overlapping lines
    leftAxis.removeAllLimitLines();
    //add min max line
    leftAxis.addLimitLine(max);
    leftAxis.addLimitLine(min);

    lineChart.invalidate();
}
 
开发者ID:LadyViktoria,项目名称:wearDrip,代码行数:58,代码来源:wearDripWatchFace.java

示例11: setYAxisConfig

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
protected void setYAxisConfig(YAxis axis, ReadableMap propMap) {
    if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMaxValue")) {
        axis.setAxisMaxValue((float) propMap.getDouble("axisMaxValue"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "axisMinValue")) {
        axis.setAxisMinValue((float) propMap.getDouble("axisMinValue"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "inverted")) {
        axis.setInverted(propMap.getBoolean("inverted"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceTop")) {
        axis.setSpaceTop((float) propMap.getDouble("spaceTop"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBottom")) {
        axis.setSpaceBottom((float) propMap.getDouble("spaceBottom"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "showOnlyMinMax")) {
        axis.setShowOnlyMinMax(propMap.getBoolean("showOnlyMinMax"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "labelCount")) {
        boolean labelCountForce = false;
        if (BridgeUtils.validate(propMap, ReadableType.Boolean, "labelCountForce")) {
            labelCountForce = propMap.getBoolean("labelCountForce");
        }
        axis.setLabelCount(propMap.getInt("labelCount"), labelCountForce);
    }
    if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
        axis.setPosition(YAxis.YAxisLabelPosition.valueOf(propMap.getString("position")));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "granularity")) {
        axis.setGranularity((float) propMap.getDouble("granularity"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "granularityEnabled")) {
        axis.setGranularityEnabled(propMap.getBoolean("granularityEnabled"));
    }


    // formatting
    if (BridgeUtils.validate(propMap, ReadableType.String, "valueFormatter")) {
        String valueFormatter = propMap.getString("valueFormatter");

        if ("largeValue".equals(valueFormatter)) {
            axis.setValueFormatter(new LargeValueFormatter());
        } else if ("percent".equals(valueFormatter)) {
            axis.setValueFormatter(new PercentFormatter());
        } else {
            axis.setValueFormatter(new CustomFormatter(valueFormatter));
        }
    }

    // TODO docs says the remaining config needs to be applied before setting data. Test it
    // zero line
    if (BridgeUtils.validate(propMap, ReadableType.Map, "zeroLine")) {
        ReadableMap zeroLineConfig = propMap.getMap("zeroLine");

        if (BridgeUtils.validate(zeroLineConfig, ReadableType.Boolean, "enabled")) {
            axis.setDrawZeroLine(zeroLineConfig.getBoolean("enabled"));
        }
        if (BridgeUtils.validate(zeroLineConfig, ReadableType.Number, "lineWidth")) {
            axis.setZeroLineWidth((float) zeroLineConfig.getDouble("lineWidth"));
        }
        if (BridgeUtils.validate(zeroLineConfig, ReadableType.String, "lineColor")) {
            axis.setZeroLineColor(Color.parseColor(zeroLineConfig.getString("lineColor")));
        }
    }
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:67,代码来源:YAxisChartBase.java

示例12: updateLineChart

import com.github.mikephil.charting.components.YAxis; //导入方法依赖的package包/类
public static LineChart updateLineChart(LineChart chart, int max, List<Entry> entries, List<String> xValues)
{
    Resources res = chart.getContext().getResources();

    chart.setDrawBorders(false);

    XAxis xAxis = chart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawAxisLine(false);
    xAxis.setYOffset(32f);
    xAxis.setDrawGridLines(false);
    xAxis.setLabelsToSkip(0);
    xAxis.setTextSize(14);
    xAxis.setTextColor(res.getColor(R.color.mm_warm_grey));
    xAxis.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));

    YAxis yAxis = chart.getAxisLeft();
    yAxis.setDrawAxisLine(false);
    yAxis.setDrawGridLines(false);
    yAxis.setDrawZeroLine(false);
    yAxis.setAxisMaxValue(max + 2);
    yAxis.setAxisMinValue(0);
    yAxis.setShowOnlyMinMax(true);
    yAxis.setTextSize(14);
    yAxis.setTextColor(res.getColor(R.color.mm_warm_grey));
    yAxis.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));

    chart.getAxisRight().setEnabled(false);
    chart.getLegend().setEnabled(false);
    chart.setDescription("");

    LineDataSet set = new LineDataSet(entries, "");
    set.setCircleColor(res.getColor(R.color.mm_colorPrimary));
    set.setCircleRadius(4f);
    set.setDrawCircleHole(false);
    set.setColor(res.getColor(R.color.mm_colorPrimary));
    set.setLineWidth(2f);
    set.setDrawValues(false);

    LineData data = new LineData(xValues, set);
    chart.setData(data);
    chart.setVisibleXRange(0, 7);

    return chart;
}
 
开发者ID:ResearchStack,项目名称:MoleMapperAndroid,代码行数:46,代码来源:TempGraphHelper.java


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