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


Java PointValue.getX方法代码示例

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


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

示例1: calculateMaxViewport

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void calculateMaxViewport() {
    tempMaximumViewport.set(Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE, Float.MAX_VALUE);
    LineChartData data = dataProvider.getLineChartData();

    for (Line line : data.getLines()) {
        // Calculate max and min for viewport.
        for (PointValue pointValue : line.getValues()) {
            if (pointValue.getX() < tempMaximumViewport.left) {
                tempMaximumViewport.left = pointValue.getX();
            }
            if (pointValue.getX() > tempMaximumViewport.right) {
                tempMaximumViewport.right = pointValue.getX();
            }
            if (pointValue.getY() < tempMaximumViewport.bottom) {
                tempMaximumViewport.bottom = pointValue.getY();
            }
            if (pointValue.getY() > tempMaximumViewport.top) {
                tempMaximumViewport.top = pointValue.getY();
            }

        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:LineChartRenderer.java

示例2: calculateMaxViewport

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private void calculateMaxViewport() {
    this.tempMaximumViewport.set(AutoScrollHelper.NO_MAX, Float.MIN_VALUE, Float.MIN_VALUE, AutoScrollHelper.NO_MAX);
    for (Line line : this.dataProvider.getLineChartData().getLines()) {
        for (PointValue pointValue : line.getValues()) {
            if (pointValue.getX() < this.tempMaximumViewport.left) {
                this.tempMaximumViewport.left = pointValue.getX();
            }
            if (pointValue.getX() > this.tempMaximumViewport.right) {
                this.tempMaximumViewport.right = pointValue.getX();
            }
            if (pointValue.getY() < this.tempMaximumViewport.bottom) {
                this.tempMaximumViewport.bottom = pointValue.getY();
            }
            if (pointValue.getY() > this.tempMaximumViewport.top) {
                this.tempMaximumViewport.top = pointValue.getY();
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:LineChartRenderer.java

示例3: onValueSelected

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@Override
public synchronized void onValueSelected(int i, int i1, PointValue pointValue) {
	
	String filtered = "";
	try {
		PointValueExtended pve = (PointValueExtended) pointValue;
		if(pve.calculatedFilteredValue != -1) {
			filtered = " (" + Math.round(pve.calculatedFilteredValue*10) / 10d +")";
		}
	} catch (ClassCastException e) {
		Log.e(TAG, "Error casting a point from pointValue to PointValueExtended", e);
	}
    final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(context);
    //Won't give the exact time of the reading but the time on the grid: close enough.
    Long time = ((long)pointValue.getX())*FUZZER;
    if(tooltip!= null){
        tooltip.cancel();
    }
    tooltip = Toast.makeText(context, timeFormat.format(time)+ ": " + Math.round(pointValue.getY()*10)/ 10d + filtered, Toast.LENGTH_LONG);
    tooltip.show();
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:22,代码来源:BgGraphBuilder.java

示例4: filteredLines

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
public ArrayList<Line> filteredLines() {
    ArrayList<Line> line_array = new ArrayList<Line>();
    float last_x_pos = -999999; // bogus mark value
    final float jump_threshold = 15; // in minutes
    List<PointValue> local_points = new ArrayList<PointValue>();

    if (filteredValues.size() > 0) {
        final float end_marker = filteredValues.get(filteredValues.size() - 1).getX();

        for (PointValue current_point : filteredValues) {
            // a jump too far for a line? make it a new one
            if (((last_x_pos != -999999) && (Math.abs(current_point.getX() - last_x_pos) > jump_threshold))
                    || current_point.getX() == end_marker) {
                Line line = new Line(local_points);
                line.setHasPoints(true);
                line.setPointRadius(2);
                line.setStrokeWidth(1);
                line.setColor(Color.parseColor("#a0a0a0"));
                line.setCubic(true);
                line.setHasLines(true);
                line_array.add(line);
                local_points = new ArrayList<PointValue>();
            }
            last_x_pos = current_point.getX();
            local_points.add(current_point); // grow current line list
        }
    }
    return line_array;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:30,代码来源:BgGraphBuilder.java

示例5: autoSplitLine

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
private ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
    ArrayList<Line> linearray = new ArrayList<>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<>();

    if (macropoints.size() > 0) {
        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) cloneObject(macroline); // aieeee
                try {
                    line.setValues(thesepoints);
                    linearray.add(line);
                } catch (NullPointerException e) {
                //
                }
                    thesepoints = new ArrayList<PointValue>();
            }
            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
    return linearray;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:34,代码来源:BgGraphBuilder.java

示例6: autoSplitLine

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
public ArrayList<Line> autoSplitLine(Line macroline, final float jumpthresh) {
   // if (d) Log.d(TAG, "Enter autoSplit Line");
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999;

    List<PointValue> macropoints = macroline.getValues();
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (macropoints.size() > 0) {

        final float endmarker = macropoints.get(macropoints.size() - 1).getX();
        for (PointValue thispoint : macropoints) {

            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {

                if (thispoint.getX() == endmarker) {
                    thesepoints.add(thispoint);
                }
                Line line = (Line) cloneObject(macroline); // aieeee
                line.setValues(thesepoints);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    }
 //   if (d) Log.d(TAG, "Exit autoSplit Line");
    return linearray;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:34,代码来源:BgGraphBuilder.java

示例7: filteredLines

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
public ArrayList<Line> filteredLines() {
    ArrayList<Line> linearray = new ArrayList<Line>();
    float lastx = -999999; // bogus mark value
    final float jumpthresh = 15; // in minutes
    List<PointValue> thesepoints = new ArrayList<PointValue>();

    if (filteredValues.size() > 0) {

        final float endmarker = filteredValues.get(filteredValues.size() - 1).getX();

        for (PointValue thispoint : filteredValues) {
            // a jump too far for a line? make it a new one
            if (((lastx != -999999) && (Math.abs(thispoint.getX() - lastx) > jumpthresh))
                    || thispoint.getX() == endmarker) {
                Line line = new Line(thesepoints);
                line.setHasPoints(true);
                line.setPointRadius(2);
                line.setStrokeWidth(1);
                line.setColor(getCol(X.color_filtered));
                line.setCubic(true);
                line.setHasLines(true);
                linearray.add(line);
                thesepoints = new ArrayList<PointValue>();
            }

            lastx = thispoint.getX();
            thesepoints.add(thispoint); // grow current line list
        }
    } else {
        UserError.Log.i(TAG, "Raw points size is zero");
    }


    //UserError.Log.i(TAG, "Returning linearray: " + Integer.toString(linearray.size()));
    return linearray;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:37,代码来源:BgGraphBuilder.java

示例8: onValueSelected

import lecho.lib.hellocharts.model.PointValue; //导入方法依赖的package包/类
@Override
public synchronized void onValueSelected(int i, int i1, PointValue pointValue) {

    Log.d(TAG, "onValueSelected pointValue=" + pointValue.getX() + "," + pointValue.getY());
    String filtered = "";
    String alternate = "";
    String uuid = "";
    int type = 0;
    long real_timestamp = 0;
    try {
        PointValueExtended pve = (PointValueExtended) pointValue;
        type = pve.type;
        if (pve.calculatedFilteredValue != -1) {
            filtered = " (" + Math.round(pve.calculatedFilteredValue * 10) / 10d + ")";
        }
        if (pve.note != null) {
            alternate = pve.note;
        }
        if (pve.uuid != null) {
            uuid = pve.uuid;
        }
        real_timestamp = pve.real_timestamp;

    } catch (ClassCastException e) {
        Log.e(TAG, "Error casting a point from pointValue to PointValueExtended", e);
    }

    final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(context);
    //Won't give the exact time of the reading but the time on the grid: close enough.
    final Long time = (real_timestamp > 0) ? real_timestamp : ((long) pointValue.getX()) * FUZZER;
    final double ypos = pointValue.getY();

    final String message;

    if (alternate.length() > 0) {
        message = timeFormat.format(time) + "    " + alternate;
    } else {
        message = timeFormat.format(time) + "      " + (Math.round(pointValue.getY() * 10) / 10d) + " " + unit() + filtered;
    }
    Log.d(TAG, "onValueSelected message=" + message);
    JoH.static_toast(xdrip.getAppContext(), message, Toast.LENGTH_SHORT);

    /*switch (type) {
        case com.eveningoutpost.dexdrip.UtilityModels.PointValueExtended.BloodTest:
            final String fuuid = uuid;
            final View.OnClickListener mBtOnClickListener = new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Home.startHomeWithExtra(xdrip.getAppContext(), Home.BLOOD_TEST_ACTION, time.toString(), fuuid);
                }
            };
            Home.snackBar(R.string.blood_test, message, mBtOnClickListener, callerActivity);
            break;
        default:
            final View.OnClickListener mOnClickListener = new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Home.startHomeWithExtra(xdrip.getAppContext(), Home.CREATE_TREATMENT_NOTE, time.toString(), Double.toString(ypos));
                }
            };
            Home.snackBar(R.string.add_note, message, mOnClickListener, callerActivity);
            break;
    }*/
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:65,代码来源:BgGraphBuilder.java


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