Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do calculations as float and not as int for plotting points. #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Created by stephenblack on 11/15/14.
*/
public class BgGraphBuilder {
public static final int FUZZER = (1000 * 30 * 5);
public static final float FUZZER = (1000 * 30 * 5);
public long end_time;
public long start_time;
public Context context;
Expand Down Expand Up @@ -452,7 +452,7 @@ public class OnValueSelectTooltipListener implements LineChartOnValueSelectListe
public synchronized void onValueSelected(int i, int i1, PointValue pointValue) {
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;
Long time = (long)(pointValue.getX()*FUZZER);
if(tooltip!= null){
tooltip.cancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ public class BgSparklineBuilder {
private int height;
private BgGraphBuilder bgGraphBuilder;
private LineChartView chart;
private long end = new Date().getTime() / BgGraphBuilder.FUZZER;
private long start = end - (60000*180 / BgGraphBuilder.FUZZER); // 3h
private long end = new Date().getTime() / (long)BgGraphBuilder.FUZZER;
private long start = end - (60000*180 / (long)BgGraphBuilder.FUZZER); // 3h
private boolean showLowLine = false;
private boolean showHighLine = false;
private boolean showAxes = false;
private boolean useSmallDots = true;
private boolean useTinyDots = false;

public BgSparklineBuilder setStart(long start) {
this.start = start / BgGraphBuilder.FUZZER;
this.start = start / (long)BgGraphBuilder.FUZZER;
return this;
}

public BgSparklineBuilder setEnd(long end) {
this.end = end / BgGraphBuilder.FUZZER;
this.end = end / (long)BgGraphBuilder.FUZZER;
return this;
}

Expand Down