|
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. This callback returns no data. Updated display data can be accessed through the passed and updated parameter 'data'. (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/>
|
32 | 41 | * <ul style='list-style-type: none'>
|
33 | 42 | * <li>.used - number representing the amount used
|
| 43 | + * <li>.percent - number representing the percentage used |
34 | 44 | * <li>.total - number representing the total amount
|
35 | 45 | * <li>.dataAvailable - Flag if there is data available - default: true
|
36 | 46 | * </ul>
|
|
62 | 72 | <div class="row">
|
63 | 73 | <div class="col-md-3 text-center">
|
64 | 74 | <label>Error Threshold</label>
|
65 |
| - <pf-donut-pct-chart config="configErr" data="dataErr" chart="chartErr"></pf-donut-pct-chart> |
| 75 | + <p class="text-right"> |
| 76 | + <pf-donut-pct-chart config="configErr" data="dataErr" chart="chartErr"></pf-donut-pct-chart> |
| 77 | + </p> |
66 | 78 | </div>
|
67 |
| - <div class="col-md-3 text-center""> |
| 79 | + <div class="col-md-3 text-center"> |
68 | 80 | <label>Warning Threshold</label>
|
69 | 81 | <pf-donut-pct-chart config="configWarn" data="dataWarn"></pf-donut-pct-chart>
|
70 | 82 | </div>
|
71 |
| - <div class="col-md-3 text-center""> |
| 83 | + <div class="col-md-3 text-center"> |
72 | 84 | <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> |
| 85 | + <p class="text-left"> |
| 86 | + <pf-donut-pct-chart config="configDynamic" data="dataDynamic" center-label="labelDynamic" |
| 87 | + on-threshold-change="thresholdChanged(threshold)"> |
| 88 | + </pf-donut-pct-chart> |
| 89 | + </p> |
76 | 90 | </div>
|
77 |
| - <div class="col-md-3 text-center""> |
| 91 | + <div class="col-md-3 text-center"> |
78 | 92 | <label>No Threshold</label>
|
79 | 93 | <pf-donut-pct-chart config="configNoThresh" data="dataNoThresh"></pf-donut-pct-chart>
|
80 | 94 | </div>
|
|
88 | 102 |
|
89 | 103 | <div class="row">
|
90 | 104 | <div class="col-md-3 text-center">
|
91 |
| - <pf-donut-pct-chart config="usedConfig" data="usedData" center-label="usedLabel"></pf-donut-pct-chart> |
92 | 105 | <label>center-label = 'used'</label>
|
| 106 | + <pf-donut-pct-chart config="usedConfig" data="usedData" center-label="usedLabel"></pf-donut-pct-chart> |
93 | 107 | </div>
|
94 | 108 | <div class="col-md-3 text-center">
|
95 |
| - <pf-donut-pct-chart config="availConfig" data="availData" center-label="availLabel"></pf-donut-pct-chart> |
96 | 109 | <label>center-label = 'available'</label>
|
| 110 | + <pf-donut-pct-chart config="availConfig" data="availData" center-label="availLabel"></pf-donut-pct-chart> |
97 | 111 | </div>
|
98 | 112 | <div class="col-md-3 text-center">
|
99 |
| - <pf-donut-pct-chart config="pctConfig" data="pctData" center-label="pctLabel"></pf-donut-pct-chart> |
100 | 113 | <label>center-label = 'percent'</label>
|
| 114 | + <pf-donut-pct-chart config="pctConfig" data="pctData" center-label="pctLabel"></pf-donut-pct-chart> |
101 | 115 | </div>
|
102 | 116 | <div class="col-md-3 text-center">
|
| 117 | + <label>center-label = 'none'</label> |
103 | 118 | <pf-donut-pct-chart config="noneConfig" data="noneData" center-label="noLabel"></pf-donut-pct-chart>
|
104 |
| - <label>center-label = ' none'</label> |
| 119 | + </div> |
| 120 | + </div> |
| 121 | +
|
| 122 | + <div class="row"> |
| 123 | + <div class="col-md-12"> |
| 124 | + <hr> |
| 125 | + </div> |
| 126 | + </div> |
| 127 | +
|
| 128 | + <div class="row"> |
| 129 | + <div class="col-md-4 text-center"> |
| 130 | + <label>Sized with orientation left 'configLabel'</label> |
| 131 | + <p class="text-right"> |
| 132 | + <pf-donut-pct-chart config="configOrientationLeft" data="dataOrientationLeft"></pf-donut-pct-chart> |
| 133 | + </p> |
| 134 | + </div> |
| 135 | + <div class="col-md-4 text-center"> |
| 136 | + <label>Sized with 'configLabel'</label> |
| 137 | + <pf-donut-pct-chart config="configOrientationCenter" data="dataOrientationCenter"></pf-donut-pct-chart> |
| 138 | + </div> |
| 139 | + <div class="col-md-4 text-center"> |
| 140 | + <label>Sized with orientation right 'configLabel'</label> |
| 141 | + <p class="text-left"> |
| 142 | + <pf-donut-pct-chart config="configOrientationRight" data="dataOrientationRight"></pf-donut-pct-chart> |
| 143 | + </p> |
105 | 144 | </div>
|
106 | 145 | </div>
|
107 | 146 |
|
|
120 | 159 | </div>
|
121 | 160 | <div class="row">
|
122 | 161 | <div class="col-md-3">
|
123 |
| - <form role="form""> |
| 162 | + <form role="form"> |
124 | 163 | <div class="form-group">
|
125 | 164 | <label class="checkbox-inline">
|
126 | 165 | <input type="checkbox" ng-model="custData.dataAvailable">Data Available</input>
|
|
144 | 183 |
|
145 | 184 | <file name="script.js">
|
146 | 185 | angular.module( 'patternfly.charts' ).controller( 'ChartCtrl', function( $scope, $interval ) {
|
| 186 | + // start demo 1st row |
147 | 187 | $scope.configErr = {
|
148 | 188 | 'chartId': 'chartErr',
|
149 | 189 | 'units': 'GB',
|
|
200 | 240 |
|
201 | 241 | $scope.configNoThresh = {
|
202 | 242 | 'chartId': 'chartNoThresh',
|
203 |
| - 'units': 'GB', |
| 243 | + 'units': 'GB' |
204 | 244 | };
|
205 | 245 |
|
206 | 246 | $scope.dataNoThresh = {
|
207 | 247 | 'used': '750',
|
208 | 248 | 'total': '1000'
|
209 | 249 | };
|
210 | 250 |
|
| 251 | + //start demo 2nd row |
211 | 252 | $scope.usedConfig = {
|
212 | 253 | 'chartId': 'usedChart',
|
213 | 254 | 'units': 'GB',
|
|
260 | 301 |
|
261 | 302 | $scope.noLabel = "none";
|
262 | 303 |
|
| 304 | + //start demo 3rd row |
| 305 | + $scope.configOrientationLeft = { |
| 306 | + 'units': 'GB', |
| 307 | + 'thresholds':{'warning':'60','error':'90'}, |
| 308 | + 'labelConfig': { |
| 309 | + 'orientation': 'left', |
| 310 | + 'labelFn': function () { |
| 311 | + return "<strong>Lorem ipsum</strong><br/>" + $scope.dataOrientationLeft.used + " GB used"; |
| 312 | + } |
| 313 | + }, |
| 314 | + 'size': { |
| 315 | + 'height': 85, |
| 316 | + 'width': 85 |
| 317 | + }, |
| 318 | + 'centerLabelFn': function () { |
| 319 | + return $scope.dataOrientationLeft.used + "GB"; |
| 320 | + } |
| 321 | + }; |
| 322 | +
|
| 323 | + $scope.dataOrientationLeft = { |
| 324 | + 'used': '350', |
| 325 | + 'total': '1000' |
| 326 | + }; |
| 327 | +
|
| 328 | + $scope.configOrientationCenter = { |
| 329 | + 'units': 'GB', |
| 330 | + 'thresholds':{'warning':'60','error':'90'}, |
| 331 | + 'labelConfig': { |
| 332 | + 'label': 'available', |
| 333 | + 'units': 'GB', |
| 334 | + 'title': 'Lorem ipsum,' |
| 335 | + }, |
| 336 | + 'size': { |
| 337 | + 'height': 115, |
| 338 | + 'width': 115 |
| 339 | + }, |
| 340 | + 'centerLabelFn': function () { |
| 341 | + return $scope.dataOrientationCenter.used + "GB"; |
| 342 | + } |
| 343 | + }; |
| 344 | +
|
| 345 | + $scope.dataOrientationCenter = { |
| 346 | + 'used': '350', |
| 347 | + 'total': '1000' |
| 348 | + }; |
| 349 | +
|
| 350 | + $scope.configOrientationRight = { |
| 351 | + 'units': 'GB', |
| 352 | + 'thresholds':{'warning':'60','error':'90'}, |
| 353 | + 'labelConfig': { |
| 354 | + 'orientation': 'right', |
| 355 | + 'labelFn': function () { |
| 356 | + return "<strong>Lorem ipsum</strong><br/>" + $scope.dataOrientationRight.percent + "% used"; |
| 357 | + } |
| 358 | + }, |
| 359 | + 'size': { |
| 360 | + 'height': 85, |
| 361 | + 'width': 85 |
| 362 | + }, |
| 363 | + 'centerLabelFn': function () { |
| 364 | + return $scope.dataOrientationRight.percent + "%"; |
| 365 | + } |
| 366 | + }; |
| 367 | +
|
| 368 | + $scope.dataOrientationRight = { |
| 369 | + 'used': '350', |
| 370 | + 'total': '1000' |
| 371 | + }; |
| 372 | +
|
| 373 | + //start demo 4th row |
263 | 374 | $scope.custConfig = {
|
264 | 375 | 'chartId': 'custChart',
|
265 | 376 | 'units': 'MHz',
|
|
289 | 400 | </file>
|
290 | 401 | </example>
|
291 | 402 | */
|
| 403 | + |
0 commit comments