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


Java YAxis類代碼示例

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


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

示例1: prepareInitData

import com.github.mikephil.charting.components.YAxis; //導入依賴的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: initChart

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

示例3: YAxisRenderer

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
public YAxisRenderer(ViewPortHandler viewPortHandler, YAxis yAxis, Transformer trans) {
    super(viewPortHandler, trans, yAxis);

    this.mYAxis = yAxis;

    if(mViewPortHandler != null) {

        mAxisLabelPaint.setColor(Color.BLACK);
        mAxisLabelPaint.setTextSize(Utils.convertDpToPixel(10f));

        mZeroLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mZeroLinePaint.setColor(Color.GRAY);
        mZeroLinePaint.setStrokeWidth(1f);
        mZeroLinePaint.setStyle(Paint.Style.STROKE);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:YAxisRenderer.java

示例4: getMinimumDistance

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
/**
 * Returns the minimum distance from a touch value (in pixels) to the
 * closest value (in pixels) that is displayed in the chart.
 *
 * @param closestValues
 * @param pos
 * @param axis
 * @return
 */
protected float getMinimumDistance(List<Highlight> closestValues, float pos, YAxis.AxisDependency axis) {

    float distance = Float.MAX_VALUE;

    for (int i = 0; i < closestValues.size(); i++) {

        Highlight high = closestValues.get(i);

        if (high.getAxis() == axis) {

            float tempDistance = Math.abs(getHighlightPos(high) - pos);
            if (tempDistance < distance) {
                distance = tempDistance;
            }
        }
    }

    return distance;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:29,代碼來源:ChartHighlighter.java

示例5: getClosestHighlightByPixel

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
/**
 * Returns the Highlight of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param closestValues        contains two Highlight objects per DataSet closest to the selected x-position (determined by
 *                             rounding up an down)
 * @param x
 * @param y
 * @param axis                 the closest axis
 * @param minSelectionDistance
 * @return
 */
public Highlight getClosestHighlightByPixel(List<Highlight> closestValues, float x, float y,
                                            YAxis.AxisDependency axis, float minSelectionDistance) {

    Highlight closest = null;
    float distance = minSelectionDistance;

    for (int i = 0; i < closestValues.size(); i++) {

        Highlight high = closestValues.get(i);

        if (axis == null || high.getAxis() == axis) {

            float cDistance = getDistance(x, y, high.getXPx(), high.getYPx());

            if (cDistance < distance) {
                closest = high;
                distance = cDistance;
            }
        }
    }

    return closest;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:36,代碼來源:ChartHighlighter.java

示例6: generateLineData

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

示例7: updateTargetArea

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
private void updateTargetArea() {
    YAxis leftAxis = mPlot.getAxisLeft();
    leftAxis.removeAllLimitLines();
    LimitLine limitLineMax = new LimitLine(
            GLUCOSE_TARGET_MAX
    );
    limitLineMax.setLineColor(Color.TRANSPARENT);
    leftAxis.addLimitLine(limitLineMax);

    LimitLine limitLineMin = new LimitLine(
            GLUCOSE_TARGET_MIN,
            getResources().getString(R.string.pref_glucose_target_area)
    );
    limitLineMin.setTextSize(10f);
    limitLineMin.setLineColor(Color.argb(60, 100, 100, 120));
    limitLineMin.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
    leftAxis.addLimitLine(limitLineMin);
}
 
開發者ID:DorianScholz,項目名稱:OpenLibre,代碼行數:19,代碼來源:DataPlotFragment.java

示例8: createSet

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

示例9: initInValidGoNoGoGameLineChart

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
private void initInValidGoNoGoGameLineChart(Activity activity, View view) {
    inValidGoNoGoGamesLineChart = (LineChart) view.findViewById(R.id.line_chart_invalid_gonogogames);
    inValidGoNoGoGamesLineChart.setDescription("");
    String noData = activity.getResources().getString(R.string.no_failures_to_display);
    inValidGoNoGoGamesLineChart.setNoDataText(noData);
    inValidGoNoGoGamesLineChart.setTouchEnabled(false);
    inValidGoNoGoGamesLineChart.setDragEnabled(true);
    inValidGoNoGoGamesLineChart.setScaleEnabled(true);
    inValidGoNoGoGamesLineChart.setPinchZoom(true);
    inValidGoNoGoGamesLineChart.setBackgroundColor(Color.WHITE);
    inValidGoNoGoGamesLineChart.setDrawGridBackground(false);

    YAxis leftAxis = inValidGoNoGoGamesLineChart.getAxisLeft();
    leftAxis.setAxisMinValue(0);

    YAxis righAxis = inValidGoNoGoGamesLineChart.getAxisRight();
    if (righAxis != null)
        righAxis.setEnabled(false);
}
 
開發者ID:lidox,項目名稱:reaction-test,代碼行數:20,代碼來源:BarChartView.java

示例10: moveViewToAnimated

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
/**
 * This will move the left side of the current viewport to the specified x-position
 * and center the viewport to the specified y-position animated.
 * This also refreshes the chart by calling invalidate().
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void moveViewToAnimated(float xIndex, float yValue, YAxis.AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler, xIndex, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
開發者ID:muyoumumumu,項目名稱:QuShuChe,代碼行數:28,代碼來源:BarLineChartBase.java

示例11: generateOrderBarData

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
private BarData generateOrderBarData(List<MarketHistory> historyEntries) {

        SimpleDateFormat format = new SimpleDateFormat("MMM dd", Locale.getDefault());

        int size = historyEntries.size();
        List<BarEntry> entries = new ArrayList<>(size);
        List<String> xAxis = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            MarketHistory history = historyEntries.get(i);
            Date recordDate = new Date(history.getRecordDate());

            xAxis.add(format.format(recordDate));
            entries.add(new BarEntry((float) history.getOrderCount(), i));
        }

        BarDataSet set = new BarDataSet(entries, "Order Count");
        set.setColor(Color.parseColor("#99FF99"));
//        set.setValueTextSize(0f);

        set.setDrawValues(false);

        set.setAxisDependency(YAxis.AxisDependency.RIGHT);
        return new BarData(xAxis, set);
    }
 
開發者ID:w9jds,項目名稱:MarketBot,代碼行數:25,代碼來源:MarketHistoryTab.java

示例12: setup

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
/**
 * 設置字體
 *
 * @param chart
 */
protected void setup(Chart<?> chart) {
    mTy = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf");
    chart.setDescription("");
    chart.setNoDataTextDescription("You need to provide data for the chart.");
    chart.setTouchEnabled(true);
    if (chart instanceof BarLineChartBase) {
        BarLineChartBase mChart = (BarLineChartBase) chart;
        mChart.setDrawGridBackground(false);
        mChart.setDragEnabled(true);
        mChart.setScaleEnabled(true);
        mChart.setPinchZoom(false);
        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.removeAllLimitLines(); // reset all limit lines to avoid overlapping lines
        leftAxis.setTypeface(mTy);
        leftAxis.setTextSize(8f);
        leftAxis.setTextColor(Color.WHITE);
        XAxis xAxis = mChart.getXAxis();
        xAxis.setLabelRotationAngle(-50);//設置x軸字體顯示角度
        xAxis.setTypeface(mTy);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setTextSize(8f);
        xAxis.setTextColor(Color.WHITE);
        mChart.getAxisRight().setEnabled(false);
    }
}
 
開發者ID:dscn,項目名稱:ktball,代碼行數:31,代碼來源:SchoolContActivity.java

示例13: generateLineData

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

示例14: centerViewToAnimated

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
/**
 * This will move the center of the current viewport to the specified
 * x-value and y-value animated.
 *
 * @param xIndex
 * @param yValue
 * @param axis
 * @param duration the duration of the animation in milliseconds
 */
@TargetApi(11)
public void centerViewToAnimated(float xIndex, float yValue, YAxis.AxisDependency axis, long duration) {

    if (android.os.Build.VERSION.SDK_INT >= 11) {

        PointD bounds = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        float valsInView = getDeltaY(axis) / mViewPortHandler.getScaleY();
        float xsInView = getXAxis().getValues().size() / mViewPortHandler.getScaleX();

        Runnable job = new AnimatedMoveViewJob(mViewPortHandler,
                xIndex - xsInView / 2f, yValue + valsInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
開發者ID:muyoumumumu,項目名稱:QuShuChe,代碼行數:29,代碼來源:BarLineChartBase.java

示例15: calcMinMax

import com.github.mikephil.charting.components.YAxis; //導入依賴的package包/類
@Override
protected void calcMinMax() {

    if (mAutoScaleMinMaxEnabled)
        mData.calcMinMax();

    if (mFitBars) {
        mXAxis.calculate(mData.getXMin() - mData.getBarWidth() / 2f, mData.getXMax() + mData.getBarWidth() / 2f);
    } else {
        mXAxis.calculate(mData.getXMin(), mData.getXMax());
    }

    // calculate axis range (min / max) according to provided data
    mAxisLeft.calculate(mData.getYMin(YAxis.AxisDependency.LEFT), mData.getYMax(YAxis.AxisDependency.LEFT));
    mAxisRight.calculate(mData.getYMin(YAxis.AxisDependency.RIGHT), mData.getYMax(YAxis.AxisDependency
            .RIGHT));
}
 
開發者ID:letolab,項目名稱:LETO-Toggl_Android,代碼行數:18,代碼來源:BarChart.java


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