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


Java LimitLine类代码示例

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


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

示例1: renderLimitLineLine

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
public void renderLimitLineLine(Canvas c, LimitLine limitLine, float[] position) {
    mLimitLineSegmentsBuffer[0] = position[0];
    mLimitLineSegmentsBuffer[1] = mViewPortHandler.contentTop();
    mLimitLineSegmentsBuffer[2] = position[0];
    mLimitLineSegmentsBuffer[3] = mViewPortHandler.contentBottom();

    mLimitLinePath.reset();
    mLimitLinePath.moveTo(mLimitLineSegmentsBuffer[0], mLimitLineSegmentsBuffer[1]);
    mLimitLinePath.lineTo(mLimitLineSegmentsBuffer[2], mLimitLineSegmentsBuffer[3]);

    mLimitLinePaint.setStyle(Paint.Style.STROKE);
    mLimitLinePaint.setColor(limitLine.getLineColor());
    mLimitLinePaint.setStrokeWidth(limitLine.getLineWidth());
    mLimitLinePaint.setPathEffect(limitLine.getDashPathEffect());

    c.drawPath(mLimitLinePath, mLimitLinePaint);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:XAxisRenderer.java

示例2: updateTargetArea

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

示例3: renderLimitLineLine

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
public void renderLimitLineLine(Canvas c, LimitLine limitLine, float[] position)
{
    mLimitLineSegmentsBuffer[0] = position[0];
    mLimitLineSegmentsBuffer[1] = mViewPortHandler.contentTop();
    mLimitLineSegmentsBuffer[2] = position[0];
    mLimitLineSegmentsBuffer[3] = mViewPortHandler.contentBottom();

    mLimitLinePath.reset();
    mLimitLinePath.moveTo(mLimitLineSegmentsBuffer[0], mLimitLineSegmentsBuffer[1]);
    mLimitLinePath.lineTo(mLimitLineSegmentsBuffer[2], mLimitLineSegmentsBuffer[3]);

    mLimitLinePaint.setStyle(Paint.Style.STROKE);
    mLimitLinePaint.setColor(limitLine.getLineColor());
    mLimitLinePaint.setStrokeWidth(limitLine.getLineWidth());
    mLimitLinePaint.setPathEffect(limitLine.getDashPathEffect());

    c.drawPath(mLimitLinePath, mLimitLinePaint);
}
 
开发者ID:rahulmaddineni,项目名称:Stayfit,代码行数:19,代码来源:XAxisRenderer.java

示例4: BarChartCustom

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
public BarChartCustom(BarChart graphical, ArrayList<BarEntry> entries, String entriesLegend, ArrayList<String> labels, String chartDecription)
{
    this.entries = entries;
    this.chart = graphical;
    this.dataset = new BarDataSet(entries, entriesLegend);
    this.data = new BarData(labels, this.dataset);
    this.colors = new ArrayList<>();
    this.yLeftAxis = chart.getAxisLeft();
    this.yRightAxis = chart.getAxisRight();
    this.xAxis = chart.getXAxis();
    chart.setTouchEnabled(false);
    this.average = new LimitLine(getAverage(), String.format("%1$s : %2$.2f", "Moyenne", getAverage()));
    this.average.setTextSize(10);
    this.average.setLineColor(Color.RED);
    this.average.setLineWidth(1.5f);
    this.yLeftAxis.addLimitLine(average);
    this.average.setEnabled(false);
    this.legend = chart.getLegend();
    if(chartDecription!= null)
        chart.setDescription(chartDecription);
    else chart.setDescription("");
    setDefaultChart();
    setDefaultLegend();
    setDefaultAxes();
}
 
开发者ID:pfiorentino,项目名称:eCarNet,代码行数:26,代码来源:BarChartCustom.java

示例5: renderLimitLines

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
/**
 * Draws the LimitLines associated with this axis to the screen.
 *
 * @param c
 */
@Override
public void renderLimitLines(Canvas c) {

    List<LimitLine> limitLines = mXAxis.getLimitLines();

    if (limitLines == null || limitLines.size() <= 0)
        return;

    float[] position = mRenderLimitLinesBuffer;
    position[0] = 0;
    position[1] = 0;

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

        LimitLine l = limitLines.get(i);

        if (!l.isEnabled())
            continue;

        int clipRestoreCount = c.save();
        mLimitLineClippingRect.set(mViewPortHandler.getContentRect());
        mLimitLineClippingRect.inset(-l.getLineWidth(), 0.f);
        c.clipRect(mLimitLineClippingRect);

        position[0] = l.getLimit();
        position[1] = 0.f;

        mTrans.pointValuesToPixel(position);

        renderLimitLineLine(c, l, position);
        renderLimitLineLabel(c, l, position, 2.f + l.getYOffset());

        c.restoreToCount(clipRestoreCount);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:41,代码来源:XAxisRenderer.java

示例6: prepareChart

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
private void prepareChart() {
    mChart.setTouchEnabled(true);
    mChart.setDragEnabled(true);
    mChart.setScaleEnabled(true);
    mChart.setPinchZoom(true);
    mChart.setHighlightPerTapEnabled(true);
    mChart.setDoubleTapToZoomEnabled(false);
    mChart.setHighlightPerDragEnabled(false);

    mChart.getDescription().setEnabled(false);
    mChart.setDrawGridBackground(false);
    mChart.getLegend().setEnabled(true);
    mChart.getAxisRight().setEnabled(false);
    mChart.setMarker(new AMarkView(this, R.layout.ac_detail_mark_view));

    final YAxis leftAxis = mChart.getAxisLeft();
    leftAxis.setTextColor(ContextCompat.getColor(this, R.color.text_primary));
    leftAxis.setAxisMaximum(1F);
    leftAxis.setDrawGridLines(false);
    leftAxis.setDrawAxisLine(true);

    final LimitLine upLine = new LimitLine(0.9F, "Great");
    upLine.setLineWidth(2F);
    upLine.enableDashedLine(10F, 10F, 10F);
    upLine.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
    upLine.setLineColor(ContextCompat.getColor(this, R.color.divider));
    upLine.setTextColor(ContextCompat.getColor(this, R.color.green$1));

    final LimitLine downLine = new LimitLine(0.5F, "Bad");
    downLine.setLineWidth(2F);
    downLine.enableDashedLine(10F, 10F, 10F);
    downLine.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
    downLine.setLineColor(ContextCompat.getColor(this, R.color.divider));
    downLine.setTextColor(ContextCompat.getColor(this, R.color.pink_$1));

    leftAxis.addLimitLine(upLine);
    leftAxis.addLimitLine(downLine);
}
 
开发者ID:huazhouwang,项目名称:Synapse,代码行数:39,代码来源:ModelDetailActivity.java

示例7: init

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
private void init(Context context, AttributeSet attrs, int defStyle) {
        getDescription().setEnabled(false);
        LimitLine llXAxis = new LimitLine(10f, "Index 10");
        llXAxis.setLineWidth(4f);
        llXAxis.enableDashedLine(10f, 10f, 0f);
        llXAxis.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_BOTTOM);
        llXAxis.setTextSize(10f);

        XAxis xAxis = getXAxis();
//        xAxis.enableGridDashedLine(10f, 10f, 0f);
        xAxis.setDrawGridLines(false);
        xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
        xAxis.setTextColor(Color.GRAY);

        LimitLine ll1 = new LimitLine(80f, "Avg");
        ll1.setLineWidth(1f);
        ll1.enableDashedLine(10f, 10f, 0f);
        ll1.setLabelPosition(LimitLine.LimitLabelPosition.RIGHT_TOP);
        ll1.setTextSize(10f);

        YAxis leftAxis = getAxisLeft();
        leftAxis.removeAllLimitLines();
        leftAxis.addLimitLine(ll1);
        leftAxis.setAxisMaximum(160f);
        leftAxis.setAxisMinimum(0f);
        leftAxis.setDrawGridLines(false);
        leftAxis.setDrawZeroLine(false);
        leftAxis.setTextColor(Color.GRAY);

        leftAxis.setDrawLimitLinesBehindData(true);

        getAxisRight().setEnabled(false);

        Legend l = getLegend();
        l.setForm(Legend.LegendForm.LINE);
    }
 
开发者ID:VidyaSastry,项目名称:Opal-Chat-AnalyticsDashboard,代码行数:37,代码来源:MyLineChart.java

示例8: setHightLimitLine

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
/**
 * 设置高限制线
 *
 * @param high
 * @param name
 */
public void setHightLimitLine(float high, String name, int color) {
    if (name == null) {
        name = "高限制线";
    }
    LimitLine hightLimit = new LimitLine(high, name);
    hightLimit.setLineWidth(4f);
    hightLimit.setTextSize(10f);
    hightLimit.setLineColor(color);
    hightLimit.setTextColor(color);
    leftAxis.addLimitLine(hightLimit);
    mBarChart.invalidate();
}
 
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:19,代码来源:BarChartManager.java

示例9: setLowLimitLine

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
/**
 * 设置低限制线
 *
 * @param low
 * @param name
 */
public void setLowLimitLine(int low, String name) {
    if (name == null) {
        name = "低限制线";
    }
    LimitLine hightLimit = new LimitLine(low, name);
    hightLimit.setLineWidth(4f);
    hightLimit.setTextSize(10f);
    leftAxis.addLimitLine(hightLimit);
    mBarChart.invalidate();
}
 
开发者ID:liuyongfeng90,项目名称:JKCloud,代码行数:17,代码来源:BarChartManager.java

示例10: drawWaveformChart

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
private void drawWaveformChart() {
    final short[] wave = AudioTest.getRecordedWave();
    List<Entry> entries = new ArrayList<>();
    int frameRate = audioTest.getOptimalFrameRate();
    for (int i = 0; i < wave.length; i++) {
        float timeStamp = (float) i / frameRate * 1000f;
        entries.add(new Entry(timeStamp, (float) wave[i]));
    }
    LineDataSet dataSet = new LineDataSet(entries, "Waveform");
    dataSet.setColor(Color.BLACK);
    dataSet.setValueTextColor(Color.BLACK);
    dataSet.setCircleColor(ContextCompat.getColor(getContext(), R.color.DarkGreen));
    dataSet.setCircleRadius(1.5f);
    dataSet.setCircleColorHole(Color.DKGRAY);
    LineData lineData = new LineData(dataSet);
    chart.setData(lineData);

    LimitLine line = new LimitLine(audioTest.getThreshold(), "Threshold");
    line.setLineColor(Color.RED);
    line.setLabelPosition(LimitLine.LimitLabelPosition.LEFT_TOP);
    line.setLineWidth(2f);
    line.setTextColor(Color.DKGRAY);
    line.setTextSize(10f);
    chart.getAxisLeft().addLimitLine(line);

    final Description desc = new Description();
    desc.setText("Wave [digital level -32768 to +32767] vs. Time [ms]");
    desc.setTextSize(12f);
    chart.setDescription(desc);
    chart.getLegend().setEnabled(false);
    chart.invalidate();
    chartLayout.setVisibility(View.VISIBLE);
}
 
开发者ID:google,项目名称:walt,代码行数:34,代码来源:AudioFragment.java

示例11: renderLimitLines

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
/**
 * Draws the LimitLines associated with this axis to the screen.
 *
 * @param c
 */
@Override
public void renderLimitLines(Canvas c) {

    List<LimitLine> limitLines = mXAxis.getLimitLines();

    if (limitLines == null || limitLines.size() <= 0)
        return;

    float[] position = mRenderLimitLinesBuffer;
    position[0] = 0;
    position[1] = 0;

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

        LimitLine l = limitLines.get(i);

        if (!l.isEnabled())
            continue;

        position[0] = l.getLimit();
        position[1] = 0.f;

        mTrans.pointValuesToPixel(position);

        renderLimitLineLine(c, l, position);
        renderLimitLineLabel(c, l, position, 2.f + l.getYOffset());
    }
}
 
开发者ID:letolab,项目名称:LETO-Toggl_Android,代码行数:34,代码来源:XAxisRenderer.java

示例12: addEntries

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
private void addEntries() {
    mTotalStepsChart.setSingleEntryYValue(mSteps.getTotalSteps());
    YAxis stepsPerMinuteCurrentYAxis = mStepsPerMinuteCurrentChart.getAxisLeft();
    int maxStepsPerMinute = mSteps.getMaxStepsPerMinute();
    LimitLine target = new LimitLine(maxStepsPerMinute);
    stepsPerMinuteCurrentYAxis.removeAllLimitLines();
    stepsPerMinuteCurrentYAxis.addLimitLine(target);

    int stepsPerMinute = mSteps.getStepsPerMinute(true);
    mStepsPerMinuteCurrentChart.setSingleEntryYValue(stepsPerMinute);

    if (!addHistoryDataSet(false)) {
        return;
    }

    ChartData data = mStepsPerMinuteHistoryChart.getData();
    data.addXValue("");
    if (stepsPerMinute < 0) {
        stepsPerMinute = 0;
    }
    mHistorySet.addEntry(new Entry(stepsPerMinute, data.getXValCount() - 1));
    int hr = getCurrentHeartRate();
    if (hr < 0) {
        hr = 0;
    }
    mHeartRateSet.addEntry(new Entry(hr, data.getXValCount() - 1));
}
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:28,代码来源:LiveActivityFragment.java

示例13: refreshWeekBeforeSteps

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
private DefaultChartsData refreshWeekBeforeSteps(DBHandler db, CombinedChart combinedChart, Calendar day, GBDevice device) {

        ActivityAnalysis analysis = new ActivityAnalysis();

        day = (Calendar) day.clone(); // do not modify the caller's argument
        day.add(Calendar.DATE, -7);
        List<BarEntry> entries = new ArrayList<>();
        List<String> labels = new ArrayList<>();

        for (int counter = 0; counter < 7; counter++) {
            entries.add(new BarEntry(analysis.calculateTotalSteps(getSamplesOfDay(db, day, device)), counter));
            labels.add(day.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, mLocale));
            day.add(Calendar.DATE, 1);
        }

        BarDataSet set = new BarDataSet(entries, "");
        set.setColor(akActivity.color);

        BarData barData = new BarData(labels, set);
        barData.setValueTextColor(Color.GRAY); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);

        LimitLine target = new LimitLine(mTargetSteps);
        combinedChart.getAxisLeft().removeAllLimitLines();
        combinedChart.getAxisLeft().addLimitLine(target);

        CombinedData combinedData = new CombinedData(labels);
        combinedData.setData(barData);
        return new DefaultChartsData(combinedData);
    }
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:30,代码来源:WeekStepsChartFragment.java

示例14: setChartAverage

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
/**
 * Needs calling chart.invalidate() afterwards
 * @param chart
 * @param data
 * @param average
 */
private void setChartAverage(BarChart chart, DetailsData data, boolean average) {
    YAxis axis = chart.getAxisRight();
    if(axis.getLimitLines().size() > 0) {
        //If line exists remove and make new one
        //(can't simply change value, 3rd party limitation)
        axis.getLimitLines().remove(0);
    }
    if(average) {
        boolean mode = mPresenter.getMode();
        LimitLine line = getChartLimitLine(data.getAverage(mode), data.getAverageLabel(mode));
        axis.addLimitLine(line);
        line.setEnabled(true);
    }
}
 
开发者ID:stanleyguevara,项目名称:beaconradar,代码行数:21,代码来源:DetailsActivity.java

示例15: getChartLimitLine

import com.github.mikephil.charting.components.LimitLine; //导入依赖的package包/类
private LimitLine getChartLimitLine(float value, String label) {
    LimitLine line = new LimitLine(value, label);
    float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
    line.setLineWidth(2f);
    line.enableDashedLine(12f, 12f, 0);
    line.setLabelPosition(LimitLine.LimitLabelPosition.LEFT_BOTTOM);
    line.setTextSize(10 * scaledDensity);
    line.setTextColor(ContextCompat.getColor(this, R.color.text));
    return line;
}
 
开发者ID:stanleyguevara,项目名称:beaconradar,代码行数:11,代码来源:DetailsActivity.java


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