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


Java LineChart.setDrawBorders方法代码示例

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


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

示例1: 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_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: setupChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
/**
 * Setup chart (axis, grid, etc.).
 *
 * @param lineChart      chart to setup.
 * @param data           chart with the data.
 * @param firstTimestamp seconds timestamp of the first record (used as initial reference).
 */
private void setupChart(LineChart lineChart, LineData data, long firstTimestamp) {
    // General setup
    lineChart.setDrawGridBackground(false);
    lineChart.setDrawBorders(false);
    lineChart.setViewPortOffsets(50, 0, 50, 50);
    lineChart.getDescription().setEnabled(false);
    lineChart.getLegend().setEnabled(false);
    lineChart.setTouchEnabled(false);
    lineChart.setNoDataText(context.getString(R.string.no_flight_act_data_available));
    // X axis setup
    IAxisValueFormatter xAxisFormatter = new HourAxisValueFormatter(firstTimestamp);
    XAxis xAxis = lineChart.getXAxis();
    xAxis.setValueFormatter(xAxisFormatter);
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setCenterAxisLabels(false);
    xAxis.setTextColor(ContextCompat.getColor(context, R.color.colorIcons));
    // Y axis setup
    YAxis yAxis = lineChart.getAxisLeft();
    yAxis.setAxisMaximum(40);
    yAxis.setAxisMinimum(0);
    yAxis.setDrawLabels(false);
    yAxis.setDrawAxisLine(false);
    yAxis.setDrawGridLines(true);
    lineChart.getAxisRight().setEnabled(false);
    // Add data
    lineChart.setData(data);
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:37,代码来源:RecordingsAdapter.java

示例3: configureWeatherChart

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
/**
 * Configure styles of weather charts.
 *
 * @param entries   chart data.
 * @param formatter value formatter.
 * @param minVal    min value to show.
 * @param maxVal    max value to show.
 * @return chart formatted.
 */
private LineDataSet configureWeatherChart(
        LineChart chart, int chartName, int colorLineTempChart, int colorFillTempChart,
        List<Entry> entries, IAxisValueFormatter formatter, double minVal, double maxVal) {
    LineDataSet lineDataSet = new LineDataSet(entries, getString(chartName));
    lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
    lineDataSet.setDrawValues(false);
    lineDataSet.setValueTextSize(10f);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setLineWidth(1.8f);
    lineDataSet.setColor(ContextCompat.getColor(getContext(), colorLineTempChart));
    lineDataSet.setLineWidth(2f);
    lineDataSet.setDrawFilled(true);
    lineDataSet.setFillColor(ContextCompat.getColor(getContext(), colorFillTempChart));
    lineDataSet.setFillAlpha(255);
    // General setup
    chart.setDrawGridBackground(false);
    chart.setDrawBorders(false);
    chart.setViewPortOffsets(0, 0, 0, 0);
    chart.getDescription().setEnabled(false);
    chart.getLegend().setEnabled(false);
    chart.setTouchEnabled(false);
    // X axis setup
    XAxis xAxis = chart.getXAxis();
    xAxis.setEnabled(false);
    xAxis.setAxisMinimum(0);
    xAxis.setAxisMaximum(lastTimestamp);
    // Y axis setup
    YAxis leftAxis = chart.getAxisLeft();
    leftAxis.setEnabled(false);
    leftAxis.setAxisMaximum((float) (maxVal));
    leftAxis.setAxisMinimum((float) (minVal));
    YAxis rightAxis = chart.getAxisRight();
    rightAxis.setAxisMaximum((float) (maxVal));
    rightAxis.setAxisMinimum((float) (minVal));
    rightAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART);
    rightAxis.setValueFormatter(formatter);
    return lineDataSet;
}
 
开发者ID:davidmigloz,项目名称:go-bees,代码行数:48,代码来源:RecordingFragment.java

示例4: 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.tide_fragment, container, false);

    // Setup the tide chart
    LineChart tideChart = (LineChart) V.findViewById(R.id.tide_chart);
    tideChart.setDrawBorders(false);
    tideChart.setDescription("");
    tideChart.setPinchZoom(false);
    tideChart.setDoubleTapToZoomEnabled(false);
    tideChart.setDrawMarkerViews(false);
    tideChart.setTouchEnabled(false);
    tideChart.setViewPortOffsets(0f, 0f, 0f, 0f);

    // X Axis
    XAxis xAxis = tideChart.getXAxis();
    xAxis.setDrawGridLines(false);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawLabels(false);

    // Y Axis
    YAxis leftYAxis = tideChart.getAxisLeft();
    YAxis rightYAxis = tideChart.getAxisRight();
    leftYAxis.setDrawGridLines(false);
    rightYAxis.setDrawGridLines(false);
    leftYAxis.setDrawAxisLine(false);
    rightYAxis.setDrawAxisLine(false);
    leftYAxis.setDrawLabels(false);
    rightYAxis.setDrawLabels(false);
    leftYAxis.setDrawZeroLine(false);
    rightYAxis.setDrawZeroLine(false);

    // Legend
    tideChart.getLegend().setEnabled(false);

    return V;
}
 
开发者ID:mpiannucci,项目名称:HackWinds-Android,代码行数:39,代码来源:TideFragment.java

示例5: 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_linechart);

    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 = (LineChart) findViewById(R.id.chart1);
    mChart.setOnChartValueSelectedListener(this);
    
    mChart.setDrawGridBackground(false);
    mChart.getDescription().setEnabled(false);
    mChart.setDrawBorders(false);

    mChart.getAxisLeft().setEnabled(false);
    mChart.getAxisRight().setDrawAxisLine(false);
    mChart.getAxisRight().setDrawGridLines(false);
    mChart.getXAxis().setDrawAxisLine(false);
    mChart.getXAxis().setDrawGridLines(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);

    mSeekBarX.setProgress(20);
    mSeekBarY.setProgress(100);

    Legend l = mChart.getLegend();
    l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
    l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
    l.setOrientation(Legend.LegendOrientation.VERTICAL);
    l.setDrawInside(false);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:49,代码来源:MultiLineChartActivity.java

示例6: 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_linechart);

    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 = (LineChart) findViewById(R.id.chart1);
    mChart.setOnChartValueSelectedListener(this);
    
    mChart.setDrawGridBackground(false);
    mChart.setDescription("");
    mChart.setDrawBorders(false);

    mChart.getAxisLeft().setDrawAxisLine(false);
    mChart.getAxisLeft().setDrawGridLines(false);
    mChart.getAxisRight().setDrawAxisLine(false);
    mChart.getAxisRight().setDrawGridLines(false);
    mChart.getXAxis().setDrawAxisLine(false);
    mChart.getXAxis().setDrawGridLines(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);

    mSeekBarX.setProgress(20);
    mSeekBarY.setProgress(100);

    Legend l = mChart.getLegend();
    l.setPosition(LegendPosition.RIGHT_OF_CHART);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:47,代码来源:MultiLineChartActivity.java

示例7: SetupChart

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

示例8: updateLineChart

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

示例9: initializeViews

import com.github.mikephil.charting.charts.LineChart; //导入方法依赖的package包/类
private void initializeViews() {
    titleTextView = (TextView) findViewById(R.id.view_chart_line_title);
    titleTextView.setText(titleText);
    titleTextView.setTextColor(titleTextColor);
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, titleTextSize);
    titleTextView.setTypeface(Typeface.create(titleTextTypeface, Typeface.NORMAL));

    expand = (ImageView) findViewById(R.id.view_chart_line_expand);
    if (expandTintColor != 0) {
        Drawable drawable = expand.getDrawable();
        drawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTint(drawable, expandTintColor);
        expand.setImageDrawable(drawable);
    }

    chart = (LineChart) findViewById(R.id.view_chart_line);
    chart.getLegend().setEnabled(false);
    chart.setDescription("");
    chart.setDrawBorders(false);
    chart.setDrawGridBackground(false);
    chart.setPinchZoom(false);
    chart.setTouchEnabled(true);
    chart.setDragEnabled(true);
    chart.setExtraLeftOffset(0);
    chart.setExtraBottomOffset(8);
    chart.setExtraTopOffset(0);

    XAxis xAxis = chart.getXAxis();
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    xAxis.setDrawAxisLine(false);
    xAxis.setDrawGridLines(false);
    xAxis.setLabelsToSkip(0);
    xAxis.setXOffset(16);
    xAxis.setTextSize(chartXAxisTextSize);
    xAxis.setTextColor(chartXAxisTextColor);
    xAxis.setTypeface(Typeface.create(chartXAxisTextTypeface, Typeface.NORMAL));

    YAxis yAxisLeft = chart.getAxisLeft();
    yAxisLeft.setDrawAxisLine(false);
    yAxisLeft.setDrawGridLines(false);
    yAxisLeft.setDrawZeroLine(false);
    yAxisLeft.setDrawLabels(true);
    yAxisLeft.setShowOnlyMinMax(true);
    yAxisLeft.setXOffset(16);
    yAxisLeft.setTextSize(chartYAxisTextSize);
    yAxisLeft.setTextColor(chartYAxisTextColor);
    yAxisLeft.setTypeface(Typeface.create(chartYAxisTextTypeface, Typeface.NORMAL));

    YAxis yAxisRight = chart.getAxisRight();
    yAxisRight.setDrawAxisLine(false);
    yAxisRight.setDrawGridLines(false);
    yAxisRight.setDrawZeroLine(false);
    yAxisRight.setDrawLabels(false);
    yAxisRight.setSpaceTop(0);
}
 
开发者ID:ResearchStack,项目名称:ResearchStack,代码行数:56,代码来源:LineChartCard.java


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