_mySfCartesianChart = SfCartesianChart(
palette: seriesColors,
//>GRAY X - Axis
primaryXAxis: _chartDateTimeAxis,
//>GRAY Y - Axis
primaryYAxis: NumericAxis(
enableAutoIntervalOnZooming: true,
plotOffset: 0,
majorGridLines: MajorGridLines(
width: 0.5, color: colorChart, dashArray: <double>[5, 5]),
isVisible: true,
majorTickLines: MajorTickLines(size: 3, width: 2, color: Colors.red),
minorTickLines:
MinorTickLines(size: 1, width: 1, color: Colors.grey[800]),
title: AxisTitle(
text:
'Diff Pressure (${measurementUnitList[_selectedMeasurementUnitIndex].toString()})',
textStyle: TextStyle(
color: colorChartLight,
//fontFamily: 'Roboto',
fontSize: 16,
fontFamily: "Source Sans Pro",
)),
axisLine: AxisLine(
color: colorChart,
width: 2,
),
minimum: _isPreviousChart
? (_pressureMin < -130 ? _pressureMin - 100 : -250)
: _pressureMin,
maximum: _isPreviousChart
? (_pressureMax > 300 ? _pressureMax + 100 : 400)
: _pressureMax,
zoomFactor: (_zoomFactor < 0)
? 0
: (_zoomFactor > 1)
? 1
: _zoomFactor,
zoomPosition: (_zoomPostion < 0)
? 0
: (_zoomPostion > 1)
? 1
: _zoomPostion,
),
//>GRAY Additional Axis
axes: <ChartAxis>[
// NumericAxis DateTimeAxis
DateTimeAxis(
name: 'yAxisZero',
//opposedPosition: true,
plotOffset: 0,
autoScrollingDeltaType: DateTimeIntervalType.hours,
interval: 10,
crossesAt: 0,
minimum: _dateMin,
maximum: _dateMax,
visibleMinimum: _rangeDateMin,
visibleMaximum: _rangeDateMax,
zoomFactor: (_zoomFactor < 0)
? 0
: (_zoomFactor > 1)
? 1
: _zoomFactor,
zoomPosition: (_zoomPostion < 0)
? 0
: (_zoomPostion > 1)
? 1
: _zoomPostion,
rangeController: _rangeController,
axisLine: AxisLine(
color: colorChart,
dashArray: [5, 5],
width: 3,
)
//title: AxisTitle(text: 'Secondary X Axis')
),
],
//>GRAY Title
title: ChartTitle(
text: myProject.value.projectId.toString() == ""
? "Empty"
: myProject.value.projectName.toString(),
textStyle: TextStyle(
color: Colors.white,
//fontFamily: 'Roboto',
fontSize: 22,
fontStyle: FontStyle.normal,
fontWeight: FontWeight.bold)),
//>GRAY Legend
legend: Legend(
isVisible: true,
isResponsive: true,
title: LegendTitle(
text: "Channels",
textStyle: TextStyle(
color: Colors.white,
fontFamily: "Source Sans Pro",
fontSize: 12,
),
),
textStyle: TextStyle(
color: Colors.white,
fontFamily: "Source Sans Pro",
fontSize: 10,
),
// Border color and border width of legend
borderColor: colorChartLight,
borderWidth: 2,
toggleSeriesVisibility: true,
),
zoomPanBehavior: _zoomPanBehavior,
trackballBehavior: _isEventSelect ? null : _trackballBehavior,
crosshairBehavior: CrosshairBehavior(
enable: _isEventSelect,
lineType: CrosshairLineType.both,
lineColor: Colors.white30),
enableAxisAnimation: true,
plotAreaBorderWidth: 0,
annotations: _chartAnnotations,
series: _myChartSeries,
onChartTouchInteractionDown: isChartSeriesEmpty
? null
: (ChartTouchInteractionArgs args) {
//>RED Do something only when Event Box was click
print("onChartTouchInteractionDown");
},
onActualRangeChanged: isChartSeriesEmpty
? null
: (ActualRangeChangedArgs args) {
//if (isChartSeriesEmpty) return;
if (args.axisName == 'primaryYAxis') {
//args.visibleMin = 10;
}
},
onZoomEnd: (ZoomPanArgs args) {
print(args.currentZoomFactor);
print(args.currentZoomPosition);
_zoomFactor = args.currentZoomFactor;
_zoomPostion = args.currentZoomPosition;
},
);