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


Java LineDataSet.setMode方法代碼示例

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


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

示例1: prepareInitData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的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

示例2: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineData generateLineData() {

        LineData d = new LineData();

        ArrayList<Entry> entries = new ArrayList<Entry>();

        for (int index = 0; index < itemcount; index++)
            entries.add(new Entry(index + 0.5f, getRandom(15, 5)));

        LineDataSet set = new LineDataSet(entries, "Line DataSet");
        set.setColor(Color.rgb(240, 238, 70));
        set.setLineWidth(2.5f);
        set.setCircleColor(Color.rgb(240, 238, 70));
        set.setCircleRadius(5f);
        set.setFillColor(Color.rgb(240, 238, 70));
        set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
        set.setDrawValues(true);
        set.setValueTextSize(10f);
        set.setValueTextColor(Color.rgb(240, 238, 70));

        set.setAxisDependency(YAxis.AxisDependency.LEFT);
        d.addDataSet(set);

        return d;
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:CombinedChartActivity.java

示例3: createSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet createSet(String label) {
    LineDataSet set = new LineDataSet(null, label);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    int color;
    if (label.equals(pm1Label)) {
        color = Color.BLUE;
    } else if (label.equals(pm25Label)) {
        color = Color.RED;
    } else {
        color = Color.BLACK;
    }
    set.setColor(color);
    set.setLineWidth(2f);
    set.setDrawValues(false);
    set.setDrawCircles(false);
    set.setMode(LineDataSet.Mode.LINEAR);
    return set;
}
 
開發者ID:rjaros87,項目名稱:pm-home-station,代碼行數:19,代碼來源:ChartFragment.java

示例4: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
 * 曲線
 */
private LineData generateLineData() {
    LineData lineData = new LineData();
    ArrayList<Entry> entries = new ArrayList<>();
    for (int index = 0; index < items.size(); index++) {
        entries.add(new Entry(index + 1f, (float) items.get(index).sub_data.getData()));
    }
    LineDataSet lineDataSet = new LineDataSet(entries, "對比數據");
    lineDataSet.setValues(entries);
    lineDataSet.setDrawValues(false);//是否在線上顯示值
    lineDataSet.setColor(ContextCompat.getColor(mContext, R.color.co3));
    lineDataSet.setLineWidth(2.5f);
    lineDataSet.setCircleColor(ContextCompat.getColor(mContext, R.color.co3));
    lineDataSet.setCircleRadius(5f);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);//設置線條類型
    //set.setDrawHorizontalHighlightIndicator(false);//隱藏選中線
    //set.setDrawVerticalHighlightIndicator(false);//隱藏選中線條
    lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    lineDataSet.setHighlightEnabled(false);
    lineData.setHighlightEnabled(false);
    lineData.addDataSet(lineDataSet);
    return lineData;
}
 
開發者ID:jay16,項目名稱:shengyiplus-android,代碼行數:27,代碼來源:HomeTricsActivity.java

示例5: styleChartLines

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
 * Style char lines (type, color, etc.).
 *
 * @param entries list of entries.
 * @return line data chart.
 */
private LineData styleChartLines(List<Entry> entries) {
    // Set styles
    LineDataSet lineDataSet = new LineDataSet(entries, "Recording");
    lineDataSet.setMode(LineDataSet.Mode.HORIZONTAL_BEZIER);
    lineDataSet.setCubicIntensity(0.2f);
    lineDataSet.setDrawValues(false);
    lineDataSet.setDrawCircles(false);
    lineDataSet.setLineWidth(1.8f);
    lineDataSet.setColor(ContextCompat.getColor(context, R.color.colorAccent));
    if (((int) lineDataSet.getYMax()) != 0) {
        lineDataSet.setDrawFilled(true);
        lineDataSet.setFillAlpha(255);
        // Fix bug with vectors in API < 21
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT){
            Drawable drawable = ResourcesCompat.getDrawable(context.getResources(),
                    R.drawable.chart_fade, null);
            lineDataSet.setFillDrawable(drawable);
        } else{
            lineDataSet.setFillColor(ContextCompat.getColor(context, R.color.colorPrimary));
        }
    }
    return new LineData(lineDataSet);
}
 
開發者ID:davidmigloz,項目名稱:go-bees,代碼行數:30,代碼來源:RecordingsAdapter.java

示例6: generateLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineData generateLineData() {
    LineData d = new LineData();

    ArrayList<Entry> entries = new ArrayList<Entry>();

    for (int index = 0; index < 3; index++)
        entries.add(new Entry(index + 0.5f, UtilsRG.getRandomNumberInRange(0, 1)));

    LineDataSet set = new LineDataSet(entries, "Line DataSet");
    set.setColor(R.color.colorPrimaryLight);
    set.setLineWidth(2.5f);
    set.setCircleColor(R.color.colorPrimaryLight);
    set.setCircleRadius(5f);
    set.setFillColor(R.color.colorPrimaryLight);
    set.setMode(LineDataSet.Mode.CUBIC_BEZIER);
    set.setDrawValues(true);
    set.setValueTextSize(10f);
    set.setValueTextColor(R.color.colorPrimaryLight);

    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    d.addDataSet(set);

    return d;
}
 
開發者ID:lidox,項目名稱:reaction-test,代碼行數:25,代碼來源:BarChartView.java

示例7: setData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private void setData(int count, float range) {

        ArrayList<Entry> yVals = new ArrayList<Entry>();

        for (int i = 0; i < count; i++) {
            float mult = (range + 1);
            float val = (float) (Math.random() * mult) + 3;// + (float)
                                                           // ((mult *
                                                           // 0.1) / 10);
            yVals.add(new Entry(i * 0.001f, val));
        }

        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(yVals, "DataSet 1");
        
        set1.setColor(Color.BLACK);
        set1.setLineWidth(0.5f);
        set1.setDrawValues(false);
        set1.setDrawCircles(false);
        set1.setMode(LineDataSet.Mode.LINEAR);
        set1.setDrawFilled(false);

        // create a data object with the datasets
        LineData data = new LineData(set1);

        // set data
        mChart.setData(data);
        
        // get the legend (only possible after setting data)
        Legend l = mChart.getLegend();
        l.setEnabled(false);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:PerformanceLineChart.java

示例8: formatLineDataSet

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private void formatLineDataSet(LineDataSet set, int color, int width) {
    set.setDrawValues(false);
    set.setDrawHighlightIndicators(false);
    set.setMode(LineDataSet.Mode.LINEAR);

    set.setColor(color);
    set.setLineWidth(width);
    set.setCircleColor(color);
    set.setCircleRadius(width + 2);
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:11,代碼來源:DashboardFragment.java

示例9: setData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private void setData() {
    List<Entry> entries = data.getList();

    for(Entry e: entries){
        Date d= new Date((long) e.getX());
        Log.d(Const.TAG2, "Next Entry is "+d.toString()+" , "+e.getY());
    }

    LineDataSet dataSet = new LineDataSet(entries, "Hourly Weather report");
    dataSet.setColor(Color.rgb(184, 235, 161));
    dataSet.setDrawCircleHole(false);
    dataSet.setCircleColor(Color.CYAN);
    dataSet.setValueTextColor(Color.WHITE);
    dataSet.setValueTextSize(15);
    dataSet.setDrawFilled(true);
    dataSet.setFillColor(Color.LTGRAY);
    dataSet.setDrawValues(true);
    dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
    dataSet.setValueFormatter(new IValueFormatter() {
        @Override
        public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {
            int newValue = (int) value;
            return newValue + Const.DEGREE;
        }
    });

    LineData lineData = new LineData(dataSet);

    lineChart.setData(lineData);
    lineChart.invalidate();//refresh
}
 
開發者ID:shivam301296,項目名稱:True-Weather,代碼行數:32,代碼來源:WeatherGraph.java

示例10: setUpChart

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private boolean setUpChart(@NonNull Model model) {
    final double[] accuracies = model.getAccuracies();

    if (accuracies == null
            || accuracies.length == 0
            || model.getStepEpoch() < 1) {
        return false;
    }

    mAccuracyData.clear();

    for (int i = 0, len = model.getStepEpoch(); i < len; ++i) {
        mAccuracyData.add(new Entry(i + 1, (float) accuracies[i]));
    }

    final LineDataSet set = new LineDataSet(mAccuracyData, getString(R.string.text_chart_left_axis));

    set.setMode(LineDataSet.Mode.LINEAR);
    set.setAxisDependency(YAxis.AxisDependency.LEFT);
    set.setColor(ContextCompat.getColor(this, R.color.chart_left_axis));
    set.setCircleColor(ContextCompat.getColor(this, R.color.chart_left_axis));
    set.setHighLightColor(ContextCompat.getColor(this, R.color.chart_highlight));
    set.setCircleColorHole(Color.WHITE);
    set.setDrawCircleHole(true);
    set.setHighlightEnabled(true);
    set.setLineWidth(2F);
    set.setCircleRadius(3F);
    set.setDrawFilled(false);

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

    setXAxis(model.getEpochs());

    mChart.setData(group);
    mChart.invalidate();
    startChartAnimate();

    return true;
}
 
開發者ID:huazhouwang,項目名稱:Synapse,代碼行數:41,代碼來源:ModelDetailActivity.java

示例11: configureWeatherChart

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的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

示例12: loadData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineData loadData(ChartCard card) {
    // add entries to dataset
    LineDataSet lineDataSet = new LineDataSet(card.entries, null);
    lineDataSet.setMode(LineDataSet.Mode.LINEAR);
    lineDataSet.setDrawValues(false);
    lineDataSet.setDrawCircleHole(false);
    lineDataSet.setColor(card.color);
    lineDataSet.setCircleColor(card.color);
    lineDataSet.setLineWidth(1.8f);
    lineDataSet.setDrawFilled(true);
    lineDataSet.setFillColor(card.color);

    return new LineData(lineDataSet);
}
 
開發者ID:greenhub-project,項目名稱:batteryhub,代碼行數:15,代碼來源:ChartRVAdapter.java

示例13: setupGraphic

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的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

示例14: makeLineData

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
private LineDataSet makeLineData(List<GlucoseData> glucoseDataList) {
    String title = "History";
    if (glucoseDataList.get(0).isTrendData()) title = "Trend";

    LineDataSet lineDataSet = new LineDataSet(new ArrayList<Entry>(), title);
    for (GlucoseData gd : glucoseDataList) {
        float x = convertDateToXAxisValue(gd.getDate());
        float y = gd.glucose();
        lineDataSet.addEntryOrdered(new Entry(x, y));
        /*
        Log.d(LOG_ID, String.format("%s: %s -> %s: %f -> %f",
                title,
                mFormatDateTime.format(new Date(gd.date)),
                mFormatDateTime.format(new Date(convertXAxisValueToDate(x))),
                x,
                y)
        );
        */
    }

    lineDataSet.setAxisDependency(YAxis.AxisDependency.LEFT);
    lineDataSet.setDrawCircles(true);
    lineDataSet.setCircleRadius(2f);

    lineDataSet.setDrawCircleHole(false);
    lineDataSet.setDrawValues(false);

    lineDataSet.setDrawHighlightIndicators(true);

    int baseColor = PLOT_COLORS[mPlotColorIndex % NUM_PLOT_COLORS][0];
    int softColor = Color.argb(150, Color.red(baseColor), Color.green(baseColor), Color.blue(baseColor));
    int hardColor = PLOT_COLORS[mPlotColorIndex % NUM_PLOT_COLORS][1];
    if (glucoseDataList.get(0).isTrendData()) {
        lineDataSet.setColor(hardColor);
        lineDataSet.setLineWidth(2f);

        lineDataSet.setCircleColor(softColor);

        lineDataSet.setMode(LineDataSet.Mode.LINEAR);
    } else {
        lineDataSet.setColor(softColor);
        lineDataSet.setLineWidth(4f);

        lineDataSet.setCircleColor(hardColor);

        lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);
        lineDataSet.setCubicIntensity(0.1f);
    }

    return lineDataSet;
}
 
開發者ID:DorianScholz,項目名稱:OpenLibre,代碼行數:52,代碼來源:DataPlotFragment.java

示例15: setChart1Value

import com.github.mikephil.charting.data.LineDataSet; //導入方法依賴的package包/類
/**
 * Used to display the value from the measure list into the chart
 * @param measures The list of the measure we want to display
 * @param labelName The label we want to display for each value under the graph
 */
private void setChart1Value(List<Measure> measures, String labelName,String dateFormat, CustomRules rule) {


    chart=(LineChart) view.findViewById(R.id.chart_measure);
    if (measures.size()==0)
        return;
    //data for the entry
    List<Entry> dataEntries=new ArrayList<>();

    //get the data based on measure
    for (int k=0;k<measures.size();k++)
    {   //add the entry
        dataEntries.add(new Entry(k,measures.get(k).getValue1().floatValue()));
        //enter the fix value related to the rule
    }
    //add label instead of number in the axis
    chart.notifyDataSetChanged();

    //sort otherwise we will trigger an error
    Collections.sort(dataEntries, new EntryXComparator());
    //add the entry to a data set (data that belong together), it's a line
    LineDataSet dataSet=new LineDataSet(dataEntries,labelName);
    dataSet.setColor(Color.BLUE);
    dataSet.setValueTextColor(Color.BLACK);
    //create a data set for each line

    LineData lineData=new LineData(dataSet);
    chart.setData(lineData);
    //refresh view
    IAxisValueFormatter formatter =new XaxValueFormater(measures,dateFormat);
    //set the gape between value in x axis
    XAxis xAxis = chart.getXAxis();
    xAxis.setGranularity(1f); // minimum axis-step (interval) is 1
    //set the label instead of numner
    xAxis.setValueFormatter(formatter);
    dataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);


    dataSet.setDrawFilled(true);
    dataSet.setFillColor(Color.BLUE);
    //draw the limite of the allowed value
    setLimites(rule);
    chart.getDescription().setEnabled(false);
    chart.invalidate();

}
 
開發者ID:kflauri2312lffds,項目名稱:Android_watch_magpie,代碼行數:52,代碼來源:Fragment_display_measures.java


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