Skip to content

Commit

Permalink
Updated syncfusion to more uptodate version
Browse files Browse the repository at this point in the history
  • Loading branch information
hkbinaurics committed Feb 26, 2025
1 parent 4c0952a commit 9dc2f4e
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AudYoFloPlatformSpecificHtml extends AudYoFloPlatformSpecific {
}

@override
Future<void> triggerClose(AudYoFloBackendCache theBeCache) async {}
Future<void> triggerClose() async {}

// Allocate and return file drop widget - there is none at this time..
@override
Expand Down
105 changes: 45 additions & 60 deletions flutter/ayf_pack/lib/plot-widgets/ayf_property_plot_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AudYoFloPropertyPlot extends StatefulWidget {
final List<String> lineNamesInit;
final List<String> xShiftPropertiesInit;
final double maxShow;
final bool fastSeries;
// final bool fastSeries;
final String chartTitle;
/*
final List<double> xValues;
Expand All @@ -34,21 +34,22 @@ class AudYoFloPropertyPlot extends StatefulWidget {
final double minY;
final double maxY;

const AudYoFloPropertyPlot(
this.cpId, this.linePropertiesInit, this.lineNamesInit, this.maxShow, this.chartTitle,
const AudYoFloPropertyPlot(this.cpId, this.linePropertiesInit,
this.lineNamesInit, this.maxShow, this.chartTitle,
{this.logarithmicX = false,
this.logarithmicY = false,
this.titleXAxis,
this.titleYAxis,
this.titleYAxis,
this.minY = 0,
this.maxY = -1,
this.fastSeries = false,
// this.fastSeries = true,
this.xShiftPropertiesInit = const [],
super.key});

@override
State<StatefulWidget> createState() {
return _AudYoFloPropertyPlotState(linePropertiesInit, lineNamesInit, xShiftPropertiesInit, chartTitle);
return _AudYoFloPropertyPlotState(
linePropertiesInit, lineNamesInit, xShiftPropertiesInit, chartTitle);
}
}

Expand Down Expand Up @@ -77,7 +78,8 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
'tagPropertyPlot',
[]);

_AudYoFloPropertyPlotState(this.lineProperties, this.lineNames, this.xShiftPropertiesInit, this.chartTitle) {
_AudYoFloPropertyPlotState(this.lineProperties, this.lineNames,
this.xShiftPropertiesInit, this.chartTitle) {
// Set required member variable in base class
/*
super.cpId = JvxComponentIdentification(
Expand All @@ -88,12 +90,11 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>

// If some events do not reach the rebuild function, we can produce some
// additional output printfs
// dbgOutput = true;
// dbgOutput = true;
List<String> allProperties = List.from(lineProperties);
for(var elm in xShiftPropertiesInit)
{
if(elm.isNotEmpty){
allProperties.add(elm);
for (var elm in xShiftPropertiesInit) {
if (elm.isNotEmpty) {
allProperties.add(elm);
}
}
oneGroupPlotWidget = AudYoFloPropertyOnChangeOneGroup(allProperties);
Expand Down Expand Up @@ -145,23 +146,20 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
// If the the size requires an update, update
if (vecLength != xValues.length) {
double maxXVal = vecLength.toDouble();
if(widget.maxShow > 0)
{
if (widget.maxShow > 0) {
maxXVal = widget.maxShow;
}
xValues = new List<double>.generate(
vecLength, (i) => i * maxXVal / vecLength);
xValues =
new List<double>.generate(vecLength, (i) => i * maxXVal / vecLength);
}

for (int j = 0; j < lineProperties.length; j++) {
final String property = lineProperties[j];
String propertyOffset = '';
int offsetX = 0;
if(j < xShiftPropertiesInit.length)
{
if (j < xShiftPropertiesInit.length) {
final String entryProp = xShiftPropertiesInit[j];
if(entryProp.isNotEmpty)
{
if (entryProp.isNotEmpty) {
propertyOffset = entryProp;
}
}
Expand All @@ -174,16 +172,14 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
} else if (pp is AudYoFloPropertyMultiContentBackend<Float32List>?) {
propertyData =
pp as AudYoFloPropertyMultiContentBackend<Float32List>?;
}
}

var ppO = oneGroupPlotWidget!.extractPropMultiContent(propertyOffset);
AudYoFloPropertyMultiContentBackend? propertyDataOffset;
if (ppO is AudYoFloPropertyMultiContentBackend<Uint64List>?) {
propertyDataOffset = ppO;
if(propertyDataOffset != null)
{
if(propertyDataOffset.fldSz > 0)
{
if (propertyDataOffset != null) {
if (propertyDataOffset.fldSz > 0) {
offsetX = propertyDataOffset.fld[0];
}
}
Expand All @@ -196,18 +192,15 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
_chartData.update(nmShow, (data) {
data.clear();
for (int i = 0; i < xValues.length; i++) {

double value = 0;
if ((propertyData != null) && (i < propertyData.fldSz))
{
value = propertyData!.fld[i];
if ((propertyData != null) && (i < propertyData.fldSz)) {
value = propertyData!.fld[i];
}
// TODO NaN/Infinite workaround..
data.add(ChartData(
xValues[i] + offsetX, (value.isNaN || value.isInfinite) ? 0 : value));
data.add(ChartData(xValues[i] + offsetX,
(value.isNaN || value.isInfinite) ? 0 : value));
}
if(data.isEmpty)
{
if (data.isEmpty) {
data.add(ChartData(0, 0));
legendPostfix = '(no-data)';
}
Expand All @@ -216,16 +209,14 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
List<ChartData> data = <ChartData>[];
for (int i = 0; i < xValues.length; i++) {
double value = 0;
if ((propertyData != null) && (i < propertyData.fldSz))
{
value = propertyData!.fld[i];
if ((propertyData != null) && (i < propertyData.fldSz)) {
value = propertyData!.fld[i];
}
// TODO NaN/Infinite workaround..
data.add(ChartData(
xValues[i] + offsetX, (value.isNaN || value.isInfinite) ? 0 : value));
data.add(ChartData(xValues[i] + offsetX,
(value.isNaN || value.isInfinite) ? 0 : value));
}
if(data.isEmpty)
{
if (data.isEmpty) {
data.add(ChartData(0, 0));
legendPostfix = '(no-data)';
}
Expand Down Expand Up @@ -314,16 +305,13 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
//minorTicksPerInterval: 9, // NOTE minor ticks are logarithmically spaced (in data; so visually linear) unfortunately
);
} else {
if( widget.maxY > widget.minY)
{
if (widget.maxY > widget.minY) {
yAxis = NumericAxis(
title: AxisTitle(text: this.widget.titleYAxis),
minimum: widget.minY,
maximum: widget.maxY,
);
}
else
{
} else {
yAxis = NumericAxis(title: AxisTitle(text: this.widget.titleYAxis));
}
}
Expand All @@ -332,32 +320,29 @@ class _AudYoFloPropertyPlotState extends State<AudYoFloPropertyPlot>
for (final MapEntry<String, List<ChartData>> entry in _chartData.entries) {
String nameLocal = entry.key;
nameLocal = nameLocal + legendPostfix;
if(widget.fastSeries)
{
//if (widget.fastSeries) {
series.add(FastLineSeries<ChartData, double>(
name: nameLocal,
dataSource: entry.value,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y,
));
}
else{
series.add(LineSeries<ChartData, double>(
name: nameLocal,
dataSource: entry.value,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y,
));
}
//} else {
// series.add(LineSeries<ChartData, double>(
// name: nameLocal,
// dataSource: entry.value,
// xValueMapper: (ChartData data, _) => data.x,
// yValueMapper: (ChartData data, _) => data.y,
// ));
//}
}

// Update this widget if there is a notification in the uiModel
return Consumer<AudYoFloUiModel>(builder: (context, notifier, child) {
return SfCartesianChart(
title: ChartTitle(
text: chartTitle),
primaryXAxis: xAxis,
primaryYAxis: yAxis,
title: ChartTitle(text: chartTitle),
primaryXAxis: xAxis!,
primaryYAxis: yAxis!,
series: series,
legend: Legend(isVisible: true),
);
Expand Down
4 changes: 2 additions & 2 deletions flutter/ayf_pack/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
collection: ^1.16.0
fixnum: ^1.0.0

intl: ^0.17.0
intl: ^0.18.0

clipboard: ^0.1.3

Expand All @@ -35,7 +35,7 @@ dependencies:
path: '../ayf_webhost'

# Plot widgets
syncfusion_flutter_charts: ^21.2.4
syncfusion_flutter_charts: ^26.2.7

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ dependencies:
provider: ^6.0.3
collection: ^1.16.0
fixnum: ^1.0.0

intl: ^0.17.0


clipboard: ^0.1.3

flutter_dotenv: ^5.0.2
Expand Down

0 comments on commit 9dc2f4e

Please sign in to comment.