|
26 | 26 | * <li>.tooltipFn(d) - user defined function to customize the tool tip (optional)
|
27 | 27 | * <li>.centerLabelFn - user defined function to customize the text of the center label (optional)
|
28 | 28 | * <li>.onClickFn(d,i) - user defined function to handle when donut arc is clicked upon.
|
| 29 | + * <li>.labelConfig - object containing properties for external label (optional) - default: undefined |
| 30 | + * <ul> |
| 31 | + * <li>.orientation - string with possible values: 'left', 'right' (optional) - default: 'center' |
| 32 | + * <li>.title - string representing a prefix or title (optional) - default: empty string |
| 33 | + * <li>.label - the wording format to display, possible values: 'used', 'available', 'percent', 'none' (optional) - default: 'used' |
| 34 | + * <li>.units - unit label for values, ex: 'MHz','GB', etc.. (optional) - default: empty string |
| 35 | + * <li>.labelFn - function to customize the text of the external label (optional) - default: undefined |
| 36 | + * </ul> |
| 37 | + * </li> |
29 | 38 | * </ul>
|
30 | 39 | *
|
31 | 40 | * @param {object} data the Total and Used values for the donut chart. Available is calculated as Total - Used.<br/>
|
|
62 | 71 | <div class="row">
|
63 | 72 | <div class="col-md-3 text-center">
|
64 | 73 | <label>Error Threshold</label>
|
65 |
| - <pf-donut-pct-chart config="configErr" data="dataErr" chart="chartErr"></pf-donut-pct-chart> |
| 74 | + <p class="text-right"> |
| 75 | + <pf-donut-pct-chart config="configErr" data="dataErr" chart="chartErr"></pf-donut-pct-chart> |
| 76 | + </p> |
66 | 77 | </div>
|
67 |
| - <div class="col-md-3 text-center""> |
| 78 | + <div class="col-md-3 text-center"> |
68 | 79 | <label>Warning Threshold</label>
|
69 | 80 | <pf-donut-pct-chart config="configWarn" data="dataWarn"></pf-donut-pct-chart>
|
70 | 81 | </div>
|
71 |
| - <div class="col-md-3 text-center""> |
| 82 | + <div class="col-md-3 text-center"> |
72 | 83 | <label class="camelcase">{{threshLabel}} Threshold</label>
|
73 |
| - <pf-donut-pct-chart config="configDynamic" data="dataDynamic" center-label="labelDynamic" |
74 |
| - on-threshold-change="thresholdChanged(threshold)"> |
75 |
| - </pf-donut-pct-chart> |
| 84 | + <p class="text-left"> |
| 85 | + <pf-donut-pct-chart config="configDynamic" data="dataDynamic" center-label="labelDynamic" |
| 86 | + on-threshold-change="thresholdChanged(threshold)"> |
| 87 | + </pf-donut-pct-chart> |
| 88 | + </p> |
76 | 89 | </div>
|
77 |
| - <div class="col-md-3 text-center""> |
| 90 | + <div class="col-md-3 text-center"> |
78 | 91 | <label>No Threshold</label>
|
79 | 92 | <pf-donut-pct-chart config="configNoThresh" data="dataNoThresh"></pf-donut-pct-chart>
|
80 | 93 | </div>
|
|
88 | 101 |
|
89 | 102 | <div class="row">
|
90 | 103 | <div class="col-md-3 text-center">
|
91 |
| - <pf-donut-pct-chart config="usedConfig" data="usedData" center-label="usedLabel"></pf-donut-pct-chart> |
92 | 104 | <label>center-label = 'used'</label>
|
| 105 | + <pf-donut-pct-chart config="usedConfig" data="usedData" center-label="usedLabel"></pf-donut-pct-chart> |
93 | 106 | </div>
|
94 | 107 | <div class="col-md-3 text-center">
|
95 |
| - <pf-donut-pct-chart config="availConfig" data="availData" center-label="availLabel"></pf-donut-pct-chart> |
96 | 108 | <label>center-label = 'available'</label>
|
| 109 | + <pf-donut-pct-chart config="availConfig" data="availData" center-label="availLabel"></pf-donut-pct-chart> |
97 | 110 | </div>
|
98 | 111 | <div class="col-md-3 text-center">
|
99 |
| - <pf-donut-pct-chart config="pctConfig" data="pctData" center-label="pctLabel"></pf-donut-pct-chart> |
100 | 112 | <label>center-label = 'percent'</label>
|
| 113 | + <pf-donut-pct-chart config="pctConfig" data="pctData" center-label="pctLabel"></pf-donut-pct-chart> |
101 | 114 | </div>
|
102 | 115 | <div class="col-md-3 text-center">
|
| 116 | + <label>center-label = 'none'</label> |
103 | 117 | <pf-donut-pct-chart config="noneConfig" data="noneData" center-label="noLabel"></pf-donut-pct-chart>
|
104 |
| - <label>center-label = ' none'</label> |
| 118 | + </div> |
| 119 | + </div> |
| 120 | +
|
| 121 | + <div class="row"> |
| 122 | + <div class="col-md-12"> |
| 123 | + <hr> |
| 124 | + </div> |
| 125 | + </div> |
| 126 | +
|
| 127 | + <div class="row"> |
| 128 | + <div class="col-md-4 text-center"> |
| 129 | + <label>Sized with orientation left 'configLabel'</label> |
| 130 | + <p class="text-right"> |
| 131 | + <pf-donut-pct-chart config="configOrientationLeft" data="dataOrientationLeft"></pf-donut-pct-chart> |
| 132 | + </p> |
| 133 | + </div> |
| 134 | + <div class="col-md-4 text-center"> |
| 135 | + <label>Sized with 'configLabel'</label> |
| 136 | + <pf-donut-pct-chart config="configOrientationCenter" data="dataOrientationCenter"></pf-donut-pct-chart> |
| 137 | + </div> |
| 138 | + <div class="col-md-4 text-center"> |
| 139 | + <label>Sized with orientation right 'configLabel'</label> |
| 140 | + <p class="text-left"> |
| 141 | + <pf-donut-pct-chart config="configOrientationRight" data="dataOrientationRight"></pf-donut-pct-chart> |
| 142 | + </p> |
105 | 143 | </div>
|
106 | 144 | </div>
|
107 | 145 |
|
|
120 | 158 | </div>
|
121 | 159 | <div class="row">
|
122 | 160 | <div class="col-md-3">
|
123 |
| - <form role="form""> |
| 161 | + <form role="form"> |
124 | 162 | <div class="form-group">
|
125 | 163 | <label class="checkbox-inline">
|
126 | 164 | <input type="checkbox" ng-model="custData.dataAvailable">Data Available</input>
|
|
144 | 182 |
|
145 | 183 | <file name="script.js">
|
146 | 184 | angular.module( 'patternfly.charts' ).controller( 'ChartCtrl', function( $scope, $interval ) {
|
| 185 | + // start demo 1st row |
147 | 186 | $scope.configErr = {
|
148 | 187 | 'chartId': 'chartErr',
|
149 | 188 | 'units': 'GB',
|
150 |
| - 'thresholds':{'warning':'60','error':'90'} |
| 189 | + 'thresholds':{'warning':'60','error':'90'}, |
| 190 | + 'centerLabelFn': function () { |
| 191 | + return $scope.dataErr.used + "GB"; |
| 192 | + } |
151 | 193 | };
|
152 | 194 |
|
153 | 195 | $scope.dataErr = {
|
|
160 | 202 | $scope.configWarn = {
|
161 | 203 | 'chartId': 'chartWarn',
|
162 | 204 | 'units': 'GB',
|
163 |
| - 'thresholds':{'warning':'60','error':'90'} |
| 205 | + 'thresholds':{'warning':'60','error':'90'}, |
| 206 | + 'centerLabelFn': function () { |
| 207 | + return $scope.dataWarn.used + "GB"; |
| 208 | + } |
164 | 209 | };
|
165 | 210 |
|
166 | 211 | $scope.dataWarn = {
|
|
171 | 216 | $scope.configDynamic = {
|
172 | 217 | 'chartId': 'chartOk',
|
173 | 218 | 'units': 'GB',
|
174 |
| - 'thresholds':{'warning':'60','error':'90'} |
| 219 | + 'thresholds':{'warning':'60','error':'90'}, |
| 220 | + 'centerLabelFn': function () { |
| 221 | + return $scope.dataDynamic.percent + "%"; |
| 222 | + } |
175 | 223 | };
|
176 | 224 |
|
177 | 225 | $scope.dataDynamic = {
|
|
200 | 248 |
|
201 | 249 | $scope.configNoThresh = {
|
202 | 250 | 'chartId': 'chartNoThresh',
|
203 |
| - 'units': 'GB', |
| 251 | + 'units': 'GB' |
204 | 252 | };
|
205 | 253 |
|
206 | 254 | $scope.dataNoThresh = {
|
207 | 255 | 'used': '750',
|
208 | 256 | 'total': '1000'
|
209 | 257 | };
|
210 | 258 |
|
| 259 | + //start demo 2nd row |
211 | 260 | $scope.usedConfig = {
|
212 | 261 | 'chartId': 'usedChart',
|
213 | 262 | 'units': 'GB',
|
|
260 | 309 |
|
261 | 310 | $scope.noLabel = "none";
|
262 | 311 |
|
| 312 | + //start demo 3rd row |
| 313 | + $scope.configOrientationLeft = { |
| 314 | + 'units': 'GB', |
| 315 | + 'thresholds':{'warning':'60','error':'90'}, |
| 316 | + 'labelConfig': { |
| 317 | + 'orientation': 'left', |
| 318 | + 'labelFn': function () { |
| 319 | + return "<strong>Lorem ipsum</strong><br/>" + $scope.dataOrientationLeft.used + " GB used"; |
| 320 | + } |
| 321 | + }, |
| 322 | + 'size': { |
| 323 | + 'height': 85, |
| 324 | + 'width': 85 |
| 325 | + }, |
| 326 | + 'centerLabelFn': function () { |
| 327 | + return $scope.dataOrientationLeft.used + "GB"; |
| 328 | + } |
| 329 | + }; |
| 330 | +
|
| 331 | + $scope.dataOrientationLeft = { |
| 332 | + 'used': '350', |
| 333 | + 'total': '1000' |
| 334 | + }; |
| 335 | +
|
| 336 | + $scope.configOrientationCenter = { |
| 337 | + 'units': 'GB', |
| 338 | + 'thresholds':{'warning':'60','error':'90'}, |
| 339 | + 'labelConfig': { |
| 340 | + 'label': 'available', |
| 341 | + 'units': 'GB', |
| 342 | + 'title': 'Lorem ipsum,' |
| 343 | + }, |
| 344 | + 'size': { |
| 345 | + 'height': 115, |
| 346 | + 'width': 115 |
| 347 | + }, |
| 348 | + 'centerLabelFn': function () { |
| 349 | + return $scope.dataOrientationCenter.used + "GB"; |
| 350 | + } |
| 351 | + }; |
| 352 | +
|
| 353 | + $scope.dataOrientationCenter = { |
| 354 | + 'used': '350', |
| 355 | + 'total': '1000' |
| 356 | + }; |
| 357 | +
|
| 358 | + $scope.configOrientationRight = { |
| 359 | + 'units': 'GB', |
| 360 | + 'thresholds':{'warning':'60','error':'90'}, |
| 361 | + 'labelConfig': { |
| 362 | + 'orientation': 'right', |
| 363 | + 'labelFn': function () { |
| 364 | + return "<strong>Lorem ipsum</strong><br/>" + $scope.dataOrientationRight.percent + "% used"; |
| 365 | + } |
| 366 | + }, |
| 367 | + 'size': { |
| 368 | + 'height': 85, |
| 369 | + 'width': 85 |
| 370 | + }, |
| 371 | + 'centerLabelFn': function () { |
| 372 | + return $scope.dataOrientationRight.percent + "%"; |
| 373 | + } |
| 374 | + }; |
| 375 | +
|
| 376 | + $scope.dataOrientationRight = { |
| 377 | + 'used': '350', |
| 378 | + 'total': '1000' |
| 379 | + }; |
| 380 | +
|
| 381 | + //start demo 4th row |
263 | 382 | $scope.custConfig = {
|
264 | 383 | 'chartId': 'custChart',
|
265 | 384 | 'units': 'MHz',
|
|
289 | 408 | </file>
|
290 | 409 | </example>
|
291 | 410 | */
|
| 411 | + |
0 commit comments