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


Java Highlight類代碼示例

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


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

示例1: getHighlightByTouchPoint

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the BarChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {

    if (mData == null) {
        Log.e(LOG_TAG, "Can't select by touch. No data set.");
        return null;
    } else {
        Highlight h = getHighlighter().getHighlight(x, y);
        if (h == null || !isHighlightFullBarEnabled()) return h;

        // For isHighlightFullBarEnabled, remove stackIndex
        return new Highlight(h.getX(), h.getY(),
                h.getXPx(), h.getYPx(),
                h.getDataSetIndex(), -1, h.getAxis());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:BarChart.java

示例2: getHighlightByTouchPoint

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
/**
 * Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch
 * point
 * inside the CombinedChart.
 *
 * @param x
 * @param y
 * @return
 */
@Override
public Highlight getHighlightByTouchPoint(float x, float y) {

    if (mData == null) {
        Log.e(LOG_TAG, "Can't select by touch. No data set.");
        return null;
    } else {
        Highlight h = getHighlighter().getHighlight(x, y);
        if (h == null || !isHighlightFullBarEnabled()) return h;

        // For isHighlightFullBarEnabled, remove stackIndex
        return new Highlight(h.getX(), h.getY(),
                h.getXPx(), h.getYPx(),
                h.getDataSetIndex(), -1, h.getAxis());
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:CombinedChart.java

示例3: onSingleTapUp

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
@Override
public boolean onSingleTapUp(MotionEvent e) {

    mLastGesture = ChartGesture.SINGLE_TAP;

    OnChartGestureListener l = mChart.getOnChartGestureListener();

    if (l != null) {
        l.onChartSingleTapped(e);
    }

    if (!mChart.isHighlightPerTapEnabled()) {
        return false;
    }

    Highlight h = mChart.getHighlightByTouchPoint(e.getX(), e.getY());
    performHighlight(h, e);

    return super.onSingleTapUp(e);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:BarLineChartTouchListener.java

示例4: onSingleTapUp

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
@Override
public boolean onSingleTapUp(MotionEvent e) {

    mLastGesture = ChartGesture.SINGLE_TAP;

    OnChartGestureListener l = mChart.getOnChartGestureListener();

    if (l != null) {
        l.onChartSingleTapped(e);
    }

    if(!mChart.isHighlightPerTapEnabled()) {
        return false;
    }

    Highlight high = mChart.getHighlightByTouchPoint(e.getX(), e.getY());
    performHighlight(high, e);

    return true;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:PieRadarChartTouchListener.java

示例5: onValueSelected

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的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: refreshContent

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
@Override
public void refreshContent(Entry e, Highlight highlight) {

    if (e instanceof BarEntry) {

        BarEntry be = (BarEntry) e;

        if(be.getYVals() != null) {

            // draw the stack value
            tvContent.setText("" + Utils.formatNumber(be.getYVals()[highlight.getStackIndex()], 0, true));
        } else {
            tvContent.setText("" + Utils.formatNumber(be.getY(), 0, true));
        }
    } else {

        tvContent.setText("" + Utils.formatNumber(e.getY(), 0, true));
    }

    super.refreshContent(e, highlight);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:StackedBarsMarkerView.java

示例7: onValueSelected

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

示例8: addDragListenerMarkerMaker

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

示例9: refreshContent

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

示例10: onBindViewHolder

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder ) {
    final VerticalBarChartHolder barHolder = (VerticalBarChartHolder) holder;
    barHolder.title.setText(title);
    ChartHelper.setVerticalBarChart(context, barHolder.chart, getChartData(), typeface);
    barHolder.chart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        @Override
        public void onValueSelected(Entry e, Highlight h) {
            if (e == null){
                return;
            }
            barHolder.chart.setDrawMarkers(true);
        }

        @Override
        public void onNothingSelected() {

        }
    });
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:21,代碼來源:VerticalBarChartItem.java

示例11: onBindViewHolder

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder ) {
    final LineChartHolder lineHolder = (LineChartHolder) holder;
    lineHolder.language.setText(title);
    ChartHelper.setLineChart(context, lineHolder.chart, getChartData(), month, typeface);
    lineHolder.chart.setOnChartValueSelectedListener(new OnChartValueSelectedListener() {
        @Override
        public void onValueSelected(Entry e, Highlight h) {
            if (e == null){
                return;
            }
            Timber.d("onValueSelected Selected:%s dataSet:%d", e.toString(), h.getDataSetIndex());
            lineHolder.chart.setDrawMarkers(true);
        }

        @Override
        public void onNothingSelected() {
            Timber.d("Nothing selected.");
        }
    });
}
 
開發者ID:graviton57,項目名稱:DOUSalaries,代碼行數:22,代碼來源:LineChartItem.java

示例12: refreshContent

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

示例13: refreshContent

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的package包/類
@Override
public void refreshContent(Entry e, Highlight highlight) {
    SharedPreferences sharedPrefs = PreferenceManager
            .getDefaultSharedPreferences(tvContent.getContext().getApplicationContext());

    if (e instanceof CandleEntry) {

        CandleEntry ce = (CandleEntry) e;

        tvContent.setText("" + Utils.formatNumber(ce.getHigh(), 0, true));
    } else {
        if(sharedPrefs.getString("pref_unit", "mg/dl").equals("mg/dl")) {
            tvContent.setText("" + Utils.formatNumber(e.getVal(), 0, true));
        }else{
            tvContent.setText("" + Utils.formatNumber(e.getVal(), 1, true));
        }
    }
}
 
開發者ID:CMKlug,項目名稱:Liapp,代碼行數:19,代碼來源:MyMarkerView.java

示例14: onValueSelected

import com.github.mikephil.charting.highlight.Highlight; //導入依賴的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, YAxis.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:bounswe,項目名稱:bounswe2016group2,代碼行數:21,代碼來源:MicroPieChartFragment.java

示例15: onValueSelected

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

    if (e == null)
        return;

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

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

    Log.i("x-index",
            "low: " + mChart.getLowestVisibleXIndex() + ", high: "
                    + mChart.getHighestVisibleXIndex());
}
 
開發者ID:rahulmaddineni,項目名稱:Stayfit,代碼行數:18,代碼來源:BarChartActivity.java


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