Skip to content
Merged
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
2 changes: 1 addition & 1 deletion extras/log_file_client/lib/components/app_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AppDrawer extends StatelessWidget {
child: Image.asset('lib/assets/oap.png'),
),

// CSV files that can be opened
// Log files that can be opened
Expanded(
child: ListView.builder(
itemCount: logList.length,
Expand Down
18 changes: 11 additions & 7 deletions extras/log_file_client/lib/components/graph_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import 'package:log_file_client/utils/http_client.dart';
import 'package:syncfusion_flutter_charts/charts.dart';

class GraphView extends StatefulWidget {
const GraphView({required this.csvPath, required this.httpClient, super.key});
const GraphView({
required this.filePath,
required this.httpClient,
super.key,
});

final String csvPath;
final String filePath;
final HttpClient httpClient;

@override
Expand All @@ -17,7 +21,7 @@ class _GraphViewState extends State<GraphView> {
late final Future<List<LogDataLine>> logData = getLogData();

Future<List<LogDataLine>> getLogData() async {
final table = await widget.httpClient.getLogData(widget.csvPath);
final table = await widget.httpClient.getLogData(widget.filePath);
return table!;
}

Expand Down Expand Up @@ -85,7 +89,7 @@ class _GraphViewState extends State<GraphView> {
name: 'temp',
dataSource: logData,
xValueMapper: (LogDataLine log, _) => log.time,
yValueMapper: (LogDataLine log, _) => log.temp,
yValueMapper: (LogDataLine log, _) => log.tempMean,
color: Colors.blue,
yAxisName: 'TemperatureAxis',
),
Expand All @@ -94,7 +98,7 @@ class _GraphViewState extends State<GraphView> {
name: 'temp setpoint',
dataSource: logData,
xValueMapper: (LogDataLine log, _) => log.time,
yValueMapper: (LogDataLine log, _) => log.tempSetpoint,
yValueMapper: (LogDataLine log, _) => log.tempTarget,
dashArray: <double>[5, 5],
color: Colors.blue,
yAxisName: 'TemperatureAxis',
Expand All @@ -104,7 +108,7 @@ class _GraphViewState extends State<GraphView> {
name: 'pH',
dataSource: logData,
xValueMapper: (LogDataLine log, _) => log.time,
yValueMapper: (LogDataLine log, _) => log.pH,
yValueMapper: (LogDataLine log, _) => log.phCurrent,
color: Colors.green,
yAxisName: 'pHAxis',
),
Expand All @@ -113,7 +117,7 @@ class _GraphViewState extends State<GraphView> {
name: 'pH setpoint',
dataSource: logData,
xValueMapper: (LogDataLine log, _) => log.time,
yValueMapper: (LogDataLine log, _) => log.pHSetpoint,
yValueMapper: (LogDataLine log, _) => log.phTarget,
dashArray: <double>[5, 5],
color: Colors.green,
yAxisName: 'pHAxis',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:log_file_client/utils/http_client.dart';

class CsvView extends StatelessWidget {
CsvView({required this.csvPath, required this.httpClient, super.key});
class TableView extends StatelessWidget {
TableView({required this.filePath, required this.httpClient, super.key});

final String csvPath;
final String filePath;
final HttpClient httpClient;
late final Future<List<LogDataLine>> logData = getLogData();

Future<List<LogDataLine>> getLogData() async {
final table = await httpClient.getLogData(csvPath);
final table = await httpClient.getLogData(filePath);
return table!;
}

@override
Widget build(BuildContext context) {
return FutureBuilder<List<LogDataLine>>(
future: logData, // Assuming this fetches a List<LogDataLine>
future: logData,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
Expand All @@ -39,63 +39,57 @@ class CsvView extends StatelessWidget {
child: Row(
children: const [
Expanded(
flex: 2,
child: Text(
'time',
'Version',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'tankid',
'Tank ID',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
flex: 2,
child: Text(
'temp',
'Time',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'temp setpoint',
'Temp Target',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'pH',
'Temp Mean',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'pH setpoint',
'Temp Standard Deviation',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'onTime',
'pH Target',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'Kp',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'Ki',
'pH',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expanded(
child: Text(
'Kd',
'onTime',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
Expand All @@ -119,22 +113,21 @@ class CsvView extends StatelessWidget {
),
child: Row(
children: [
Expanded(child: Text(row.version.toString())),
Expanded(child: Text(row.tankid.toString())),
Expanded(
flex: 2,
child: Text(
row.time.toString(),
style: const TextStyle(fontSize: 16),
),
),
Expanded(child: Text(row.tankid.toString())),
Expanded(child: Text(row.temp.toString())),
Expanded(child: Text(row.tempSetpoint.toString())),
Expanded(child: Text(row.pH.toString())),
Expanded(child: Text(row.pHSetpoint.toString())),
Expanded(child: Text(row.tempTarget.toString())),
Expanded(child: Text(row.tempMean.toString())),
Expanded(child: Text(row.tempStdDev.toString())),
Expanded(child: Text(row.phTarget.toString())),
Expanded(child: Text(row.phCurrent.toString())),
Expanded(child: Text(row.onTime.toString())),
Expanded(child: Text(row.kp.toString())),
Expanded(child: Text(row.ki.toString())),
Expanded(child: Text(row.kd.toString())),
],
),
);
Expand Down
4 changes: 2 additions & 2 deletions extras/log_file_client/lib/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class _HomePageState extends State<HomePage> {
unawaited(_getLogList());
}

// Fetches the list of csv files available
// Fetches the list of log files available
Future<void> _getLogList() async {
final result = await httpClient.getLogList();
setState(() {
Expand Down Expand Up @@ -61,7 +61,7 @@ class _HomePageState extends State<HomePage> {
? const CircularProgressIndicator()
: _openedLogIndex >= 0
? GraphView(
csvPath: _logList![_openedLogIndex].uri,
filePath: _logList![_openedLogIndex].uri,
httpClient: httpClient,
)
: null,
Expand Down
Loading
Loading