Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
352af61
fixed axis renderer tick marks
Nov 20, 2013
c1778c0
really unstable but kinda working
Nov 21, 2013
2c3a3c9
working good maybe ready for merge
Nov 21, 2013
13adf94
added continous function plotting
Nov 22, 2013
ac3e52f
fixed some crashing bugs
Dec 5, 2013
30efa3f
fixing gradle build
Dec 11, 2013
e4d0f67
added external render capability
Dec 20, 2013
ebd61d4
added auto bounds stuff
Dec 23, 2013
9009b47
upgrade gradle android build to 0.7.3
Dec 27, 2013
ee593d6
removed .iml
Dec 27, 2013
ffaa40c
plotter
Feb 25, 2014
b4051b3
fixing plotter
Feb 25, 2014
f0c0830
Fixed build.gradle to use verrsion 0.8.+
bpbower Feb 27, 2014
6bc5d7f
remove zoom controls
Mar 1, 2014
4fb1f7e
cruft
Mar 10, 2014
da7e8b3
exermental stuff
Mar 11, 2014
102ddd2
bargraph+spline+points
Mar 12, 2014
3fcf545
dirty
Mar 17, 2014
f5b1905
dirty
Mar 17, 2014
237b732
Merge branch 'master' into putback
Mar 18, 2014
4a6ec53
changes for factorymode
Mar 18, 2014
f827b22
Merge remote-tracking branch 'origin/master'
Mar 18, 2014
6a4b82b
set to gradle 0.9.1
Mar 28, 2014
0779c02
set buildToolsVersion to 19.0.1 and gradle to 0.9.1
Apr 2, 2014
a0d626f
updated FunctionRenderer2 and SimpleAxisRenderer
May 7, 2014
a183b73
fixed bug in FunctionRenderer2
May 8, 2014
db4ab24
might work
May 15, 2014
bd4c721
making OversampleFunctionRenderer work
May 16, 2014
78612e1
merge
May 28, 2014
63260cd
set Axis color
Jun 30, 2014
6b4d05d
update to android studio 0.8
Jul 8, 2014
ee7026e
Merge remote-tracking branch 'origin/factorymode' into HEAD
Jul 14, 2014
c43050b
Merge remote-tracking branch 'origin/androidstudio8' into HEAD
Jul 14, 2014
b5ee54d
update build.gradle
Jul 17, 2014
2c2dbc8
fix extra line artifact
Nov 18, 2014
2d3001e
fix graphing problem
Nov 19, 2014
4006f91
show more digits on axis
Nov 19, 2014
5f2a7b6
update for gradle android pluging 1.0
Dec 15, 2014
a0521b4
update to work with devsmart-android
Dec 22, 2014
038f65c
devsmart android v0.1.1
Jan 2, 2015
3a223d4
devsmart core v0.1.2
Jan 5, 2015
fdb746b
devsmart core v0.1.3
Jan 7, 2015
09c4d08
upgrade to devsmart core 0.1.4
Feb 17, 2015
dc84426
update devsmart core 1.5
Mar 31, 2015
1f346f2
Adding the ability to set paint color in the AxisRenderer
sgowen Apr 9, 2015
dfe3cb6
Undoing my braces
sgowen Apr 13, 2015
a0ba123
Undoing braces and adding LineRenderer
sgowen Apr 14, 2015
642eebc
Tweaking LineRender to handle the origin correctly (though I'm not en…
sgowen Apr 14, 2015
a4eda30
That contains method is actually just making me mad, haha
sgowen Apr 14, 2015
4acfa07
Merge pull request #1 from GowenGameDev/dev
Apr 14, 2015
f6399d6
Fixing line renderer wackiness
sgowen Apr 16, 2015
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ build/
.project
.classpath
.settings/
*.iml
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,33 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:0.6.3'
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

apply plugin: 'android-library'
apply plugin: 'com.android.library'
apply plugin: 'eclipse'

repositories {
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
//compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.dev-smart:devsmart-android:0.1.5'
compile project(':AndroidEssentials')
}

android {
buildToolsVersion "19.0.0"
compileSdkVersion 10
compileSdkVersion 19
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 14
targetSdkVersion 14
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
Expand Down
8 changes: 8 additions & 0 deletions res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="GraphView">
<attr name="axisColor" format="color" />
<attr name="labelColor" format="color"/>

</declare-styleable>
</resources>
21 changes: 21 additions & 0 deletions src/com/devsmart/plotter/AxisFunction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.devsmart.plotter;

public interface AxisFunction {

void interpolate(float[] x, float[] y);

AxisFunction copy();

/**
* translate screen coord --> graph coord
* @param x
* @return
*/
float value(float x);

/**
* return the inverse function
* @return
*/
AxisFunction inverse();
}
32 changes: 29 additions & 3 deletions src/com/devsmart/plotter/AxisRenderer.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
package com.devsmart.plotter;

import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;

public interface AxisRenderer {

void drawAxis(Canvas canvas, RectF viewport, GraphView graphview);
/**
* Measure the area where the graph data will be drawn. Return a Rect
* in screen coordinates.
*
* @param screenWidth
* @param screenHeight
* @return
*/
Rect measureGraphArea(int screenWidth, int screenHeight);

}
/**
* Draw the axis on the canvas.
*
* @param canvas
* @param canvasWidth
* @param canvasHeight
* @param viewport
* @return
*/
void drawAxis(Canvas canvas, int canvasWidth, int canvasHeight, RectF viewport, CoordinateSystem coordSystem);

void setXAxisLabel(String label);

void setYAxisLabel(String label);

void setAxisColor(int color);

void setLabelColor(int color);
}
95 changes: 95 additions & 0 deletions src/com/devsmart/plotter/CoordinateSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.devsmart.plotter;

import android.graphics.RectF;

public class CoordinateSystem {

AxisFunction mXAxisFunction;
AxisFunction mYAxisFunction;
CoordinateSystem mInverse;



public CoordinateSystem copy() {
CoordinateSystem retval = new CoordinateSystem();
retval.mXAxisFunction = mXAxisFunction.copy();
retval.mYAxisFunction = mYAxisFunction.copy();

return retval;
}

public float xValue(float x) {
return mXAxisFunction.value(x);
}

public float yValue(float y) {
return mYAxisFunction.value(y);
}

public void mapRect(RectF dest, RectF src) {
dest.left = mXAxisFunction.value(src.left);
dest.right = mXAxisFunction.value(src.right);
dest.bottom = mYAxisFunction.value(src.bottom);
dest.top = mYAxisFunction.value(src.top);
}

public void mapRect(RectF rect) {
rect.left = mXAxisFunction.value(rect.left);
rect.right = mXAxisFunction.value(rect.right);
rect.bottom = mYAxisFunction.value(rect.bottom);
rect.top = mYAxisFunction.value(rect.top);

}

/**
* Apply this system to the array of 2D points, and write the transformed points back into the array
* @param pts
*/
public void mapPoints(float[] pts) {
mapPoints(pts, pts);
/*
for(int x=0;x<pts.length;x=x+2){
pts[x] = mXAxisFunction.value(pts[x]);
}

for(int y=1;y<pts.length;y=y+2){
pts[y] = mYAxisFunction.value(pts[y]);
}
*/

}

public void mapPoints(float[] dest, float[] src) {
for(int x=0;x<src.length;x=x+2){
dest[x] = mXAxisFunction.value(src[x]);
}

for(int y=1;y<src.length;y=y+2){
dest[y] = mYAxisFunction.value(src[y]);
}
}

public CoordinateSystem getInverse() {
if(mInverse == null){
mInverse = new CoordinateSystem();
mInverse.mXAxisFunction = mXAxisFunction.inverse();
mInverse.mYAxisFunction = mYAxisFunction.inverse();
}
return mInverse;
}

public void interpolate(RectF from, RectF to){
mXAxisFunction.interpolate(new float[]{from.left, from.right}, new float[]{to.left, to.right});
mYAxisFunction.interpolate(new float[]{from.top, from.bottom}, new float[]{to.top, to.bottom});
}

public static CoordinateSystem createLinearSystem() {
CoordinateSystem retval = new CoordinateSystem();
retval.mXAxisFunction = new LinearFunction();
retval.mYAxisFunction = new LinearFunction();

return retval;
}


}
10 changes: 10 additions & 0 deletions src/com/devsmart/plotter/DataRenderer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.devsmart.plotter;

import android.graphics.Canvas;
import android.graphics.RectF;

public interface DataRenderer {
void draw(Canvas canvas, RectF viewPort, CoordinateSystem coordSystem);

void setPaintColor(int color);
}
Loading