Skip to content

Commit 74a9fd0

Browse files
committed
custom gauge directives docs added
1 parent 73128c7 commit 74a9fd0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,27 @@ export class AppComponent {
110110
```
111111
The keys in the threshold object signifies the minimum value at which the color will be applied. For instance, if the gauge's current value is `53.2`, then orange color will be applied because after point `40` every value will be displayed as `orange`, until next threshold is encountered. In this example `75.5` is the next threshold.
112112

113+
## Custom Directives for display text
114+
Sometimes setting a property value on `<ngx-gauge>` does not solve your purpose. You may want to add custom HTML for displaying `value`,`append`, `prepend` and `label` texts. In order to provide custom templates for these properties display following directives can be used.
115+
116+
```html
117+
<ngx-gauge [value]="currentValue">
118+
<ngx-gauge-append>
119+
<!-- custom append text or HTML goes here -->
120+
</ngx-gauge-append>
121+
<ngx-gauge-label>
122+
<!-- custom label text or HTML goes here -->
123+
</ngx-gauge-label>
124+
<ngx-gauge-prepend>
125+
<!-- custom prepend text or HTML goes here -->
126+
</ngx-gauge-prepend>
127+
<ngx-gauge-value>
128+
{{ currentValue * Math.PI | number }}
129+
</ngx-gauge-value>
130+
</ngx-gauge>
131+
```
132+
Note that `value` attribute is still required on `<ngx-gauge>` even when you are providing custom template using `<ngx-gauge-value>`. Because `value` attribute is responsible for calculating the gauge's drawing on a scale.
133+
113134
<!-- # Playground
114135
115136
The examples section is redesigned as a playground where you can play with Gauge by tuning its different parameters.

0 commit comments

Comments
 (0)