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


Java Entry類代碼示例

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


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

示例1: addEntry

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
private void addEntry(String label, int value) {
    LineData data = chart.getData();
    if (data != null) {
        int index;
        if (label.equals(pm1Label)) {
            index = 0;
        } else if (label.equals(pm25Label)) {
            index = 1;
        } else {
            index = 2;
        }
        ILineDataSet set = data.getDataSetByIndex(index);

        if (set == null) {
            set = createSet(label);
            data.addDataSet(set);
        }

        data.addEntry(new Entry(set.getEntryCount(), value), index);
    }
}
 
開發者ID:rjaros87,項目名稱:pm-home-station,代碼行數:22,代碼來源:ChartFragment.java

示例2: buildLineData

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
private LineData buildLineData(List<Entry> seniors, List<Entry> engineer,
                               List<Entry> juniors, String[] jobTitles ){
    List<ILineDataSet> sets = new ArrayList<>();
    if (!seniors.isEmpty()){
        LineDataSet dSenior = buildLineDataSet(seniors, jobTitles[0]);
        sets.add(dSenior);
    }
    if (!engineer.isEmpty()){
        LineDataSet dEngineer = buildLineDataSet(engineer, jobTitles[1]);
        dEngineer.setColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        dEngineer.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[0]);
        sets.add(dEngineer);
    }
    if (!juniors.isEmpty()) {
        LineDataSet dJunior = buildLineDataSet(juniors, jobTitles[2]);
        dJunior.setColor(ColorTemplate.VORDIPLOM_COLORS[2]);
        dJunior.setCircleColor(ColorTemplate.VORDIPLOM_COLORS[2]);
        sets.add(dJunior);//add data
    }
    return  new LineData(sets);
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:22,代碼來源:DataBaseHelper.java

示例3: refreshContent

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
@Override
public void refreshContent(Entry e, Highlight highlight) {
    if (e instanceof CandleEntry) {
        CandleEntry ce = (CandleEntry) e;
        tvContent.setText(getContext().getString(R.string.salaries_format_salary,
                (int) ce.getHigh()));
    } else {
        EntryMarkerData data = (EntryMarkerData) e.getData();
        tvContent.setText(getContext().getString(R.string.exp_format_marker,
                String.valueOf(data.getValue()),
                String.valueOf(data.getCount())
                )
        );
    }
    super.refreshContent(e, highlight);
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:17,代碼來源:ExperienceMarker.java

示例4: getData

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
private LineData getData(ArrayList<Entry> yVals) {
    LineDataSet set1 = new LineDataSet(yVals, "");
    set1.setLineWidth(1.45f);
    set1.setColor(Color.argb(240, 255, 255, 255));
    set1.setCircleColor(Color.WHITE);
    set1.setHighLightColor(Color.WHITE);
    set1.setFillColor(getResources().getColor(R.color.chartFilled));
    set1.setDrawCircles(false);
    set1.setDrawValues(false);
    set1.setDrawFilled(true);
    set1.setFillFormatter(new IFillFormatter() {
        @Override
        public float getFillLinePosition(ILineDataSet dataSet, LineDataProvider dataProvider) {
            return priceChart.getAxisLeft().getAxisMinimum();
        }
    });

    LineData data = new LineData(set1);
    return data;
}
 
開發者ID:manuelsc,項目名稱:Lunary-Ethereum-Wallet,代碼行數:21,代碼來源:FragmentPrice.java

示例5: onValueSelected

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
@SuppressLint("NewApi")
@Override
public void onValueSelected(Entry e, Highlight h) {

    if (e == null)
        return;

    RectF bounds = mOnValueSelectedRectF;
    mChart.getBarBounds((BarEntry) e, bounds);
    MPPointF position = mChart.getPosition(e, AxisDependency.LEFT);

    Log.i("bounds", bounds.toString());
    Log.i("position", position.toString());

    Log.i("x-index",
            "low: " + mChart.getLowestVisibleX() + ", high: "
                    + mChart.getHighestVisibleX());

    MPPointF.recycleInstance(position);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:BarChartActivity.java

示例6: populateDiagram

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

示例7: generateLineData

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

示例8: removeLastEntry

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
private void removeLastEntry() {

        LineData data = mChart.getData();

        if (data != null) {

            ILineDataSet set = data.getDataSetByIndex(0);

            if (set != null) {

                Entry e = set.getEntryForXValue(set.getEntryCount() - 1, Float.NaN);

                data.removeEntry(e, 0);
                // or remove by index
                // mData.removeEntryByXValue(xIndex, dataSetIndex);
                data.notifyDataChanged();
                mChart.notifyDataSetChanged();
                mChart.invalidate();
            }
        }
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:DynamicalAddingActivity.java

示例9: generateScatterData

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
protected ScatterData generateScatterData() {

        ScatterData d = new ScatterData();

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

        for (float index = 0; index < itemcount; index += 0.5f)
            entries.add(new Entry(index + 0.25f, getRandom(10, 55)));

        ScatterDataSet set = new ScatterDataSet(entries, "Scatter DataSet");
        set.setColors(ColorTemplate.MATERIAL_COLORS);
        set.setScatterShapeSize(7.5f);
        set.setDrawValues(false);
        set.setValueTextSize(10f);
        d.addDataSet(set);

        return d;
    }
 
開發者ID:igrow-systems,項目名稱:igrow-android,代碼行數:19,代碼來源:EnvironmentalSensorDetailFragment.java

示例10: refreshContent

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
@Override
public void refreshContent(Entry e, Highlight highlight) {
    String content;
    if (mWhatData == SHOW_FUEL_PRICE_EVOLUTION)
        content = String.format(mCtx.getString(R.string.line_chart_fuel_price_marker_text),
            Utils.numberToString(e.getY(), true, ConstantValues.DECIMALS_PRICE, ConstantValues.ROUNDING_MODE_PRICE),
            Utils.getFormattedDateTime((mChartDates.get((int) e.getX())) * 1000, true));
    else
        content = Utils.numberToString(e.getY(), true, ConstantValues.DECIMALS_FUEL_EFF, ConstantValues.ROUNDING_MODE_FUEL_EFF);

    tvContent.setText(content);

    //resize the marker view.
    //see https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartLib/src/main/java/com/github/mikephil/charting/components/MarkerView.java
    measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
            MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    layout(0, 0, getMeasuredWidth(), getMeasuredHeight());
}
 
開發者ID:mkeresztes,項目名稱:AndiCar,代碼行數:19,代碼來源:LineChartComponent.java

示例11: setData

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

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

        for (int i = 0; i < count; i++) {
            float xVal = (float) (Math.random() * range);
            float yVal = (float) (Math.random() * range);
            entries.add(new Entry(xVal, yVal));
        }

        // sort by x-value
        Collections.sort(entries, new EntryXComparator());

        // create a dataset and give it a type
        LineDataSet set1 = new LineDataSet(entries, "DataSet 1");

        set1.setLineWidth(1.5f);
        set1.setCircleRadius(4f);

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

        // set data
        mChart.setData(data);
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:InvertedLineChartActivity.java

示例12: onValueSelected

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
@SuppressLint("NewApi")
@Override
public void onValueSelected(Entry e, Highlight h) {

    if (e == null)
        return;

    RectF bounds = mOnValueSelectedRectF;
    mChart.getBarBounds((BarEntry) e, bounds);

    MPPointF position = mChart.getPosition(e, mChart.getData().getDataSetByIndex(h.getDataSetIndex())
            .getAxisDependency());

    Log.i("bounds", bounds.toString());
    Log.i("position", position.toString());

    MPPointF.recycleInstance(position);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:HorizontalBarChartActivity.java

示例13: generateCholesterolData

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
private LineData generateCholesterolData() {
    List<String> xVals = new ArrayList<>();
    List<Entry> yVals = new ArrayList<>();

    for (int i = 0; i < presenter.getCholesterolReadings().size(); i++) {
        float val = Float.parseFloat(presenter.getCholesterolReadings().get(i).toString());
        yVals.add(new Entry(val, i));
    }

    xVals.clear();
    for (int i = 0; i < presenter.getCholesterolReadingsDateTime().size(); i++) {
        String date = presenter.convertDate(presenter.getCholesterolReadingsDateTime().get(i));
        xVals.add(date + "");
    }

    // create a data object with the datasets
    return new LineData(xVals,
            generateLineDataSet(yVals, getResources().getColor(R.color.glucosio_fab_cholesterol)));
}
 
開發者ID:adithya321,項目名稱:SOS-The-Healthcare-Companion,代碼行數:20,代碼來源:OverviewFragment.java

示例14: updateBalance

import com.github.mikephil.charting.data.Entry; //導入依賴的package包/類
/**
 *
 * @param balance
 */
public void updateBalance(String balance) {
   // _balanceTxt.setText(balance);
    _lastBalance = balance;
    _walletFragView.updateBalance(balance);

    if(_btcChartEntries != null && !_btcChartEntries.isEmpty()) {
        Entry latestValue = _btcChartEntries.get(_btcChartEntries.size() - 1);
        Double actualBalance = Double.parseDouble(balance);
        Locale locale = new Locale("en", "US");
        NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(locale);

        double conversionValue = actualBalance * latestValue.getY();
        String subBalance = String.format(Locale.getDefault(), "(%s$)", currencyFormatter.format(conversionValue));
        //_subBalanceTxt.setText(subBalance);
        _walletFragView.updateConversion(subBalance);
    }
}
 
開發者ID:ehanoc,項目名稱:xwallet,代碼行數:22,代碼來源:WalletFragment.java

示例15: addDragListenerMarkerMaker

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


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