当前位置: 首页>>代码示例>>Java>>正文


Java XAxisPosition类代码示例

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


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

示例1: renderAxisLine

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

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

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

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:XAxisRendererHorizontalBarChart.java

示例2: renderAxisLine

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

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

    mAxisLinePaint.setColor(mXAxis.getAxisLineColor());
    mAxisLinePaint.setStrokeWidth(mXAxis.getAxisLineWidth());
    mAxisLinePaint.setPathEffect(mXAxis.getAxisLineDashPathEffect());

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:XAxisRenderer.java

示例3: renderAxisLine

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

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

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

    if (mXAxis.getPosition() == XAxisPosition.TOP
            || mXAxis.getPosition() == XAxisPosition.TOP_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentTop(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentTop(), mAxisLinePaint);
    }

    if (mXAxis.getPosition() == XAxisPosition.BOTTOM
            || mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE
            || mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {
        c.drawLine(mViewPortHandler.contentLeft(),
                mViewPortHandler.contentBottom(), mViewPortHandler.contentRight(),
                mViewPortHandler.contentBottom(), mAxisLinePaint);
    }
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:26,代码来源:XAxisRenderer.java

示例4: setXAxis

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
/**
 * xAxis config details: https://github.com/PhilJay/MPAndroidChart/wiki/XAxis
 */
@ReactProp(name = "xAxis")
public void setXAxis(Chart chart, ReadableMap propMap) {
    XAxis axis = chart.getXAxis();

    setCommonAxisConfig(chart, axis, propMap);

    if (BridgeUtils.validate(propMap, ReadableType.Number, "labelsToSkip")) {
        axis.setLabelsToSkip(propMap.getInt("labelsToSkip"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Boolean, "avoidFirstLastClipping")) {
        axis.setAvoidFirstLastClipping(propMap.getBoolean("avoidFirstLastClipping"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.Number, "spaceBetweenLabels")) {
        axis.setSpaceBetweenLabels(propMap.getInt("spaceBetweenLabels"));
    }
    if (BridgeUtils.validate(propMap, ReadableType.String, "position")) {
        axis.setPosition(XAxisPosition.valueOf(propMap.getString("position")));
    }
}
 
开发者ID:mskec,项目名称:react-native-mp-android-chart,代码行数:23,代码来源:ChartBaseManager.java

示例5: onCreateView

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
    
    mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
    mChart.getDescription().setEnabled(false);
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);
    mv.setChartView(mChart); // For bounds control
    mChart.setMarker(mv);

    mChart.setDrawGridBackground(false);
    mChart.setData(generateScatterData(6, 10000, 200));
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxisPosition.BOTTOM);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    
    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(tf);
    rightAxis.setDrawGridLines(false);
    
    Legend l = mChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(tf);
    l.setFormSize(14f);
    l.setTextSize(9f);
    
    // increase the space between legend & bottom and legend & content
    l.setYOffset(13f);       
    mChart.setExtraBottomOffset(16f);
    
    return v;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:ScatterChartFrag.java

示例6: onCreate

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_scrollview);

    mChart = (BarChart) findViewById(R.id.chart1);

    mChart.getDescription().setEnabled(false);

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawBarShadow(false);
    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setDrawGridLines(false);

    mChart.getAxisLeft().setDrawGridLines(false);
    
    mChart.getLegend().setEnabled(false);

    setData(10);
    mChart.setFitBars(true);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:ScrollViewActivity.java

示例7: onCreateView

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.frag_simple_scatter, container, false);
    
    mChart = (ScatterChart) v.findViewById(R.id.scatterChart1);
    mChart.setDescription("");
    
    Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),"OpenSans-Light.ttf");
    
    MyMarkerView mv = new MyMarkerView(getActivity(), R.layout.custom_marker_view);

    mChart.setMarkerView(mv);

    mChart.setDrawGridBackground(false);
    mChart.setData(generateScatterData(6, 10000, 200));
    
    XAxis xAxis = mChart.getXAxis();
    xAxis.setEnabled(true);
    xAxis.setPosition(XAxisPosition.BOTTOM);
    
    YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTypeface(tf);
    
    YAxis rightAxis = mChart.getAxisRight();
    rightAxis.setTypeface(tf);
    rightAxis.setDrawGridLines(false);
    
    Legend l = mChart.getLegend();
    l.setWordWrapEnabled(true);
    l.setTypeface(tf);
    l.setFormSize(14f);
    l.setTextSize(9f);
    
    // increase the space between legend & bottom and legend & content
    l.setYOffset(13f);       
    mChart.setExtraBottomOffset(16f);
    
    return v;
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:40,代码来源:ScatterChartFrag.java

示例8: onCreate

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_combined);

        mChart = (CombinedChart) findViewById(R.id.chart1);
        mChart.setDescription("");
        mChart.setBackgroundColor(Color.WHITE);
        mChart.setDrawGridBackground(false);
        mChart.setDrawBarShadow(false);
        
        // draw bars behind lines
        mChart.setDrawOrder(new DrawOrder[] {
                DrawOrder.BAR, DrawOrder.BUBBLE, DrawOrder.CANDLE, DrawOrder.LINE, DrawOrder.SCATTER
        });

        YAxis rightAxis = mChart.getAxisRight();
        rightAxis.setDrawGridLines(false);
        rightAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

        YAxis leftAxis = mChart.getAxisLeft();
        leftAxis.setDrawGridLines(false);
        leftAxis.setAxisMinValue(0f); // this replaces setStartAtZero(true)

        XAxis xAxis = mChart.getXAxis();
        xAxis.setPosition(XAxisPosition.BOTH_SIDED);

        CombinedData data = new CombinedData(mMonths);

        data.setData(generateLineData());
        data.setData(generateBarData());
//        data.setData(generateBubbleData());
//         data.setData(generateScatterData());
//         data.setData(generateCandleData());

        mChart.setData(data);
        mChart.invalidate();
    }
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:41,代码来源:CombinedChartActivity.java

示例9: onCreate

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_scrollview);

    mChart = (BarChart) findViewById(R.id.chart1);

    mChart.setDescription("");

    // scaling can now only be done on x- and y-axis separately
    mChart.setPinchZoom(false);

    mChart.setDrawBarShadow(false);
    mChart.setDrawGridBackground(false);

    XAxis xAxis = mChart.getXAxis();
    xAxis.setPosition(XAxisPosition.BOTTOM);
    xAxis.setLabelsToSkip(0);
    xAxis.setDrawGridLines(false);

    mChart.getAxisLeft().setDrawGridLines(false);
    
    mChart.getLegend().setEnabled(false);

    setData(10);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:29,代码来源:ScrollViewActivity.java

示例10: initVueMeter

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
public void initVueMeter(){
    mChart.setDrawBarShadow(false);
    mChart.setDescription("");
    mChart.setPinchZoom(false);
    mChart.setDrawGridBackground(false);
    mChart.setMaxVisibleValueCount(0);
    mChart.setScaleXEnabled(false); // Disable scaling on the X-axis
    // XAxis parameters: hide all
    XAxis xlv = mChart.getXAxis();
    xlv.setPosition(XAxisPosition.BOTTOM);
    xlv.setDrawAxisLine(false);
    xlv.setDrawGridLines(false);
    xlv.setDrawLabels(false);
    // YAxis parameters (left): main axis for dB values representation
    YAxis ylv = mChart.getAxisLeft();
    ylv.setDrawAxisLine(false);
    ylv.setDrawGridLines(true);
    ylv.setAxisMaxValue(110.f);
    ylv.setStartAtZero(true);
    ylv.setTextColor(Color.WHITE);
    ylv.setGridColor(Color.WHITE);
    ylv.setValueFormatter(new dBValueFormatter());
    // YAxis parameters (right): no axis, hide all
    YAxis yrv = mChart.getAxisRight();
    yrv.setEnabled(false);
    //return true;
}
 
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:28,代码来源:MeasurementActivity.java

示例11: initSpectrumChart

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
public void initSpectrumChart(){
    sChart.setPinchZoom(false);
    sChart.setDoubleTapToZoomEnabled(false);
    sChart.setDrawBarShadow(false);
    sChart.setDescription("");
    sChart.setPinchZoom(false);
    sChart.setDrawGridBackground(false);
    sChart.setHighlightPerTapEnabled(true);
    sChart.setHighlightPerDragEnabled(false);
    sChart.setDrawHighlightArrow(true);
    sChart.setDrawValueAboveBar(true);
    // XAxis parameters: hide all
    XAxis xls = sChart.getXAxis();
    xls.setPosition(XAxisPosition.BOTTOM);
    xls.setDrawAxisLine(true);
    xls.setDrawGridLines(false);
    xls.setLabelRotationAngle(-90);
    xls.setDrawLabels(true);
    xls.setTextColor(Color.WHITE);
    xls.setLabelsToSkip(0);
    // YAxis parameters (left): main axis for dB values representation
    YAxis yls = sChart.getAxisLeft();
    yls.setDrawAxisLine(true);
    yls.setDrawGridLines(true);
    yls.setAxisMaxValue(110.f);
    yls.setStartAtZero(true);
    yls.setTextColor(Color.WHITE);
    yls.setGridColor(Color.WHITE);
    // YAxis parameters (right): no axis, hide all
    YAxis yrs = sChart.getAxisRight();
    yrs.setEnabled(false);
    //return true;
}
 
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:34,代码来源:Results.java

示例12: calculateOffsets

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void calculateOffsets() {

    if (!mCustomViewPortEnabled) {

        float offsetLeft = 0f, offsetRight = 0f, offsetTop = 0f, offsetBottom = 0f;

        calculateLegendOffsets(mOffsetsBuffer);

        offsetLeft += mOffsetsBuffer.left;
        offsetTop += mOffsetsBuffer.top;
        offsetRight += mOffsetsBuffer.right;
        offsetBottom += mOffsetsBuffer.bottom;

        // offsets for y-labels
        if (mAxisLeft.needsOffset()) {
            offsetLeft += mAxisLeft.getRequiredWidthSpace(mAxisRendererLeft
                    .getPaintAxisLabels());
        }

        if (mAxisRight.needsOffset()) {
            offsetRight += mAxisRight.getRequiredWidthSpace(mAxisRendererRight
                    .getPaintAxisLabels());
        }

        if (mXAxis.isEnabled() && mXAxis.isDrawLabelsEnabled()) {

            float xlabelheight = mXAxis.mLabelRotatedHeight + mXAxis.getYOffset();

            // offsets for x-labels
            if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {

                offsetBottom += xlabelheight;

            } else if (mXAxis.getPosition() == XAxisPosition.TOP) {

                offsetTop += xlabelheight;

            } else if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {

                offsetBottom += xlabelheight;
                offsetTop += xlabelheight;
            }
        }

        offsetTop += getExtraTopOffset();
        offsetRight += getExtraRightOffset();
        offsetBottom += getExtraBottomOffset();
        offsetLeft += getExtraLeftOffset();

        float minOffset = Utils.convertDpToPixel(mMinOffset);

        mViewPortHandler.restrainViewPort(
                Math.max(minOffset, offsetLeft),
                Math.max(minOffset, offsetTop),
                Math.max(minOffset, offsetRight),
                Math.max(minOffset, offsetBottom));

        if (mLogEnabled) {
            Log.i(LOG_TAG, "offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop
                    + ", offsetRight: " + offsetRight + ", offsetBottom: " + offsetBottom);
            Log.i(LOG_TAG, "Content: " + mViewPortHandler.getContentRect().toString());
        }
    }

    prepareOffsetMatrix();
    prepareValuePxMatrix();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:69,代码来源:BarLineChartBase.java

示例13: calculateOffsets

import com.github.mikephil.charting.components.XAxis.XAxisPosition; //导入依赖的package包/类
@Override
public void calculateOffsets() {

    float offsetLeft = 0f, offsetRight = 0f, offsetTop = 0f, offsetBottom = 0f;

    calculateLegendOffsets(mOffsetsBuffer);

    offsetLeft += mOffsetsBuffer.left;
    offsetTop += mOffsetsBuffer.top;
    offsetRight += mOffsetsBuffer.right;
    offsetBottom += mOffsetsBuffer.bottom;

    // offsets for y-labels
    if (mAxisLeft.needsOffset()) {
        offsetTop += mAxisLeft.getRequiredHeightSpace(mAxisRendererLeft.getPaintAxisLabels());
    }

    if (mAxisRight.needsOffset()) {
        offsetBottom += mAxisRight.getRequiredHeightSpace(mAxisRendererRight.getPaintAxisLabels());
    }

    float xlabelwidth = mXAxis.mLabelRotatedWidth;

    if (mXAxis.isEnabled()) {

        // offsets for x-labels
        if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {

            offsetLeft += xlabelwidth;

        } else if (mXAxis.getPosition() == XAxisPosition.TOP) {

            offsetRight += xlabelwidth;

        } else if (mXAxis.getPosition() == XAxisPosition.BOTH_SIDED) {

            offsetLeft += xlabelwidth;
            offsetRight += xlabelwidth;
        }
    }

    offsetTop += getExtraTopOffset();
    offsetRight += getExtraRightOffset();
    offsetBottom += getExtraBottomOffset();
    offsetLeft += getExtraLeftOffset();

    float minOffset = Utils.convertDpToPixel(mMinOffset);

    mViewPortHandler.restrainViewPort(
            Math.max(minOffset, offsetLeft),
            Math.max(minOffset, offsetTop),
            Math.max(minOffset, offsetRight),
            Math.max(minOffset, offsetBottom));

    if (mLogEnabled) {
        Log.i(LOG_TAG, "offsetLeft: " + offsetLeft + ", offsetTop: " + offsetTop + ", offsetRight: " +
                offsetRight + ", offsetBottom: "
                + offsetBottom);
        Log.i(LOG_TAG, "Content: " + mViewPortHandler.getContentRect().toString());
    }

    prepareOffsetMatrix();
    prepareValuePxMatrix();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:65,代码来源:HorizontalBarChart.java

示例14: renderAxisLabels

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

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float xoffset = mXAxis.getXOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0,0);

    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() - xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() + xoffset, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentRight() + xoffset, pointF);
        pointF.x = 1.0f;
        pointF.y = 0.5f;
        drawLabels(c, mViewPortHandler.contentLeft() - xoffset, pointF);
    }

    MPPointF.recycleInstance(pointF);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:46,代码来源:XAxisRendererHorizontalBarChart.java

示例15: renderAxisLabels

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

    if (!mXAxis.isEnabled() || !mXAxis.isDrawLabelsEnabled())
        return;

    float yoffset = mXAxis.getYOffset();

    mAxisLabelPaint.setTypeface(mXAxis.getTypeface());
    mAxisLabelPaint.setTextSize(mXAxis.getTextSize());
    mAxisLabelPaint.setColor(mXAxis.getTextColor());

    MPPointF pointF = MPPointF.getInstance(0,0);
    if (mXAxis.getPosition() == XAxisPosition.TOP) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.TOP_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() + yoffset + mXAxis.mLabelRotatedHeight, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);

    } else if (mXAxis.getPosition() == XAxisPosition.BOTTOM_INSIDE) {
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() - yoffset - mXAxis.mLabelRotatedHeight, pointF);

    } else { // BOTH SIDED
        pointF.x = 0.5f;
        pointF.y = 1.0f;
        drawLabels(c, mViewPortHandler.contentTop() - yoffset, pointF);
        pointF.x = 0.5f;
        pointF.y = 0.0f;
        drawLabels(c, mViewPortHandler.contentBottom() + yoffset, pointF);
    }
    MPPointF.recycleInstance(pointF);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:44,代码来源:XAxisRenderer.java


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