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


Java AxisValue.setLabel方法代码示例

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


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

示例1: basalVsTempBasalyAxis

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
public Axis basalVsTempBasalyAxis() {
    Axis yAxis = new Axis();
    yAxis.setAutoGenerated(false);
    List<AxisValue> axisValues = new ArrayList<>();

    for(double j = -maxBasal.intValue(); j <= maxBasal.intValue(); j += 1) {
        //axisValues.add(new AxisValue((float)fitIOB2COBRange(j)));
        AxisValue value = new AxisValue((float)j);
        if (j==0){
            value.setLabel("Basal");
        } else if (j>0){
            value.setLabel("+" + String.valueOf(j) + "u");
        } else {
            value.setLabel(String.valueOf(j) + "u");
        }
        axisValues.add(value);
    }
    yAxis.setValues(axisValues);
    yAxis.setHasLines(true);
    yAxis.setMaxLabelChars(5);
    yAxis.setInside(true);
    return yAxis;
}
 
开发者ID:timomer,项目名称:HAPP,代码行数:24,代码来源:BasalVSTempBasalGraph.java

示例2: iobPastyAxis

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
public Axis iobPastyAxis() {
    Axis yAxis = new Axis();
    yAxis.setAutoGenerated(false);
    List<AxisValue> axisValues = new ArrayList<AxisValue>();

    for(int j = 1; j <= 8; j += 1) {
        //axisValues.add(new AxisValue((float)fitIOB2COBRange(j)));
        AxisValue value = new AxisValue(j*10);
        value.setLabel(String.valueOf(j*2) + "u");
        axisValues.add(value);
    }
    yAxis.setTextColor(ChartUtils.COLOR_BLUE);
    yAxis.setValues(axisValues);
    yAxis.setHasLines(true);
    yAxis.setMaxLabelChars(5);
    yAxis.setInside(true);
    return yAxis;
}
 
开发者ID:timomer,项目名称:HAPP,代码行数:19,代码来源:CommonChartSupport.java

示例3: cobPastyAxis

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
public Axis cobPastyAxis() {
    Axis yAxis = new Axis();
    yAxis.setAutoGenerated(false);
    List<AxisValue> axisValues = new ArrayList<AxisValue>();

    for(int j = 1; j <= 8; j += 1) {
        AxisValue value = new AxisValue(j*10);
        value.setLabel(String.valueOf(j*10) + "g");
        axisValues.add(value);
    }
    yAxis.setTextColor(ChartUtils.COLOR_ORANGE);
    yAxis.setValues(axisValues);
    yAxis.setHasLines(true);
    yAxis.setMaxLabelChars(5);
    yAxis.setInside(true);
    return yAxis;
}
 
开发者ID:timomer,项目名称:HAPP,代码行数:18,代码来源:CommonChartSupport.java

示例4: getXAxisValues

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
@Override
protected List<AxisValue> getXAxisValues() {
    List<AxisValue> values = new ArrayList<>();
    for (int i = 0; i < COLUMN_COUNT; i++) {
        AxisValue value = new AxisValue(i);
        if (i % 4 == 0) {
            value.setLabel(i + ":00");
            values.add(value);
        }
    }
    return values;
}
 
开发者ID:HRVBand,项目名称:hrv-band,代码行数:13,代码来源:ChartDrawDayStrategy.java

示例5: getXAxisValues

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
@Override
protected List<AxisValue> getXAxisValues() {
    List<AxisValue> values = new ArrayList<>();
    for (int i = 1; i <= columnCount; i++) {
        AxisValue value = new AxisValue(i);
        if (i % 5 == 0) {
            value.setLabel(Integer.toString(i) + "");
            values.add(value);
        }
    }
    return values;
}
 
开发者ID:HRVBand,项目名称:hrv-band,代码行数:13,代码来源:ChartDrawMonthStrategy.java

示例6: generateLineChartData

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private LineChartData generateLineChartData(@NonNull List<FillUp> fillUps) {
    List<PointValue> values = new ArrayList<>();
    List<AxisValue> axisValues = new ArrayList<>();

    long oldestFillUpTime = 0;
    long latestFillUpTime = 0;

    for (int x = 0; x < fillUps.size(); ++x) {
        FillUp dataItem = fillUps.get(x);
        BigDecimal consumption = dataItem.getFuelConsumption();

        if (consumption != null) {
            latestFillUpTime = dataItem.getDate().getTime();
            String formattedRecordedAt = DateUtil.getDateLocalized(dataItem.getDate());
            if (oldestFillUpTime == 0) {
                oldestFillUpTime = latestFillUpTime;
            }

            values.add(new PointValue(latestFillUpTime - oldestFillUpTime, consumption.floatValue()));
            AxisValue axisValue = new AxisValue(latestFillUpTime - oldestFillUpTime);
            axisValue.setLabel(formattedRecordedAt);
            axisValues.add(axisValue);
        }
    }

    Line line = new Line(values)
            .setColor(getContext().getResources().getColor(R.color.colorLightGrey))
            .setPointColor(getContext().getResources().getColor(R.color.colorPrimary));

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

    BigDecimal averageConsumption = new StatisticsService(getContext(), vehicleId).getAverageConsumption();
    if (averageConsumption != null) {
        List<PointValue> averageLineValues = new ArrayList<>(2);
        averageLineValues.add(new PointValue(0, averageConsumption.floatValue()));
        averageLineValues.add(new PointValue(latestFillUpTime - oldestFillUpTime, averageConsumption.floatValue()));
        Line averageLine = new Line(averageLineValues);
        averageLine.setColor(getContext().getResources().getColor(R.color.colorAccent));
        averageLine.setHasPoints(false).setHasLabels(true);

        lines.add(averageLine);
    }


    LineChartData data = new LineChartData(lines);
    data.setAxisXBottom(new Axis(axisValues)
            .setMaxLabelChars(10).setHasTiltedLabels(true));
    data.setAxisYLeft(new Axis()
            .setName(getContext().getString(R.string.statistics_fuel_consumption))
            .setHasLines(true));

    return data;
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:55,代码来源:ConsumptionChartDataLoader.java

示例7: generateLineChartData

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private LineChartData generateLineChartData(@NonNull List<FillUp> fillUps) {
    List<PointValue> values = new ArrayList<>();
    List<AxisValue> axisValues = new ArrayList<>();

    long oldestFillUpTime = 0;
    long latestFillUpTime = 0;

    for (int x = 0; x < fillUps.size(); ++x) {
        FillUp dataItem = fillUps.get(x);

        latestFillUpTime = dataItem.getDate().getTime();
        String formattedRecordedAt = DateUtil.getDateLocalized(dataItem.getDate());
        if (oldestFillUpTime == 0) {
            oldestFillUpTime = latestFillUpTime;
        }

        values.add(new PointValue(latestFillUpTime - oldestFillUpTime, dataItem.getFuelPricePerLitre().floatValue()));
        AxisValue axisValue = new AxisValue(latestFillUpTime - oldestFillUpTime);
        axisValue.setLabel(formattedRecordedAt);
        axisValues.add(axisValue);
    }

    Line line = new Line(values)
            .setColor(getContext().getResources().getColor(R.color.colorLightGrey))
            .setPointColor(getContext().getResources().getColor(R.color.colorPrimary));

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

    BigDecimal averagePrice = new StatisticsService(getContext(), vehicleId).getFuelUnitPriceAverage();

    List<PointValue> averageLineValues = new ArrayList<>(2);
    averageLineValues.add(new PointValue(0, averagePrice.floatValue()));
    averageLineValues.add(new PointValue(latestFillUpTime - oldestFillUpTime, averagePrice.floatValue()));
    Line averageLine = new Line(averageLineValues);
    averageLine.setColor(getContext().getResources().getColor(R.color.colorAccent));
    averageLine.setHasPoints(false).setHasLabels(true);

    lines.add(averageLine);


    LineChartData data = new LineChartData(lines);
    data.setAxisXBottom(new Axis(axisValues)
            .setMaxLabelChars(10).setHasTiltedLabels(true));
    data.setAxisYLeft(new Axis()
            .setName(getContext().getString(R.string.statistics_fuel_price))
            .setHasLines(true));

    return data;
}
 
开发者ID:piskula,项目名称:FuelUp,代码行数:51,代码来源:FuelPriceChartDataLoader.java

示例8: updateChart

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的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

示例9: iobcobFutureChart

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
public ColumnChartData iobcobFutureChart() {
    Log.d(TAG, "iobcobFutureChart: START");

    if (!statList.isEmpty()) {

        List<Column> columnsData = new ArrayList<>();
        List<SubcolumnValue> values;
        List<AxisValue> xAxisValues = new ArrayList<AxisValue>();

        try {
            for (int v = 0; v < statList.size(); v++) {

                values = new ArrayList<>();

                //IOB
                if (statList.get(v).getIob() > yIOBMax) {
                    values.add(new SubcolumnValue((float) (fitIOB2COBRange(yIOBMax.floatValue())), ChartUtils.COLOR_BLUE));
                } else if (statList.get(v).getIob() < yIOBMin) {
                    values.add(new SubcolumnValue((float) (fitIOB2COBRange(yIOBMin.floatValue())), ChartUtils.COLOR_BLUE));
                } else {
                    values.add(new SubcolumnValue((float) (fitIOB2COBRange(statList.get(v).getIob())), ChartUtils.COLOR_BLUE));
                }
                //COB
                if (statList.get(v).getCob() > yCOBMax) {
                    values.add(new SubcolumnValue((float) (yCOBMax.floatValue()), ChartUtils.COLOR_ORANGE));
                } else {
                    values.add(new SubcolumnValue((float) (statList.get(v).getCob()), ChartUtils.COLOR_ORANGE));
                }

                Column column = new Column(values);
                column.setHasLabels(false);
                columnsData.add(column);

                AxisValue axisValue = new AxisValue(v);
                axisValue.setLabel(statList.get(v).when);
                xAxisValues.add(axisValue);
                //xAxisValues.  add(new AxisValue((long)0, iobcobValues.getJSONObject(v).getString("when")));
            }
        } catch (Exception e) {
            Crashlytics.logException(e);
        }

        columnData = new ColumnChartData(columnsData);
        Axis axisX = new Axis(xAxisValues).setHasLines(true);

        //columnData.setAxisYLeft(ycobiobAxis());
        columnData.setAxisYLeft(iobPastyAxis());
        columnData.setAxisYRight(cobPastyAxis());
        columnData.setAxisXBottom(axisX);

        Log.d(TAG, "iobcobFutureChart: FINISH");
        return columnData;

    } else{
        Log.d(TAG, "iobcobFutureChart: FINISH EMPTY REPLY");
        return new ColumnChartData(); //empty
    }
}
 
开发者ID:timomer,项目名称:HAPP,代码行数:59,代码来源:IOBCOBBarGraph.java

示例10: getMeetingDurationXAxisValue

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
private static AxisValue getMeetingDurationXAxisValue(Context context, Meeting meeting) {
    AxisValue xAxisValue = new AxisValue(meeting.getStartDate());
    String dateString = TextUtils.formatDate(context, meeting.getStartDate());
    xAxisValue.setLabel(dateString);
    return xAxisValue;
}
 
开发者ID:caarmen,项目名称:scrumchatter,代码行数:7,代码来源:MeetingDurationLineChart.java

示例11: populateMeeting

import lecho.lib.hellocharts.model.AxisValue; //导入方法依赖的package包/类
public static void populateMeeting(Context context, ColumnChartView chart, @NonNull Cursor cursor) {
    List<AxisValue> xAxisValues = new ArrayList<>();
    List<Column> columns = new ArrayList<>();

    MeetingMemberCursorWrapper cursorWrapper = new MeetingMemberCursorWrapper(cursor);
    int maxLabelLength = 0;
    while (cursorWrapper.moveToNext()) {
        List<SubcolumnValue> subcolumnValues = new ArrayList<>();
        Column column = new Column(subcolumnValues);

        Long memberId = cursorWrapper.getMemberId();
        String memberName = cursorWrapper.getMemberName();
        float durationInMinutes = (float) cursorWrapper.getDuration() / 60;
        String durationLabel = DateUtils.formatElapsedTime(cursorWrapper.getDuration());

        SubcolumnValue subcolumnValue = new SubcolumnValue();
        subcolumnValue.setValue(durationInMinutes);
        subcolumnValue.setLabel(durationLabel);
        int color = ChartUtils.getMemberColor(context, memberId);
        subcolumnValue.setColor(color);
        subcolumnValues.add(subcolumnValue);

        column.setHasLabels(true);
        column.setValues(subcolumnValues);
        columns.add(column);

        AxisValue xAxisValue = new AxisValue(xAxisValues.size());
        xAxisValue.setLabel(memberName);
        xAxisValues.add(xAxisValue);
        if (memberName.length() > maxLabelLength) maxLabelLength = memberName.length();
    }

    cursor.moveToPosition(-1);

    Axis xAxis = new Axis(xAxisValues);
    xAxis.setAutoGenerated(false);
    //xAxis.setMaxLabelChars(maxLabelLength);
    xAxis.setTextColor(ResourcesCompat.getColor(context.getResources(), R.color.chart_text, null));
    xAxis.setHasTiltedLabels(true);

    ColumnChartData data = new ColumnChartData();
    data.setAxisXBottom(xAxis);
    data.setColumns(columns);
    chart.setInteractive(true);
    chart.setColumnChartData(data);
    chart.setZoomEnabled(true);
    chart.setZoomType(ZoomType.HORIZONTAL);
}
 
开发者ID:caarmen,项目名称:scrumchatter,代码行数:49,代码来源:MeetingSpeakingTimeColumnChart.java


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