You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I don't define a builder, the trackball contents are displayed normally; however, when I define a builder myself, only the vertical line appears and the widget I created is not shown.
I use 28.1.35 version of syncfusion_flutter_charts
syncfusion_flutter_charts: ^28.1.35
Steps to reproduce
I was creating a chart using SfCartesianChart. I wanted to display detailed information about a specific x-axis using TrackballBehavior, and I was using TrackballDisplayMode.groupAllPoints to show the trackball content. Everything worked as expected until I defined a builder. However, the moment I explicitly defined a builder to change the monetary format in the trackball content, only the trackball’s vertical line appeared, and the detailed information did not show up. After checking the logs, I confirmed that all necessary data was successfully obtained from trackballDetails, leading me to suspect there is a bug with rendering the widget.
Code sample
Code sample
SfCartesianChart(
legend:Legend(
isVisible:true,
position:LegendPosition.bottom
),
trackballBehavior:TrackballBehavior(
enable:true,
activationMode:ActivationMode.singleTap,
tooltipDisplayMode:TrackballDisplayMode.groupAllPoints,
builder: (BuildContext context, TrackballDetails trackballDetails) {
final grouping = trackballDetails.groupingModeInfo;
if (grouping ==null) {
print("grouping == null");
returnconstSizedBox.shrink();
}
final points = grouping.points;
final seriesList = grouping.visibleSeriesList;
if (points.isEmpty) {
print("points.isEmpty");
returnconstSizedBox.shrink();
}
final firstPoint = points.first;
final xVal = firstPoint.x;
final headerText = xVal?.toString() ??'';
print("headerText = $headerText");
final rowWidgets =<Widget>[];
for (int i =0; i < points.length; i++) {
finalCartesianChartPoint point = points[i];
finaldynamic series = i < seriesList.length ? seriesList[i] :null;
final seriesName = (series?.name ??'').toString();
Color seriesColor =Colors.grey;
if (series isXyDataSeries) {
seriesColor = series.color ??Colors.grey;
}
final yVal = point.y;
if (yVal ==null) continue;
String displayValue;
if (seriesName =='수납률') {
displayValue ='${yVal.toStringAsFixed(0)}%';
} else {
displayValue =StringUtil.currencyFormat(yVal.toInt());
}
print("seriesName = $seriesName");
print("displayValue = $displayValue");
rowWidgets.add(_buildTrackballItem(seriesName, displayValue, seriesColor));
}
returnContainer(
padding:constEdgeInsets.all(8),
decoration:BoxDecoration(
color:Colors.black87,
borderRadius:BorderRadius.circular(6),
),
child:Column(
mainAxisSize:MainAxisSize.min,
crossAxisAlignment:CrossAxisAlignment.start,
children: [
Text(
headerText,
style:constTextStyle(
color:Colors.white,
fontWeight:FontWeight.bold,
),
),
constDivider(color:Colors.white54),
...rowWidgets,
],
),
);
},
hideDelay:3000
),
primaryXAxis:CategoryAxis(
axisLabelFormatter: (AxisLabelRenderDetails args) {
finalString originalText = args.text;
String resultText = originalText;
final regex =RegExp(r'^(\d{4})년\s*(\d{1,2})월$');
final match = regex.firstMatch(originalText);
if (match !=null) {
final yearString = match.group(1)!; // 그룹 1: 년도final monthString = match.group(2)!; // 그룹 2: 월final year =int.parse(yearString);
final month =int.parse(monthString);
if (thisMonth.year == year) {
resultText ="$month월";
} else {
resultText ="${year % 100}-$month";
}
}
returnChartAxisLabel(
resultText,
args.textStyle
);
},
),
primaryYAxis:NumericAxis(
axisLabelFormatter: (AxisLabelRenderDetails details) {
finalnum valueInManWon = details.value /10000;
final labelString = valueInManWon.toStringAsFixed(0);
returnChartAxisLabel(labelString, details.textStyle);
},
),
axes:<ChartAxis>[
NumericAxis(
name:'percentageAxis', // 이 이름을 시리즈에서 referenceAxisName으로 사용함
opposedPosition:true, // 반대편(오른쪽)에 표시
labelFormat:'{value}%',
interval:25,
minimum:0,
maximum:100,
majorGridLines:MajorGridLines(width:0)
),
],
series:<CartesianSeries>[
StackedColumnSeries<MonthlyAnalyticsItemsData, String>(
dataSource: periodicAnalyticsItemsData.monthlyAnalyticsItemsDataList,
xValueMapper: (MonthlyAnalyticsItemsData data, _) =>StringUtil.dateFormat(data.month),
yValueMapper: (MonthlyAnalyticsItemsData data, _) => data.amountReceived,
name:'실 수납',
color:AnalyticsConstant.paidColor,
animationDuration:900,
),
StackedColumnSeries<MonthlyAnalyticsItemsData, String>(
dataSource: periodicAnalyticsItemsData.monthlyAnalyticsItemsDataList,
xValueMapper: (MonthlyAnalyticsItemsData data, _) =>StringUtil.dateFormat(data.month),
yValueMapper: (MonthlyAnalyticsItemsData data, _) => data.unpaid,
name:'미납',
color:AnalyticsConstant.unpaidColor,
animationDuration:900,
),
if (hasFuture)
StackedColumnSeries<MonthlyAnalyticsItemsData, String>(
dataSource: periodicAnalyticsItemsData.monthlyAnalyticsItemsDataList,
xValueMapper: (MonthlyAnalyticsItemsData data, _) =>StringUtil.dateFormat(data.month),
yValueMapper: (MonthlyAnalyticsItemsData data, _) => data.notComing,
name:'예정',
color:AnalyticsConstant.notComingColor,
animationDuration:900,
),
LineSeries<MonthlyAnalyticsItemsData, String>(
// 수납률 데이터를 표시할 시리즈
dataSource: periodicAnalyticsItemsData.monthlyAnalyticsItemsDataList,
xValueMapper: (MonthlyAnalyticsItemsData data, _) =>StringUtil.dateFormat(data.month),
yValueMapper: (MonthlyAnalyticsItemsData data, _) => data.amountReceived / data.totalPayment *100,
name:'수납률',
// 수납률은 보조 축을 쓴다고 명시 ("percentageAxis"라는 이름으로 정의한 축 사용)
yAxisName:'percentageAxis',
markerSettings:MarkerSettings(
isVisible:true,
height:6,
width:6,
),
color:Color.fromARGB(255, 3, 71, 134),
animationDuration:1200,
),
],
),
Bug description
When I don't define a builder, the trackball contents are displayed normally; however, when I define a builder myself, only the vertical line appears and the widget I created is not shown.
I use
28.1.35
version of syncfusion_flutter_chartsSteps to reproduce
I was creating a chart using SfCartesianChart. I wanted to display detailed information about a specific x-axis using TrackballBehavior, and I was using TrackballDisplayMode.groupAllPoints to show the trackball content. Everything worked as expected until I defined a builder. However, the moment I explicitly defined a builder to change the monetary format in the trackball content, only the trackball’s vertical line appeared, and the detailed information did not show up. After checking the logs, I confirmed that all necessary data was successfully obtained from trackballDetails, leading me to suspect there is a bug with rendering the widget.
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
<Trackball contents are displayed - no custom builder>
<Trackball contents are not displayed - custom builder>
<Logs with custom builder (logged by code sample)>
Stack Traces
Stack Traces
No stack traces (not exception)
On which target platforms have you observed this bug?
iOS
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: