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


Java LineChart類代碼示例

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


LineChart類屬於com.github.mikephil.charting.charts包,在下文中一共展示了LineChart類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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.setOnChartValueSelectedListener(this);
        mChart.setDrawGridBackground(false);
        mChart.getDescription().setEnabled(false);

        // add an empty data object
        mChart.setData(new LineData());
//        mChart.getXAxis().setDrawLabels(false);
//        mChart.getXAxis().setDrawGridLines(false);

        mChart.invalidate();
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:DynamicalAddingActivity.java

示例2: prepareInitData

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
private LineDataSet prepareInitData(@NonNull LineChart chart, @NonNull List<Entry> entries) {
    final LineDataSet set = new LineDataSet(entries, "Accuracy");

    set.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    set.setLineWidth(2F);
    set.setDrawCircleHole(false);
    set.setDrawCircles(false);
    set.setHighlightEnabled(false);
    set.setDrawFilled(true);

    final LineData group = new LineData(set);
    group.setDrawValues(false);

    chart.setData(group);

    return set;
}
 
開發者ID:huazhouwang,項目名稱:Synapse,代碼行數:19,代碼來源:TrainedModelViewBinder.java

示例3: initChart

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
/**
 * Initialize the non-data aspects of the line chart
 */
private void initChart(){

    //Initial line Chart for visualization of statistic
    lineChart = (LineChart) findViewById(R.id.LineChart);
    lineChart.setDragEnabled(true);
    lineChart.setScaleEnabled(false);
    lineChart.getAxisRight().setEnabled(false);
    lineChart.getDescription().setEnabled(false);

    YAxis leftAxis = lineChart.getAxisLeft();
    leftAxis.removeAllLimitLines();
    leftAxis.setAxisMaximum(100f);
    leftAxis.setAxisMinimum(0.0f);
    leftAxis.enableGridDashedLine(10f, 10f, 0f);
    leftAxis.setDrawLimitLinesBehindData(true);
}
 
開發者ID:CMPUT301F17T15,項目名稱:CIA,代碼行數:20,代碼來源:SingleStatisticViewActivity.java

示例4: 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_colored_lines);

    mCharts[0] = (LineChart) findViewById(R.id.chart1);
    mCharts[1] = (LineChart) findViewById(R.id.chart2);
    mCharts[2] = (LineChart) findViewById(R.id.chart3);
    mCharts[3] = (LineChart) findViewById(R.id.chart4);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");

    for (int i = 0; i < mCharts.length; i++) {

        LineData data = getData(36, 100);
        data.setValueTypeface(mTf);

        // add some transparency to the color with "& 0x90FFFFFF"
        setupChart(mCharts[i], data, mColors[i % mColors.length]);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:LineChartActivityColored.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_realm_wiki);

    lineChart = (LineChart) findViewById(R.id.lineChart);
    barChart = (BarChart) findViewById(R.id.barChart);
    setup(lineChart);
    setup(barChart);

    lineChart.setExtraBottomOffset(5f);
    barChart.setExtraBottomOffset(5f);

    lineChart.getAxisLeft().setDrawGridLines(false);
    lineChart.getXAxis().setDrawGridLines(false);
    lineChart.getXAxis().setLabelCount(5);
    lineChart.getXAxis().setGranularity(1f);
    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getXAxis().setDrawGridLines(false);
    barChart.getXAxis().setLabelCount(5);
    barChart.getXAxis().setGranularity(1f);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:RealmWikiExample.java

示例6: addDragListenerMarkerMaker

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
private void addDragListenerMarkerMaker(LineChart speedChart) {
    speedChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        @Override
        public void onValueSelected(Entry entry, Highlight h) {
            Long entryX = (long) entry.getX();
            if (timeLocationMap.containsKey(entryX)) {
                clearAllMarkersFromMap();
                LatLng latLng = timeLocationMap.get(entryX);
                mapMarkers.add(googleMap.addMarker(new MarkerOptions().position(latLng)));
            }
        }

        @Override
        public void onNothingSelected() {
            clearAllMarkersFromMap();
        }
    });
}
 
開發者ID:ponewheel,項目名稱:android-ponewheel,代碼行數:19,代碼來源:RideDetailActivity.java

示例7: onCreateView

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_device, container, false);
    mXAxis = (TextView) layout.findViewById(R.id.tvXAxis);
    mYAxis = (TextView) layout.findViewById(R.id.tvYAxis);
    mZAxis = (TextView) layout.findViewById(R.id.tvZAxis);
    mMax = (TextView) layout.findViewById(R.id.tvMax);
    mStart = (Button) layout.findViewById(R.id.bStart);
    mStop = (Button) layout.findViewById(R.id.bStop);
    mExport = (Button) layout.findViewById(R.id.bExport);
    mChart = (LineChart) layout.findViewById(R.id.chart);

    mChart.setDescription(null);
    mChart.setHighlightPerDragEnabled(false);
    mChart.setHighlightPerTapEnabled(false);
    mChart.setPinchZoom(true);
    mChart.getLegend().setDrawInside(true);
    mChart.setExtraTopOffset(10);

    mStart.setOnClickListener(this);
    mStop.setOnClickListener(this);
    mExport.setOnClickListener(this);
    return layout;
}
 
開發者ID:martindisch,項目名稱:SensorTag-Accelerometer,代碼行數:26,代碼來源:DeviceFragment.java

示例8: populateDiagram

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
@BindingAdapter({"bind:items"})
public static void populateDiagram(LineChart view, List<SingleValue> items) {

    if (null == items || items.size() == 0) {
        return;
    }
    List<Entry> entries = new ArrayList<>();
    for (int i = 0; i < items.size(); i++) {
        final SingleValue item = items.get(i);
        final Entry entry = new Entry(i, (float) item.getValue(), item);
        entries.add(entry);
    }
    LineDataSet dataSet = new LineDataSet(entries, view.getContext().getString(R.string.currency_value));
    LineData lineData = new LineData(dataSet);

    formatXAxisLabels(view, items);
    view.setData(lineData);
    view.invalidate();
}
 
開發者ID:krokers,項目名稱:exchange-rates-mvvm,代碼行數:20,代碼來源:LineChartExtensions.java

示例9: 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.setOnChartValueSelectedListener(this);
        mChart.setDrawGridBackground(false);
        mChart.setDescription("");
        
        // add an empty data object
        mChart.setData(new LineData());
//        mChart.getXAxis().setDrawLabels(false);
//        mChart.getXAxis().setDrawGridLines(false);

        mChart.invalidate();
    }
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:20,代碼來源:DynamicalAddingActivity.java

示例10: 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_colored_lines);

    mCharts[0] = (LineChart) findViewById(R.id.chart1);
    mCharts[1] = (LineChart) findViewById(R.id.chart2);
    mCharts[2] = (LineChart) findViewById(R.id.chart3);
    mCharts[3] = (LineChart) findViewById(R.id.chart4);

    mTf = Typeface.createFromAsset(getAssets(), "OpenSans-Bold.ttf");

    LineData data = getData(36, 100);
    data.setValueTypeface(mTf);

    for (int i = 0; i < mCharts.length; i++)
        // add some transparency to the color with "& 0x90FFFFFF"
        setupChart(mCharts[i], data, mColors[i % mColors.length]);
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:22,代碼來源:LineChartActivityColored.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_realm_wiki);

    lineChart = (LineChart) findViewById(R.id.lineChart);
    barChart = (BarChart) findViewById(R.id.barChart);
    setup(lineChart);
    setup(barChart);

    lineChart.setExtraBottomOffset(5f);
    barChart.setExtraBottomOffset(5f);

    lineChart.getAxisLeft().setDrawGridLines(false);
    lineChart.getXAxis().setDrawGridLines(false);
    barChart.getAxisLeft().setDrawGridLines(false);
    barChart.getXAxis().setDrawGridLines(false);
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:21,代碼來源:RealmWikiExample.java

示例12: refreshTemperatureChart

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
public void refreshTemperatureChart(LineChart temperatureChart, MarsI2cControl i2cControl) {
    int[] c = {0,0,0,0};
    float[] tempValues = {i2cControl.getT1(), i2cControl.getT2(), i2cControl.getT3(), i2cControl.getGlobalTemp()};

    for (int i=0;i<4;i++) {

        c[i] = temperatureChart.getLineData().getDataSetByIndex(i).getEntryCount();
        temperatureChart.getLineData().getDataSetByIndex(i).removeFirst();
        temperatureChart.getLineData().getDataSetByIndex(i).addEntry(new Entry(c[i]++ + auxForTemperatureBuffer[i], tempValues[i]));
        auxForTemperatureBuffer[i]++;
    }

    temperatureChart.getLineData().notifyDataChanged();
    temperatureChart.notifyDataSetChanged();
    temperatureChart.invalidate();

}
 
開發者ID:bregydoc,項目名稱:MarsWeatherSimulator,代碼行數:18,代碼來源:ChartsControl.java

示例13: refreshGasesChart

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
public void refreshGasesChart(LineChart gasesChart, MarsI2cControl i2cControl) {
    int[] c = {0,0};
    float[] tempValues = {i2cControl.getO2(), i2cControl.getCo2()};

    for (int i=0;i<2;i++) {

        c[i] = gasesChart.getLineData().getDataSetByIndex(i).getEntryCount();
        gasesChart.getLineData().getDataSetByIndex(i).removeFirst();
        gasesChart.getLineData().getDataSetByIndex(i).addEntry(new Entry(c[i]++ + auxForGasesBuffer[i], tempValues[i]));
        auxForGasesBuffer[i]++;
    }

    gasesChart.getLineData().notifyDataChanged();
    gasesChart.notifyDataSetChanged();
    gasesChart.invalidate();
}
 
開發者ID:bregydoc,項目名稱:MarsWeatherSimulator,代碼行數:17,代碼來源:ChartsControl.java

示例14: chartStyling

import com.github.mikephil.charting.charts.LineChart; //導入依賴的package包/類
@SuppressWarnings("deprecation")
private void chartStyling(LineChart chart) {
    chart.setTouchEnabled(false);
    chart.setDescription("");
    chart.setAutoScaleMinMaxEnabled(false);
    chart.setNoDataTextColor(SettingsActivity.ThemePreferenceFragment.isLight(getContext()) ? Color.BLACK : Color.WHITE);
    YAxis axisRight = chart.getAxisRight();
    axisRight.setEnabled(false);
    chart.getLegend().setEnabled(false);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        chart.setNestedScrollingEnabled(false);
    }

    XAxis xAxis = chart.getXAxis();
    chartXAxisStyling(xAxis);
    YAxis yAxis = chart.getAxisLeft();
    chartYAxisStyling(yAxis);
}
 
開發者ID:DmitryMalkovich,項目名稱:gito-github-client,代碼行數:19,代碼來源:TrafficFragment.java

示例15: 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


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