Skip to content

FLUT-965284 - [Feature] Added Gauges UG improvement changes in hotfix branch. #1296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: hotfix/hotfix-v30.1.37
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Flutter/linear-gauge/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,3 @@ Both the shape and widget marker pointers have the same set of properties and be
### Marker pointer with `bounceOut` animation

![Animate marker pointer in linear gauge](images/animation/shape-pointer/bounceout.gif)





29 changes: 28 additions & 1 deletion Flutter/linear-gauge/bar-pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,31 @@ You can add multiple bar pointers in a [`LinearGauge`](https://pub.dev/documenta

{% endhighlight %}

![Add multiple bar pointers in a linear gauge](images/bar-pointer/multiple_bar_pointer.PNG)
![Add multiple bar pointers in a linear gauge](images/bar-pointer/multiple_bar_pointer.PNG)

## Animation completed callback

The [`onAnimationCompleted`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearBarPointer/onAnimationCompleted.html) callback in the [`LinearBarPointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearBarPointer-class.html) will be triggered when the bar pointer animation is completed. The default value of the [onAnimationCompleted](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearBarPointer/onAnimationCompleted.html) callback is `null`.

{% highlight dart %}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: SfLinearGauge(
barPointer:[
LinearBarPointer(
onAnimationCompleted: () {
print("Bar Pointer animation is completed");
},
),
],
),
),
),
);
}

{% endhighlight %}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Flutter/linear-gauge/interaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The shape and widget marker pointers in a Linear Gauge can be moved from one val

## Interaction with marker pointers

The `onChanged` callback enables you to change the value of marker pointers at runtime through user interaction.
The [`onChanged`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChanged.html) callback enables you to change the value of marker pointers at runtime through user interaction.

The following code sample demonstrates how to update a simple marker pointer value based on swipe or drag gestures:

Expand Down
38 changes: 38 additions & 0 deletions Flutter/linear-gauge/range.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,44 @@ However, to draw concave, convex and exponential-like shapes the [`midValue`](ht

![Draw linear gauge concave range](images/gauge-range/range-concave.png)

## Customize edge style

The [`edgeStyle`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearGaugeRange/edgeStyle.html) property defines the appearance of [`LinearGaugeRange`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearGaugeRange-class.html) with either sharp or curved edges. The available options are `startCurve`, `endCurve`, `bothCurve`, and `bothFlat`.

The default value is `bothFlat`.

{% highlight dart %}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Container(
width: 400,
height: 120,
child: SfLinearGauge(
ranges: [
LinearGaugeRange(
startValue: 0,
startWidth: 20,
endWidth: 20,
endValue: 70,
edgeStyle: LinearEdgeStyle.bothCurve,
color: Colors.blue,
),
],
),
),
),
),
);
}

{% endhighlight %}

![Change the gauge range edge style](images/gauge-range/edge_style.png)

## Customize color of a range

The color of a range can be changed by setting the [`color`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearGaugeRange/color.html) property of a range. The below code example demonstrates changing the color property of the range.
Expand Down
31 changes: 29 additions & 2 deletions Flutter/linear-gauge/shape-marker-pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ In addition to position the shape pointer, it is also possible to change the off

## Drag behavior

You can drag the pointers freely to any position when adding multiple pointers by setting the `dragBehavior` property to `LinearMarkerDragBehavior.free`.
You can drag the pointers freely to any position when adding multiple pointers by setting the [`dragBehavior`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/dragBehavior.html) property to `LinearMarkerDragBehavior.free`.

The `LinearMarkerDragBehavior.constrained` can be used to limit the active pointer dragging beyond the other pointers.

Expand Down Expand Up @@ -331,7 +331,7 @@ The `LinearMarkerDragBehavior.constrained` can be used to limit the active point

## Handle onChangeStart, onChanged, and onChangeEnd callbacks

The [`LinearShapePointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer-class.html) provides the `onChangeStart`, `onChanged`, and `onChangeEnd` callbacks. The `onChangeStart` callback will be called when the user start dragging the pointer, the `onChanged` callback will be called when dragging the pointer and the `onChangeEnd` callback will be called when the user stops the pointer dragging.
The [`LinearShapePointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer-class.html) provides the [`onChangeStart`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChangeStart.html), [`onChanged`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChanged.html), and [`onChangeEnd`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChangeEnd.html) callbacks. The [`onChangeStart`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChangeStart.html) callback will be called when the user start dragging the pointer, the [`onChanged`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChanged.html) callback will be called when dragging the pointer and the [`onChangeEnd`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onChangeEnd.html) callback will be called when the user stops the pointer dragging.

{% highlight dart %}

Expand Down Expand Up @@ -363,3 +363,30 @@ The [`LinearShapePointer`](https://pub.dev/documentation/syncfusion_flutter_gaug
}

{% endhighlight %}

## Animation completed callback

The [`onAnimationCompleted`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onAnimationCompleted.html) callback in the [`LinearShapePointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer-class.html) will be triggered when the shape pointer animation is completed. The default value of the [onAnimationCompleted](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearShapePointer/onAnimationCompleted.html) callback is `null`.

{% highlight dart %}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: SfLinearGauge(
markerPointers:[
LinearShapePointer(
onAnimationCompleted: () {
print("Shape Pointer animation is completed");
},
),
],
),
),
),
);
}

{% endhighlight %}
31 changes: 29 additions & 2 deletions Flutter/linear-gauge/widget-marker-pointer.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ In addition to position the widget marker pointer, it is also possible to change

## Drag behavior

You can drag the pointers freely to any position when adding multiple pointers by setting the `dragBehavior` property to `LinearMarkerDragBehavior.free`.
You can drag the pointers freely to any position when adding multiple pointers by setting the [`dragBehavior`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/dragBehavior.html) property to `LinearMarkerDragBehavior.free`.

The `LinearMarkerDragBehavior.constrained` can be used to limit the active pointer dragging beyond the other pointers.

Expand Down Expand Up @@ -218,7 +218,7 @@ The `LinearMarkerDragBehavior.constrained` can be used to limit the active point

## Handle onChangeStart, onChanged, and onChangeEnd callbacks

The [`LinearWidgetPointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer-class.html) provides the `onChangeStart`, `onChanged`, and `onChangeEnd` callbacks. The `onChangeStart` callback will be called when the user start dragging the pointer, the `onChanged` callback will be called when dragging the pointer and the `onChangeEnd` callback will be called when the user stops the pointer dragging.
The [`LinearWidgetPointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer-class.html) provides the [`onChangeStart`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onChangeStart.html), [`onChanged`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onChanged.html), and [`onChangeEnd`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onChangeEnd.html) callbacks. The [`onChangeStart`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onChangeStart.html) callback will be called when the user start dragging the pointer, the [`onChanged`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onChanged.html) callback will be called when dragging the pointer and the [`onChangeEnd`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onChangeEnd.html) callback will be called when the user stops the pointer dragging.

{% highlight dart %}

Expand Down Expand Up @@ -250,3 +250,30 @@ The [`LinearWidgetPointer`](https://pub.dev/documentation/syncfusion_flutter_gau
}

{% endhighlight %}

## Animation completed callback

The [`onAnimationCompleted`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onAnimationCompleted.html) callback in the [`LinearWidgetPointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer-class.html) will be triggered when the widget pointer animation is completed. The default value of the [onAnimationCompleted](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/LinearWidgetPointer/onAnimationCompleted.html) callback is `null`.

{% highlight dart %}

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: SfLinearGauge(
markerPointers:[
LinearWidgetPointer(
onAnimationCompleted: () {
print("Widget Pointer animation is completed");
},
),
],
),
),
),
);
}

{% endhighlight %}
2 changes: 1 addition & 1 deletion Flutter/radial-gauge/animation.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@ The animation type can be changed using the [`animationType`](https://pub.dev/do

{% endhighlight %}

![pointer animation](images/animation/animation.gif)
![pointer animation](images/animation/animation.gif)
2 changes: 1 addition & 1 deletion Flutter/radial-gauge/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ The [`onAxisTapped`](https://pub.dev/documentation/syncfusion_flutter_gauges/lat

## Custom scale

[`Radial gauge`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/SfRadialGauge-class.html) allows you to display a set of values along with a custom scale based on your business logic using the [`onCreateAxisRenderer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/RadialAxis/onCreateAxisRenderer.html) event of the axis. The `onCreateAxisRenderer` event allows returning the custom renderer for the axis. In that, we can override methods of `RadialAxisRenderer` to create the custom axis.
[`Radial gauge`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/SfRadialGauge-class.html) allows you to display a set of values along with a custom scale based on your business logic using the [`onCreateAxisRenderer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/RadialAxis/onCreateAxisRenderer.html) event of the axis. The [`onCreateAxisRenderer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/RadialAxis/onCreateAxisRenderer.html) event allows returning the custom renderer for the axis. In that, we can override methods of `RadialAxisRenderer` to create the custom axis.

{% highlight dart %}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions Flutter/radial-gauge/pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,47 @@ Pointers can be dragged over the scale to change their values interactively. Thi

{% endhighlight %}

The [`onCreatePointerRenderer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/MarkerPointer/onCreatePointerRenderer.html) callback allows you to create a custom pointer in the radial gauge. This callback is available for both the [`NeedlePointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/NeedlePointer-class.html) or [`MarkerPointer`](https://pub.dev/documentation/syncfusion_flutter_gauges/latest/gauges/MarkerPointer-class.html) types.

{% highlight dart %}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SfRadialGauge(
axes: <RadialAxis>[
RadialAxis(
pointers: <GaugePointer>[
MarkerPointer(
value: 70,
onCreatePointerRenderer: () {
return _CustomPointerRenderer();
},
),
],
),
],
),
),
);
}

class _CustomPointerRenderer extends MarkerPointerRenderer {
@override
void drawPointer(
Canvas canvas,
PointerPaintingDetails pointerPaintingDetails,
SfGaugeThemeData gaugeThemeData,
) {
canvas.drawCircle(
pointerPaintingDetails.startOffset,
10,
Paint()..color = Colors.red,
);
}
}

{% endhighlight %}

![create pointer callback](images/pointers/on-create-pointer-renderer.png)