Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:howeik/MyOSA

  • Loading branch information...
commit 647ec32465bc5e5182c674876cf8389a1622f3cd 2 parents 7e960fe + 29db12f
@howeik authored
View
68 src/edu/ucsd/idash/myosa/client/ProgressForm.java
@@ -17,14 +17,18 @@
import com.google.gwt.visualization.client.VisualizationUtils;
import com.google.gwt.visualization.client.visualizations.corechart.LineChart;
import com.google.gwt.visualization.client.visualizations.corechart.Options;
+import edu.ucsd.idash.myosa.client.ComboChart;
+import edu.ucsd.idash.myosa.client.Series.Type;
public class ProgressForm extends VerticalPanel {
+
private DataTable graphData;
- private LineChart progressChart;
+ private ComboChart progressChart;
private ListBox chooseForm = new ListBox();
private ListBox dateSelectionBox = new ListBox(true);
private VerticalPanel graphPanel = new VerticalPanel();
private List<String> selectedDates = new ArrayList<String>();
+ private Series goal;
public ProgressForm(final FormServiceAsync formService) {
final VerticalPanel graphsContainer = new VerticalPanel();
@@ -61,10 +65,9 @@ public void onClick(ClickEvent event) {
Runnable onLoadCallback = new Runnable() {
public void run() {
graphData = DataTable.create();
- progressChart = new LineChart(graphData, createOptions());
+ progressChart = new ComboChart(graphData, (edu.ucsd.idash.myosa.client.ComboChart.Options) createOptions());
graphData.addColumn(ColumnType.STRING, "Label");
- graphData.addColumn(ColumnType.NUMBER, "Epworth Sleep Score");
- graphData.addColumn(ColumnType.NUMBER, "Sleep Score Goal");
+
graphData.addRows(4);
graphData.setValue(0, 0, "Sleep Score from 03/12/2011");
graphData.setValue(0, 1, 20);
@@ -92,72 +95,83 @@ public void run() {
private Options createOptions() {
- Options options = Options.create();
+ Options options = ComboChart.createComboOptions();
options.setColors("Blue", "Red");
options.setHeight(800);
options.setWidth(800);
+ ((edu.ucsd.idash.myosa.client.ComboChart.Options) options).setSeriesType(Type.BARS);
options.setTitle("Your Progress");
+ goal = Series.create();
+ goal.setLineWidth(2);
+ goal.setPointSize(10);
+ goal.setType(Type.LINE);
+ ((edu.ucsd.idash.myosa.client.ComboChart.Options) options).setSeries(1, goal);
return options;
}
private void drawGraph() {
if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("1")) {
-// graphData.addRows(getSelectedDates());
-// for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
-// graphData.setValue(i, 0, "Sleep Score from " + selectedDates.get(i));
-// graphData.addColumn(ColumnType.STRING, "Label");
-// graphData.addColumn(ColumnType.NUMBER, "Epworth Sleep Score");
-// graphData.addColumn(ColumnType.NUMBER, "Sleep Score Goal");
-// graphData.addRows(3);
-// graphData.setValue(0, 0, "Sleep Score from 03/12/2011");
-// graphData.setValue(0, 1, 20);
-// graphData.setValue(0, 2, 9);
-// graphData.setValue(1, 0, "Sleep Score from 05/12/2011");
-// graphData.setValue(1, 1, 16);
-// graphData.setValue(1, 2, 9);
-// graphData.setValue(2, 0, "Sleep Score from 07/12/2011");
-// graphData.setValue(2, 1, 13);
-// graphData.setValue(2, 2, 9);
-
-// }
+ graphData.addColumn(ColumnType.NUMBER, "Epworth Sleep Score");
+ graphData.addColumn(ColumnType.NUMBER, "Goal");
+ graphData.addRows(getSelectedDates());
+ for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
+ graphData.setValue(i, 0, "Sleep Score from " + selectedDates.get(i));
+// graphData.setValue(i, 1, value);
+ graphData.setValue(i, 2, 10);
+ }
progressChart.setVisible(true);
} else if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("2")) {
graphData.addColumn(ColumnType.NUMBER, "Calgary Difference Score");
+ graphData.addColumn(ColumnType.NUMBER, "Goal");
graphData.addRows(getSelectedDates());
for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
graphData.setValue(i, 0, "Calgary Difference Score" + selectedDates.get(i));
// graphData.setValue(i, 1, value);
+ graphData.setValue(i, 2, 4.5);
+
}
progressChart.setVisible(true);
} else if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("3")){
graphData.addColumn(ColumnType.NUMBER, "Daily Activities");
+ graphData.addColumn(ColumnType.NUMBER, "Goal");
+ graphData.addRows(getSelectedDates());
for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
graphData.setValue(i, 0, "Calgary Daily Activities" + selectedDates.get(i));
// graphData.setValue(i, 1, value);
+ graphData.setValue(i, 2, 4);
}
progressChart.setVisible(true);
} else if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("4")){
graphData.addColumn(ColumnType.NUMBER, "Social Interactions");
+ graphData.addColumn(ColumnType.NUMBER, "Goal");
+ graphData.addRows(getSelectedDates());
for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
- graphData.setValue(i, 0, "Calgary Social INteractions" + selectedDates.get(i));
+ graphData.setValue(i, 0, "Calgary Social Interactions" + selectedDates.get(i));
// graphData.setValue(i, 1, value);
+ graphData.setValue(i, 2, 3);
}
progressChart.setVisible(true);
} else if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("5")){
graphData.addColumn(ColumnType.NUMBER, "Emotions");
+ graphData.addColumn(ColumnType.NUMBER, "Goal");
+ graphData.addRows(getSelectedDates());
for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
graphData.setValue(i, 0, "Calgary Emotions" + selectedDates.get(i));
// graphData.setValue(i, 1, value);
+ graphData.setValue(i, 2, 2);
}
progressChart.setVisible(true);
} else if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("6")){
graphData.addColumn(ColumnType.NUMBER, "Energy");
+ graphData.addColumn(ColumnType.NUMBER, "Goal");
+ graphData.addRows(getSelectedDates());
for (int i = 0; i < graphData.getNumberOfRows(); ++i) {
graphData.setValue(i, 0, "Calgary Energy" + selectedDates.get(i));
// graphData.setValue(i, 1, value);
+ graphData.setValue(i, 2, 2.6);
}
progressChart.setVisible(true);
- } else if (chooseForm.getValue(chooseForm.getSelectedIndex()).equals("-1")) {
+ } else {
final DialogBox incompleteBox = new DialogBox();
incompleteBox.setText("Please pick a form to compare");
Button closeWarning = new Button("Close");
@@ -170,9 +184,7 @@ public void onClick(ClickEvent event) {
incompleteBox.hide();
}
});
- } //else {
-// // throw some error message
-// }
+ }
graphPanel.add(progressChart);
}
View
2  src/edu/ucsd/idash/myosa/server/FormServiceImpl.java
@@ -239,4 +239,4 @@ public int submitCalgary(String sessionId, FormData data) {
return null;
}
-}
+}
View
10 war/WEB-INF/web.xml
@@ -16,6 +16,16 @@
<url-pattern>/myosa/account</url-pattern>
</servlet-mapping>
+ <servlet>
+ <servlet-name>formServlet</servlet-name>
+ <servlet-class>edu.ucsd.idash.myosa.server.FormServiceImpl</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>formServlet</servlet-name>
+ <url-pattern>/myosa/form</url-pattern>
+ </servlet-mapping>
+
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>MyOSA.html</welcome-file>
View
2  war/account_db.properties
@@ -1,4 +1,4 @@
db_host = localhost
db_schema = myosa
db_username = root
-db_password = password
+db_password = strongpassword
Please sign in to comment.
Something went wrong with that request. Please try again.