Commit 0947bba5 by Alex Rhodes

added base y axis value support to combo chart

parent 3b97a83d
...@@ -27,7 +27,7 @@ is loaded from Google's servers as required in the Google Terms of Service. ...@@ -27,7 +27,7 @@ is loaded from Google's servers as required in the Google Terms of Service.
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.alexscottrhodes</groupId> <groupId>com.alexscottrhodes</groupId>
<artifactId>GoogleChartsJSF</artifactId> <artifactId>GoogleChartsJSF</artifactId>
<version>1.3</version> <version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>Google Charts JSF API</name> <name>Google Charts JSF API</name>
<description>JSF tag wrapper for google charts objects</description> <description>JSF tag wrapper for google charts objects</description>
......
...@@ -98,7 +98,7 @@ public class Builder { ...@@ -98,7 +98,7 @@ public class Builder {
row+= "'" + s.getDataset().get(i) + "'"; row+= "'" + s.getDataset().get(i) + "'";
} }
}else{ }else{
row+="null"; row+="";
} }
row += ","; row += ",";
} }
...@@ -134,7 +134,17 @@ public class Builder { ...@@ -134,7 +134,17 @@ public class Builder {
} }
options += "hAxis: {title:'"+x.getLabel()+"'},"; options += "hAxis: {title:'"+x.getLabel()+"'},";
options += "legend : {position: '" + gcc.getLegendPosition().toString() +"'},"; options += "legend : {position: '" + gcc.getLegendPosition().toString() +"'},";
options += "vAxis: {title:'"+yLabel+"'},"; options += "vAxis: {title:'"+yLabel+"'";
if(gcc.getMinIndexInt() != null){
options += ", minValue: "+ gcc.getMinIndexInt();
}
else if(gcc.getMinIndexDouble() != null){
options += ", minValue: "+ gcc.getMinIndexDouble();
}
else if(gcc.getMinIndexFloat() != null){
options += ", minValue: " + gcc.getMinIndexFloat();
}
options += "},";
options += "curveType: '" + gcc.getCurveType().toString() + "',"; options += "curveType: '" + gcc.getCurveType().toString() + "',";
options += "isStacked: " + gcc.isStacked() + ","; options += "isStacked: " + gcc.isStacked() + ",";
options += "seriesType: '" + x.getDisplayType().toString() + "',"; options += "seriesType: '" + x.getDisplayType().toString() + "',";
......
...@@ -98,10 +98,25 @@ public class GoogleComboChart { ...@@ -98,10 +98,25 @@ public class GoogleComboChart {
private LegendPosition legendPosition = LegendPosition.RIGHT; private LegendPosition legendPosition = LegendPosition.RIGHT;
/** /**
* A boolean for Bar type charts to indicate if the bars should be stacekd or adjacent. * A boolean for Bar type charts to indicate if the bars should be stacked or adjacent.
*/ */
private boolean stacked; private boolean stacked;
/**
* An Integer to represent the starting index of the y-axis. Use {@link #setMinY(int) setMinY} method.
*/
private Integer minIndexInt = null;
/**
* A Double to represent the starting index of the y-axis. Use {@link #setMinY(double) setMinY} method.
*/
private Double minIndexDouble = null;
/**
* A Float to represent the start index of the y-axis. Use {@link #setMinY(float) setMinY} method.
*/
private Float minIndexFloat = null;
public GoogleComboChart(){ public GoogleComboChart(){
seriesList = new ArrayList<ChartSeries>(); seriesList = new ArrayList<ChartSeries>();
axes = new HashMap<AxisType, ArrayList<ChartSeries>>(); axes = new HashMap<AxisType, ArrayList<ChartSeries>>();
...@@ -134,6 +149,30 @@ public class GoogleComboChart { ...@@ -134,6 +149,30 @@ public class GoogleComboChart {
axes.get(axis).add(series); axes.get(axis).add(series);
} }
/**
* Add a minimum Y-axis index to a graph of integer values
* @param min an Integer of the desired starting index
*/
public void setMinY(int min){
this.minIndexInt = min;
}
/**
* Add a minimum Y-axis index to a graph of float values
* @param min a Float of the desired starting index
*/
public void setMinY(float min){
this.minIndexFloat = min;
}
/**
* Add a minimum Y-axis index to a graph of double values
* @param min a Double of the desired starting index
*/
public void setMinY(double min){
this.minIndexDouble = min;
}
//Getters and Setters //Getters and Setters
public String getId() { public String getId() {
...@@ -224,5 +263,23 @@ public class GoogleComboChart { ...@@ -224,5 +263,23 @@ public class GoogleComboChart {
public void setStacked(boolean stacked) { public void setStacked(boolean stacked) {
this.stacked = stacked; this.stacked = stacked;
} }
public Integer getMinIndexInt() {
return minIndexInt;
}
public void setMinIndexInt(int minIndexInt) {
this.minIndexInt = minIndexInt;
}
public Double getMinIndexDouble() {
return minIndexDouble;
}
public void setMinIndexDouble(double minIndexDouble) {
this.minIndexDouble = minIndexDouble;
}
public Float getMinIndexFloat() {
return minIndexFloat;
}
public void setMinIndexFloat(float minIndexFloat) {
this.minIndexFloat = minIndexFloat;
}
} }
...@@ -81,7 +81,6 @@ public class Charts { ...@@ -81,7 +81,6 @@ public class Charts {
for (Date d : getDates()) { for (Date d : getDates()) {
x.addPoint(d); // Populate with some dates x.addPoint(d); // Populate with some dates
} }
gcc.addSeries(s); // Add series S gcc.addSeries(s); // Add series S
gcc.addSeries(t);// Add series T gcc.addSeries(t);// Add series T
gcc.addAxisSeries(x, AxisType.X); // Add the X-axis gcc.addAxisSeries(x, AxisType.X); // Add the X-axis
......
function tabSwitch(active,inactive){
document.getElementById(active).className = "active";
document.getElementById(inactive).className = "";
return true;
}
\ No newline at end of file
#Generated by Maven Integration for Eclipse #Generated by Maven Integration for Eclipse
#Wed Aug 03 13:27:26 MST 2016 #Tue Aug 09 13:33:03 MST 2016
version=1.3 version=0.0.1-SNAPSHOT
groupId=com.alexscottrhodes groupId=com.alexscottrhodes
m2e.projectName=googlechartjsf m2e.projectName=googlechartjsf
m2e.projectLocation=C\:\\workspace\\googlechartjsf m2e.projectLocation=C\:\\workspace\\googlechartjsf
......
...@@ -27,7 +27,7 @@ is loaded from Google's servers as required in the Google Terms of Service. ...@@ -27,7 +27,7 @@ is loaded from Google's servers as required in the Google Terms of Service.
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.alexscottrhodes</groupId> <groupId>com.alexscottrhodes</groupId>
<artifactId>GoogleChartsJSF</artifactId> <artifactId>GoogleChartsJSF</artifactId>
<version>1.3</version> <version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>Google Charts JSF API</name> <name>Google Charts JSF API</name>
<description>JSF tag wrapper for google charts objects</description> <description>JSF tag wrapper for google charts objects</description>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment