debugging graphs...

it's hard!!
This commit is contained in:
Felix 2019-08-12 16:03:00 +01:00
parent 3060a6d1f9
commit 8bdc413eab
5 changed files with 28 additions and 18 deletions

View file

@ -6,13 +6,13 @@ PODS:
- Flutter
DEPENDENCIES:
- Flutter (from `.symlinks/flutter/ios-profile`)
- Flutter (from `.symlinks/flutter/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
EXTERNAL SOURCES:
Flutter:
:path: ".symlinks/flutter/ios-profile"
:path: ".symlinks/flutter/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
url_launcher:

View file

@ -281,7 +281,7 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-profile/Flutter.framework",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (

View file

@ -7,7 +7,8 @@ import 'package:charts_flutter/flutter.dart' as charts;
class GraphData {
List<charts.Series> data = new List<charts.Series>();
Future<List<charts.Series>> getGraphData(String graphType) async {
Future<List<charts.Series<dynamic, DateTime>>> getGraphData(String graphType) async {
// print("called");
/// Graph types:
/// - total_last_week
/// - avg_spend_last_week
@ -35,6 +36,10 @@ class GraphData {
final responseJson = jsonDecode(response.body);
final List<dynamic> labels = responseJson['graph']['labels'];
final List<dynamic> data = responseJson['graph']['data'];
for (int i = 0; i < data.length; i++) {
// print(labels[i].toString() + " : " + data[i].toString());
}
// final List<String> bounds = responseJson['graph']['bounds']; // why is this even returned?
/*
@ -49,11 +54,13 @@ class GraphData {
List<TimeSeriesSpend> timeSeriesSpendList = new List<TimeSeriesSpend>();
for (int i = 0; i < labels.length; i++) {
print(DateTime.parse(labels[i]));
// print(DateTime.parse(labels[i]));
timeSeriesSpendList.add(new TimeSeriesSpend(i, DateTime(i)));
// timeSeriesSpendList.add(new TimeSeriesSpend(data[i], DateTime.parse(labels[i])));
}
// print(timeSeriesSpendList);
return [
new charts.Series<TimeSeriesSpend, DateTime>(
id: 'Spend',

View file

@ -50,12 +50,12 @@ Future<LoginModel> submitReceiptAPI(
body: json.encode(body),
);
debugPrint(response.body);
// debugPrint(response.body);
if (response.statusCode == 200) {
final responseJson = json.decode(response.body);
print(responseJson[0]);
// print(responseJson[0]);
showDialogSingleButton(
context,

View file

@ -30,7 +30,7 @@ class StatsPage extends StatefulWidget {
class StatsPageState extends State<StatsPage> {
GraphData graphData = new GraphData();
List<charts.Series> totalLastWeek;
List<charts.Series<dynamic, DateTime>> displayedGraphData;
@override
void initState() {
@ -50,14 +50,15 @@ class StatsPageState extends State<StatsPage> {
@override
Widget build(BuildContext context) {
// if (graphData.data != null) {
// graphData.getGraphData('total_last_week').then((val) {
// totalLastWeek = val;
// setState(() {
// // update view
// });
// });
// }
if (graphData.data.length == 0) {
graphData.getGraphData('total_last_week').then((fetchedData) {
displayedGraphData = (fetchedData);
for (int i = 0; i < fetchedData[0].data.length; i++) {
print(fetchedData[0].data[i].time); // this is getting very frustrating
}
setState(() {});
});
}
return PlatformScaffold(
appBar: AppBar(
@ -98,8 +99,10 @@ class StatsPageState extends State<StatsPage> {
height: 200,
// width: 250,
child: new TimeSeries(),
// child: new SimpleTimeSeriesChart(totalLastWeek),//seriesList: List<charts.Series>
// child: new TimeSeries(),
child: displayedGraphData != null ? new charts.TimeSeriesChart(displayedGraphData) : Container(), //List<Series<dynamic, DateTime>>
// child: new charts.TimeSeriesChart(displayedGraphData),
// child: new SimpleTimeSeriesChart(),//seriesList: List<charts.Series>
),
],