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


Java PointValue.setLabel方法代码示例

本文整理汇总了Java中lecho.lib.hellocharts.model.PointValue.setLabel方法的典型用法代码示例。如果您正苦于以下问题:Java PointValue.setLabel方法的具体用法?Java PointValue.setLabel怎么用?Java PointValue.setLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lecho.lib.hellocharts.model.PointValue的用法示例。


在下文中一共展示了PointValue.setLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCalibrationsLine

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@NonNull
public Line getCalibrationsLine(List<Calibration> calibrations, int color) {
    List<PointValue> values = new ArrayList<PointValue>();
    for (Calibration calibration : calibrations) {
        PointValue point = new PointValue((float)calibration.estimate_raw_at_time_of_calibration, (float)calibration.bg);
        String time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long)calibration.raw_timestamp));
        point.setLabel(time.toCharArray());
        values.add(point);
    }

    Line line = new Line(values);
    line.setColor(color);
    line.setHasLines(false);
    line.setPointRadius(4);
    line.setHasPoints(true);
    line.setHasLabels(true);
    return line;
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:xDrip-Experimental,代码行数:19,代码来源:CalibrationGraph.java

示例2: getMeetingDurationPointValue

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private static PointValue getMeetingDurationPointValue(Meeting meeting) {
    String duration = DateUtils.formatElapsedTime(meeting.getDuration());
    PointValue point = new PointValue();
    point.set(meeting.getStartDate(), (float) meeting.getDuration() / (60));
    point.setLabel(duration);
    return point;
}
 
开发者ID:caarmen,项目名称:scrumchatter,代码行数:8,代码来源:MeetingDurationLineChart.java

示例3: getCalibrationsLine

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@NonNull
public List<Line> getCalibrationsLine(List<Calibration> calibrations, int color) {
    if (calibrations == null) return new ArrayList<>();
    List<PointValue> values = new ArrayList<PointValue>();
    List<PointValue> valuesb = new ArrayList<PointValue>();
    List<PointValue> valuesc = new ArrayList<PointValue>();
    for (Calibration calibration : calibrations) {
        if (calibration.estimate_raw_at_time_of_calibration > end_x) {
            end_x = calibration.estimate_raw_at_time_of_calibration;
        }
        PointValue point = new PointValue((float) calibration.estimate_raw_at_time_of_calibration,
                doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
        PointValue pointb = new PointValue((float) calibration.raw_value,
                doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
        PointValue pointc = new PointValue((float) calibration.adjusted_raw_value,
                doMgdl ? (float) calibration.bg : ((float) calibration.bg) * (float) Constants.MGDL_TO_MMOLL);
        String time;
        if (show_days_since) {
            final int days_ago = daysAgo(calibration.raw_timestamp);
            time = (days_ago > 0) ? Integer.toString(days_ago) + "d  " : "";
            time = time + (JoH.hourMinuteString(calibration.raw_timestamp));
        } else {
            time = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date((long) calibration.raw_timestamp));
        }
        point.setLabel(time);
        values.add(point);

        // extra points showing real raw and age_adjusted raw for each calbration point

        valuesb.add(pointb);
        valuesc.add(pointc);
    }


    Line line = new Line(values);
    line.setColor(color);
    line.setHasLines(false);
    line.setPointRadius(4);
    line.setHasPoints(true);
    line.setHasLabels(true);

    List<Line> lines = new ArrayList<>();
    lines.add(line);

    if (Pref.getBooleanDefaultFalse("engineering_mode")) {

        // actual raw
        Line lineb = new Line(valuesb);
        lineb.setColor(Color.RED);
        lineb.setHasLines(false);
        lineb.setPointRadius(1);
        lineb.setHasPoints(true);
        lineb.setHasLabels(false);

        // age adjusted raw
        Line linec = new Line(valuesc);
        linec.setColor(Color.YELLOW);
        linec.setHasLines(false);
        linec.setPointRadius(1);
        linec.setHasPoints(true);
        linec.setHasLabels(false);

        lines.add(lineb);
        lines.add(linec);
    }
    return lines;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:68,代码来源:CalibrationGraph.java

示例4: updateChart

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void updateChart(Cursor data) {

        List<AxisValue> axisValuesX = new ArrayList<>();
        List<PointValue> pointValues = new ArrayList<>();

        int counter = -1;
        do {
            counter++;

            String date = data.getString(data.getColumnIndex(
                    QuoteHistoricalDataColumns.DATE));
            String bidPrice = data.getString(data.getColumnIndex(
                    QuoteHistoricalDataColumns.BIDPRICE));

            // We have to show chart in right order.
            int x = data.getCount() - 1 - counter;

            // Point for line chart (date, price).
            PointValue pointValue = new PointValue(x, Float.valueOf(bidPrice));
            pointValue.setLabel(date);
            pointValues.add(pointValue);

            // Set labels for x-axis (we have to reduce its number to avoid overlapping text).
            if (counter != 0 && counter % (data.getCount() / 3) == 0) {
                AxisValue axisValueX = new AxisValue(x);
                axisValueX.setLabel(date);
                axisValuesX.add(axisValueX);
            }

        } while (data.moveToNext());

        // Prepare data for chart
        Line line = new Line(pointValues).setColor(Color.WHITE).setCubic(false);
        List<Line> lines = new ArrayList<>();
        lines.add(line);
        LineChartData lineChartData = new LineChartData();
        lineChartData.setLines(lines);

        // Init x-axis
        Axis axisX = new Axis(axisValuesX);
        axisX.setHasLines(true);
        axisX.setMaxLabelChars(4);
        lineChartData.setAxisXBottom(axisX);

        // Init y-axis
        Axis axisY = new Axis();
        axisY.setAutoGenerated(true);
        axisY.setHasLines(true);
        axisY.setMaxLabelChars(4);
        lineChartData.setAxisYLeft(axisY);

        // Update chart with new data.
        mChart.setInteractive(false);
        mChart.setLineChartData(lineChartData);

        // Show chart
        mChart.setVisibility(View.VISIBLE);
        mTabContent.setVisibility(View.VISIBLE);
    }
 
开发者ID:DmitryMalkovich,项目名称:stock-hawk-app,代码行数:60,代码来源:StockDetailFragment.java


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