my problem situation:
I have 5 lines and I get
data from an api, and these data are the highest 5 CPU usage at that moment. Since these cpu names have changed, I cannot assign them to the name. I need to show these cpu process names in trackball dynamicly.
SfCartesianChart(
onTrackballPositionChanging: (TrackballArgs args) {
// We have rendered the series name along with the y value of the series in the
//trackball’s tooltip.
// If you have a unique name for every process that keeps on changing dynamically,
// then return it from your API and you can use that name here instead of
// 'args.chartPointInfo.series.name' value in the args.chartPointInfo.label variable.
args.chartPointInfo.label =
'${args.chartPointInfo.series.name}\nMemory: ${args.chartPointInfo.chartDataPoint.y.toInt()}%';
},
primaryXAxis: CategoryAxis(),
series: <ChartSeries<ProcessData, String>>[
LineSeries<ProcessData, String>(
name: 'Process1', //Dummy name
dataSource: Process1Data,
xValueMapper: (ProcessData data, _) => data.time,
yValueMapper: (ProcessData data, _) => data.memory,
),
LineSeries<ProcessData, String>(
name: 'Process2',
dataSource: Process2Data
xValueMapper: (ProcessData data, _) => data.time,
yValueMapper: (ProcessData data, _) => data.memory,
),
LineSeries<ProcessData, String>(
name: 'Process3',
dataSource: Process3Data,
xValueMapper: (ProcessData data, _) => data.time,
yValueMapper: (ProcessData data, _) => data.memory,
),
LineSeries<ProcessData, String>(
name: 'Process4',
dataSource: Process4Data,
xValueMapper: (ProcessData data, _) => data.time,
yValueMapper: (ProcessData data, _) => data.memory,
),
LineSeries<ProcessData, String>(
name: 'Process5',
dataSource: Process5Data,
xValueMapper: (ProcessData data, _) => data.time,
yValueMapper: (ProcessData data, _) => data.memory,
)
]
// other configurations
) |