forked from eatvio/eatvio_app
feat(insights): review fixes
This commit is contained in:
@@ -18,7 +18,13 @@ class BmiChart extends StatelessWidget {
|
||||
return InsightsChartPlaceholder(text: model.deltaText);
|
||||
}
|
||||
final s = S.of(context);
|
||||
final range = paddedRange(points.map((e) => e.value), minPadding: 2);
|
||||
final dataRange = paddedRange(points.map((e) => e.value), minPadding: 2);
|
||||
// Ось всегда покрывает зоны нормы/избытка/ожирения, иначе при ИМТ ≈30
|
||||
// зелёная полоса 18.5–25 уезжает за нижний край графика.
|
||||
const zoneMin = 18.5;
|
||||
const zoneMax = 40.0;
|
||||
final min = dataRange.min < zoneMin ? dataRange.min : zoneMin;
|
||||
final max = dataRange.max > zoneMax ? dataRange.max : zoneMax;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -27,13 +33,13 @@ class BmiChart extends StatelessWidget {
|
||||
height: insightsChartHeight,
|
||||
child: SfCartesianChart(
|
||||
key: const Key('insights_bmi_chart'),
|
||||
margin: EdgeInsets.zero,
|
||||
margin: insightsChartMargin,
|
||||
plotAreaBorderWidth: 0,
|
||||
primaryXAxis: buildInsightsCategoryAxis(),
|
||||
primaryXAxis: buildInsightsIndexAxis(model.labels),
|
||||
primaryYAxis: buildInsightsValueAxis(
|
||||
unit: s.insights_unit_bmi,
|
||||
min: range.min,
|
||||
max: range.max,
|
||||
min: min,
|
||||
max: max,
|
||||
plotBands: const [
|
||||
PlotBand(
|
||||
start: 18.5,
|
||||
@@ -53,12 +59,13 @@ class BmiChart extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
trackballBehavior: buildInsightsTrackball(),
|
||||
series: <CartesianSeries<InsightsPoint, String>>[
|
||||
SplineAreaSeries<InsightsPoint, String>(
|
||||
series: <CartesianSeries<InsightsPoint, num>>[
|
||||
SplineAreaSeries<InsightsPoint, num>(
|
||||
name: s.insights_tab_bmi,
|
||||
dataSource: points,
|
||||
xValueMapper: (point, _) => point.label,
|
||||
xValueMapper: (point, _) => point.index,
|
||||
yValueMapper: (point, _) => point.value,
|
||||
splineType: insightsSplineType,
|
||||
borderColor: InsightsColors.blue,
|
||||
borderWidth: 3,
|
||||
gradient: buildInsightsAreaGradient(InsightsColors.blue),
|
||||
|
||||
Reference in New Issue
Block a user