Circular chart methods
Methods in tooltipBehavior
Show method in tooltipBehavior
The show
method is used to activate the tooltip at the specified location.
SfCircularChart chart;
TooltipBehavior tooltip;
@override
Widget build(BuildContext context) {
final List<ChartData> chartData = [
ChartData(10, 17),
ChartData(20, 34),
// Add the required data
];
tooltip = TooltipBehavior (enable: true);
chart = SfCircularChart(
tooltipBehavior: tooltip,
series: <CircularSeries>[
ColumnSeries<ChartData, double>(
enableTooltip: true,
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y)
]
);
return Scaffold(
body: Center(
child: Column(
children: <Widget>[
FlatButton(
child: Text('Show'),
onPressed: show
),
Container(child: chart)
]
)
)
);
}
void show() {
tooltip.show(121,164);
}
void hide(){
tooltip.hide();
}
showByIndex method in tooltipBehavior
The showByIndex
method is used to Displays the tooltip at the specified series and point index.
The below mentioned arguments are given to the showByIndex
method:
seriesIndex
- index of the series for which the pointIndex is specified.
pointIndex
- index of the point for which the tooltip should be shown.
SfCircularChart chart;
TooltipBehavior tooltip;
@override
Widget build(BuildContext context) {
final List<ChartData> chartData = [
ChartData(10, 17),
ChartData(20, 34),
// Add the required data
];
tooltip = TooltipBehavior (enable: true);
chart = SfCircularChart(
tooltipBehavior: tooltip,
series: <CircularSeries>[
ColumnSeries<ChartData, double>(
enableTooltip: true,
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y)
]
);
return Scaffold(
body: Center(
child: Column(
children: <Widget>[
FlatButton(
child: Text('Show'),
onPressed:(){
tooltip.showByIndex(0,1);
}
),
Container(child: chart)
]
)
)
);
}
void hide(){
tooltip.hide();
}
showByPixel method in tooltipBehavior
The showByPixel
method is used to Displays the tooltip at the specified x and y-positions.
x & y - logical pixel values to position the tooltip.
SfCircularChart chart;
TooltipBehavior tooltip;
@override
Widget build(BuildContext context) {
final List<ChartData> chartData = [
ChartData(10, 17),
ChartData(20, 34),
// Add the required data
];
tooltip = TooltipBehavior (enable: true);
chart = SfCircularChart(
tooltipBehavior: tooltip,
series: <CircularSeries>[
ColumnSeries<ChartData, double>(
enableTooltip: true,
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y)
]
);
return Scaffold(
body: Center(
child: Column(
children: <Widget>[
FlatButton(
child: Text('Show'),
onPressed:(){
tooltip.showByPixel(230.0,470.0);
}
),
Container(child: chart)
]
)
)
);
}
void hide(){
tooltip.hide();
}
Hide method in tooltipBehavior
The hide
method is used to hide the displaying tooltip programmatically.
SfCircularChart chart;
TooltipBehavior tooltip;
@override
Widget build(BuildContext context) {
final List<ChartData> chartData = [
ChartData(10, 17),
ChartData(20, 34)
// Add the required data
];
tooltip = TooltipBehavior (enable: true);
chart = SfCircularChart(
tooltipBehavior: tooltip,
series: <CircularSeries>[
ColumnSeries<ChartData, double>(
enableTooltip: true,
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y)
]
);
return Scaffold(
body: Center(
child: Column(
children: <Widget>[
FlatButton(
child: Text('Hide'),
onPressed: hide
),
Container(child: chart)
]
)
)
);
}
void hide(){
tooltip.hide();
}
## Methods in selectionSettings
SelectionIndex method in selectionSettings
The selectionIndex
method is used to select the data point programmatically. The required arguments are listed below.
- pointIndex - specifies the point index value.
- seriesIndex - specifies the series index value.
- selectionType - specifies the
SelectionType
and this is an optional parameter. - multiSelect - bool property specifies the multiple selection and this is an optional parameter.
SfCircularChart chart;
SelectionSettings selection;
@override
Widget build(BuildContext context) {
final List<ChartData> chartData = [
hartData(10, 17),
ChartData(20, 34)
// Add the required data
];
selection = SelectionSettings(enable: true);
chart = SfCircularChart(
series: <CircularSeries>[
ColumnSeries<ChartData, double>(
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.x,
yValueMapper: (ChartData data, _) => data.y,
selectionSettings: selection
)
]
);
return Scaffold(
body: Center(
child: Column(
children: <Widget>[
FlatButton(
child: Text('Select'),
onPressed: select
),
Container(child: chart)
]
)
)
);
}
void select() {
selection.selectionIndex(1, 0);
}
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page