StackedBar100Series Data Labels Not Shown When More Than 2 Characters
Hi,
I'm having trouble with data labels not showing when they are more than 2 characters in length on StackedBar100Series.
Here's the code:
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
void main() {
runApp(MaterialApp(
home: ChartPage(),
));
}
class ChartPage extends StatefulWidget {
@override
_ChartPageState createState() => _ChartPageState();
}
class _ChartPageState extends State<ChartPage> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
List<StackedBarSeries<SingleStackedBarData, String>> chartData = [];
var data = [
SingleStackedBarData('Win Ratio', 45, Colors.red),
SingleStackedBarData('Win Ratio', 132, Colors.blue),
SingleStackedBarData('Win Ratio', 55, Colors.green),
];
data.forEach((element) => chartData.add(
StackedBarSeries<SingleStackedBarData, String>(
color: element.barColor,
dataSource: [element],
xValueMapper: (data, _) => data.axisLabel,
yValueMapper: (data, _) => data.value,
dataLabelSettings: DataLabelSettings(
isVisible: true,
),
)
));
return Scaffold(
appBar: AppBar(),
body: Container(
height: 75,
child: SfCartesianChart(
plotAreaBorderWidth: 0,
primaryXAxis: CategoryAxis(isVisible: false),
primaryYAxis: NumericAxis(isVisible: false),
series: chartData,
),
)
);
}
}
class SingleStackedBarData {
final String axisLabel;
final int value;
final Color barColor;
SingleStackedBarData(this.axisLabel, this.value, this.barColor);
}
StackedBar100Series - the label for '132' doesn't show
StackedBarSeries - works fine, you can see the label for '132'
SIGN IN To post a reply.
7 Replies
AL
Alex
May 26, 2020 12:50 PM UTC
Should note that this happens on both Chrome (Version 83.0.4103.61 (Official Build) (64-bit)) and Firefox (76.0.1 (64-bit).
I also thought I'd try using a dataLabelMapper:
dataLabelMapper: _dataLabelMapper,
String _dataLabelMapper(SingleStackedBarData data, int index) {
return 10.toString();
}
As expected the data labels are '10' but the middle, which was originally greater than 2 characters, is still missing:
SK
Sriram Kiran Senthilkumar
Syncfusion Team
May 27, 2020 10:44 AM UTC
Hi Alex,
Greetings from Syncfusion. We have analyzed your scenario and we are able to replicate the reported issue. We will consider this issue as a bug and will include the fix for the reported issue in the upcoming patch release which is expected to be rolled out on 2nd June 2020. We will update you once the release is rolled out. We appreciate your patience until then.
Regards,
Sriram Kiran.
AL
Alex
May 27, 2020 10:47 AM UTC
Thanks Sriram, very fast turn around!
SK
Sriram Kiran Senthilkumar
Syncfusion Team
May 28, 2020 07:48 AM UTC
Hi Alex,
Most welcome. As stated earlier, we will update you once the weekly patch release got rolled out.
Regards,
Sriram Kiran.
SK
Sriram Kiran Senthilkumar
Syncfusion Team
June 3, 2020 06:07 PM UTC
Hi Alex,
Thanks for your patience. The reported issue regarding the datalabels not rendering properly in the stackedBar100 series is fixed and included in the weekly patch release. To overcome the reported issue, kindly upgrade the chart widget package below.
Regards,
Sriram Kiran.
AL
Alex
June 12, 2020 07:37 AM UTC
Brilliant. That's working now. Thanks Sriram
SK
Sriram Kiran Senthilkumar
Syncfusion Team
June 15, 2020 12:07 PM UTC
Hi Alex,
Most welcome. We are always happy in assisting you. Kindly revert us if you have further queries.
Regards,
Sriram Kiran
SIGN IN To post a reply.
- 7 Replies
- 2 Participants
-
AL Alex
- May 26, 2020 08:07 AM UTC
- Jun 15, 2020 12:07 PM UTC