• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AxisDependency类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.mikephil.charting.components.YAxis.AxisDependency的典型用法代码示例。如果您正苦于以下问题:Java AxisDependency类的具体用法?Java AxisDependency怎么用?Java AxisDependency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AxisDependency类属于com.github.mikephil.charting.components.YAxis包,在下文中一共展示了AxisDependency类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: zoomAndCenterAnimated

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Zooms by the specified scale factor to the specified values on the specified axis.
 *
 * @param scaleX
 * @param scaleY
 * @param xValue
 * @param yValue
 * @param axis
 * @param duration
 */
@TargetApi(11)
public void zoomAndCenterAnimated(float scaleX, float scaleY, float xValue, float yValue, AxisDependency axis,
                                  long duration) {

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

        MPPointD origin = getValuesByTouchPoint(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), axis);

        Runnable job = AnimatedZoomJob.getInstance(mViewPortHandler, this, getTransformer(axis), getAxis(axis), mXAxis
                        .mAxisRange, scaleX, scaleY, mViewPortHandler.getScaleX(), mViewPortHandler.getScaleY(),
                xValue, yValue, (float) origin.x, (float) origin.y, duration);
        addViewportJob(job);

        MPPointD.recycleInstance(origin);

    } else {
        Log.e(LOG_TAG, "Unable to execute zoomAndCenterAnimated(...) on API level < 11");
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:BarLineChartBase.java


示例2: moveViewToAnimated

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

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

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

        float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();

        Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler, xValue, yValue + yInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);

        MPPointD.recycleInstance(bounds);
    } else {
        Log.e(LOG_TAG, "Unable to execute moveViewToAnimated(...) on API level < 11");
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:BarLineChartBase.java


示例3: centerViewToAnimated

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

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

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

        float yInView = getAxisRange(axis) / mViewPortHandler.getScaleY();
        float xInView = getXAxis().mAxisRange / mViewPortHandler.getScaleX();

        Runnable job = AnimatedMoveViewJob.getInstance(mViewPortHandler,
                xValue - xInView / 2f, yValue + yInView / 2f,
                getTransformer(axis), this, (float) bounds.x, (float) bounds.y, duration);

        addViewportJob(job);

        MPPointD.recycleInstance(bounds);
    } else {
        Log.e(LOG_TAG, "Unable to execute centerViewToAnimated(...) on API level < 11");
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:BarLineChartBase.java


示例4: onSizeChanged

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {

    // Saving current position of chart.
    mOnSizeChangedBuffer[0] = mOnSizeChangedBuffer[1] = 0;

    if (mKeepPositionOnRotation) {
        mOnSizeChangedBuffer[0] = mViewPortHandler.contentLeft();
        mOnSizeChangedBuffer[1] = mViewPortHandler.contentTop();
        getTransformer(AxisDependency.LEFT).pixelsToValue(mOnSizeChangedBuffer);
    }

    //Superclass transforms chart.
    super.onSizeChanged(w, h, oldw, oldh);

    if (mKeepPositionOnRotation) {

        //Restoring old position of chart.
        getTransformer(AxisDependency.LEFT).pointValuesToPixel(mOnSizeChangedBuffer);
        mViewPortHandler.centerViewPort(mOnSizeChangedBuffer, this);
    } else {
        mViewPortHandler.refresh(mViewPortHandler.getMatrixTouch(), this, true);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:BarLineChartBase.java


示例5: calcMinMax

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Adjusts the current minimum and maximum values based on the provided Entry object.
 *
 * @param e
 * @param axis
 */
protected void calcMinMax(Entry e, AxisDependency axis) {

    if (mYMax < e.getY())
        mYMax = e.getY();
    if (mYMin > e.getY())
        mYMin = e.getY();

    if (mXMax < e.getX())
        mXMax = e.getX();
    if (mXMin > e.getX())
        mXMin = e.getX();

    if (axis == AxisDependency.LEFT) {

        if (mLeftAxisMax < e.getY())
            mLeftAxisMax = e.getY();
        if (mLeftAxisMin > e.getY())
            mLeftAxisMin = e.getY();
    } else {
        if (mRightAxisMax < e.getY())
            mRightAxisMax = e.getY();
        if (mRightAxisMin > e.getY())
            mRightAxisMin = e.getY();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:ChartData.java


示例6: renderAxisLine

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
@Override
public void renderAxisLine(Canvas c) {

    if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
        return;

    mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());

    if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
        c.drawLine(mViewPortHandler.contentLeft(), mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    } else {
        c.drawLine(mViewPortHandler.contentRight(), mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:YAxisRenderer.java


示例7: renderAxisLine

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
@Override
public void renderAxisLine(Canvas c) {

    if (!mYAxis.isEnabled() || !mYAxis.isDrawAxisLineEnabled())
        return;

    mAxisLinePaint.setColor(mYAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mYAxis.getAxisLineWidth());

    if (mYAxis.getAxisDependency() == AxisDependency.LEFT) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    } else {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:YAxisRendererHorizontalBarChart.java


示例8: onValueSelected

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


示例9: createSet

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
private LineDataSet createSet() {

        LineDataSet set = new LineDataSet(null, "Dynamic Data");
        set.setAxisDependency(AxisDependency.LEFT);
        set.setColor(ColorTemplate.getHoloBlue());
        set.setCircleColor(Color.WHITE);
        set.setLineWidth(2f);
        set.setCircleRadius(4f);
        set.setFillAlpha(65);
        set.setFillColor(ColorTemplate.getHoloBlue());
        set.setHighLightColor(Color.rgb(244, 117, 117));
        set.setValueTextColor(Color.WHITE);
        set.setValueTextSize(9f);
        set.setDrawValues(false);
        return set;
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:RealtimeLineChartActivity.java


示例10: calcMinMax

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
protected void calcMinMax(Entry e, AxisDependency axis) {

        if (mYMax < e.getY())
            mYMax = e.getY();
        if (mYMin > e.getY())
            mYMin = e.getY();

        if (mXMax < e.getX())
            mXMax = e.getX();
        if (mXMin > e.getX())
            mXMin = e.getX();

        if (axis == AxisDependency.LEFT) {

            if (mLeftAxisMax < e.getY())
                mLeftAxisMax = e.getY();
            if (mLeftAxisMin > e.getY())
                mLeftAxisMin = e.getY();
        } else {
            if (mRightAxisMax < e.getY())
                mRightAxisMax = e.getY();
            if (mRightAxisMin > e.getY())
                mRightAxisMin = e.getY();
        }
    }
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:26,代码来源:ChartData.java


示例11: getClosestDataSetIndex

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Returns the index of the DataSet that contains the closest value on the
 * y-axis. This is needed for highlighting. This will return -Integer.MAX_VALUE if failure.
 *
 * @param valsAtIndex all the values at a specific index
 * @return
 */
public static int getClosestDataSetIndex(List<SelectionDetail> valsAtIndex, float val,
                                         AxisDependency axis) {

    int index = -Integer.MAX_VALUE;
    float distance = Float.MAX_VALUE;

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

        SelectionDetail sel = valsAtIndex.get(i);

        if (axis == null || sel.dataSet.getAxisDependency() == axis) {

            float cdistance = Math.abs((float) sel.val - val);
            if (cdistance < distance) {
                index = valsAtIndex.get(i).dataSetIndex;
                distance = cdistance;
            }
        }
    }

    return index;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:30,代码来源:Utils.java


示例12: autoScale

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Performs auto scaling of the axis by recalculating the minimum and maximum y-values based on the entries currently in view.
 */
protected void autoScale() {

    final float fromX = getLowestVisibleX();
    final float toX = getHighestVisibleX();

    mData.calcMinMaxY(fromX, toX);

    mXAxis.calculate(mData.getXMin(), mData.getXMax());

    // calculate axis range (min / max) according to provided data
    mAxisLeft.calculate(mData.getYMin(AxisDependency.LEFT), mData.getYMax(AxisDependency.LEFT));
    mAxisRight.calculate(mData.getYMin(AxisDependency.RIGHT), mData.getYMax(AxisDependency
            .RIGHT));

    calculateOffsets();
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:20,代码来源:BarLineChartBase.java


示例13: getClosestDataSetIndex

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Returns the index of the DataSet that contains the closest value on the
 * y-axis. This is needed for highlighting. This will return -Integer.MAX_VALUE if failure.
 * 
 * @param valsAtIndex all the values at a specific index
 * @return
 */
public static int getClosestDataSetIndex(List<SelectionDetail> valsAtIndex, float val,
        AxisDependency axis) {

    int index = -Integer.MAX_VALUE;
    float distance = Float.MAX_VALUE;

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

        SelectionDetail sel = valsAtIndex.get(i);

        if (axis == null || sel.dataSet.getAxisDependency() == axis) {

            float cdistance = Math.abs((float) sel.val - val);
            if (cdistance < distance) {
                index = valsAtIndex.get(i).dataSetIndex;
                distance = cdistance;
            }
        }
    }

    return index;
}
 
开发者ID:xinpengfei520,项目名称:P2P,代码行数:30,代码来源:Utils.java


示例14: moveViewToAnimated

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的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, 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:pencil-box,项目名称:NetKnight,代码行数:28,代码来源:BarLineChartBase.java


示例15: onSizeChanged

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        
    // Saving current position of chart.
    float[] pts = new float[2];
    if (mKeepPositionOnRotation) {
        pts[0] = mViewPortHandler.contentLeft();
        pts[1] = mViewPortHandler.contentTop();
        getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
    }

    //Superclass transforms chart.
    super.onSizeChanged(w, h, oldw, oldh);

    if (mKeepPositionOnRotation) {

        //Restoring old position of chart.
        getTransformer(AxisDependency.LEFT).pointValuesToPixel(pts);
        mViewPortHandler.centerViewPort(pts, this);
    } else {
        mViewPortHandler.refresh(mViewPortHandler.getMatrixTouch(), this, true);
    }
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:24,代码来源:BarLineChartBase.java


示例16: getClosestDataSetIndex

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Returns the index of the DataSet that contains the closest value on the
 * y-axis. This is needed for highlighting. This will return -Integer.MAX_VALUE if failure.
 *
 * @param valsAtIndex all the values at a specific index
 * @return
 */
public static int getClosestDataSetIndex(List<SelectionDetail> valsAtIndex, float val,
                                         AxisDependency axis) {

    int index = -Integer.MAX_VALUE;
    float distance = Float.MAX_VALUE;

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

        SelectionDetail sel = valsAtIndex.get(i);

        if (axis == null || sel.dataSet.getAxisDependency() == axis) {

            float cdistance = Math.abs(sel.val - val);
            if (cdistance < distance) {
                index = valsAtIndex.get(i).dataSetIndex;
                distance = cdistance;
            }
        }
    }

    return index;
}
 
开发者ID:muyoumumumu,项目名称:QuShuChe,代码行数:30,代码来源:Utils.java


示例17: getClosestSelectionDetailByValue

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Returns the SelectionDetail of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param valsAtIndex all the values at a specific index
 * @return
 */
public static SelectionDetail getClosestSelectionDetailByValue(
        List<SelectionDetail> valsAtIndex,
        float value,
        AxisDependency axis) {

    SelectionDetail closest = null;
    float distance = Float.MAX_VALUE;

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

        SelectionDetail sel = valsAtIndex.get(i);

        if (axis == null || sel.dataSet.getAxisDependency() == axis) {

            float cdistance = Math.abs(sel.value - value);
            if (cdistance < distance) {
                closest = sel;
                distance = cdistance;
            }
        }
    }

    return closest;
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:32,代码来源:Utils.java


示例18: getClosestSelectionDetailByPixelY

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
/**
 * Returns the SelectionDetail of the DataSet that contains the closest value on the
 * y-axis.
 *
 * @param valsAtIndex all the values at a specific index
 * @return
 */
public static SelectionDetail getClosestSelectionDetailByPixelY(
        List<SelectionDetail> valsAtIndex,
        float y,
        AxisDependency axis) {

    SelectionDetail closest = null;
    float distance = Float.MAX_VALUE;

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

        SelectionDetail sel = valsAtIndex.get(i);

        if (axis == null || sel.dataSet.getAxisDependency() == axis) {

            float cdistance = Math.abs(sel.y - y);
            if (cdistance < distance) {
                closest = sel;
                distance = cdistance;
            }
        }
    }

    return closest;
}
 
开发者ID:pencil-box,项目名称:NetKnight,代码行数:32,代码来源:Utils.java


示例19: init

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    mYAxis = new YAxis(AxisDependency.LEFT);

    mWebLineWidth = Utils.convertDpToPixel(1.5f);
    mInnerWebLineWidth = Utils.convertDpToPixel(0.75f);

    mRenderer = new RadarChartRenderer(this, mAnimator, mViewPortHandler);
    mYAxisRenderer = new YAxisRendererRadarChart(mViewPortHandler, mYAxis, this);
    mXAxisRenderer = new XAxisRendererRadarChart(mViewPortHandler, mXAxis, this);

    mHighlighter = new RadarHighlighter(this);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:RadarChart.java


示例20: calcMinMax

import com.github.mikephil.charting.components.YAxis.AxisDependency; //导入依赖的package包/类
@Override
protected void calcMinMax() {
    super.calcMinMax();

    mYAxis.calculate(mData.getYMin(AxisDependency.LEFT), mData.getYMax(AxisDependency.LEFT));
    mXAxis.calculate(0, mData.getMaxEntryCountSet().getEntryCount());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:RadarChart.java



注:本文中的com.github.mikephil.charting.components.YAxis.AxisDependency类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Values类代码示例发布时间:2022-05-22
下一篇:
Java ShadowResolveInfo类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap