Skip to content

Commit 9c49be0

Browse files
committed
Trends Chart: added 'inline' layout
1 parent f6b0768 commit 9c49be0

File tree

8 files changed

+161
-65
lines changed

8 files changed

+161
-65
lines changed

dist/angular-patternfly.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,8 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
11731173
* <ul style='list-style-type: none'>
11741174
* <li>.chartId - the unique id of this trends chart
11751175
* <li>.title - (optional) title of the Trends chart
1176-
* <li>.layout - (optional) the layout and sizes of titles and chart. Values are 'large' (default), 'small', and 'compact'
1176+
* <li>.layout - (optional) the layout and sizes of titles and chart. Values are 'large' (default), 'small', 'compact', and 'inline'
1177+
* <li>.trendLabel - (optional) the trend label used in the 'inline' layout
11771178
* <li>.timeFrame - (optional) the time frame for the data in the pfSparklineChart, ex: 'Last 30 Days'
11781179
* <li>.units - unit label for values, ex: 'MHz','GB', etc..
11791180
* <li>.valueType - (optional) the format of the latest data point which is shown in the title. Values are 'actual'(default) or 'percentage'
@@ -1216,22 +1217,23 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
12161217
<div class="col-md-3">
12171218
<form role="form" >
12181219
<div class="form-group">
1219-
<label>Title Value Type</label></br>
1220-
<select pf-select class="pf-select-sm" ng-model="valueType" id="valueType">
1221-
<option value="actual" ng-selected="true" selected>Actual</option>
1222-
<option value="percentage">Percentage</option>
1220+
<label>Layout</label></br>
1221+
<select pf-select class="pf-select-sm" ng-model="layout" id="layout">
1222+
<option value="large" ng-selected="true" selected>Large</option>
1223+
<option value="small">Small</option>
1224+
<option value="compact">Compact</option>
1225+
<option value="inline">Inline</option>
12231226
</select>
12241227
</div>
12251228
</form>
12261229
</div>
12271230
<div class="col-md-3">
1228-
<form role="form" >
1231+
<form role="form" ng-hide="layout == 'inline'">
12291232
<div class="form-group">
1230-
<label>Layout</label></br>
1231-
<select pf-select class="pf-select-sm" ng-model="layout" id="layout">
1232-
<option value="large" ng-selected="true" selected>Large</option>
1233-
<option value="small">Small</option>
1234-
<option value="compact">Compact</option>
1233+
<label>Title Value Type</label></br>
1234+
<select pf-select class="pf-select-sm" ng-model="valueType" id="valueType">
1235+
<option value="actual" ng-selected="true" selected>Actual</option>
1236+
<option value="percentage">Percentage</option>
12351237
</select>
12361238
</div>
12371239
</form>
@@ -1249,6 +1251,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
12491251
'chartId' : 'exampleTrendsChart',
12501252
'title' : 'Network Utilization Trends',
12511253
'layout' : 'large',
1254+
'trendLabel' : 'Virtual Disk I/O',
12521255
'valueType' : 'actual',
12531256
'timeFrame' : 'Last 15 Minutes',
12541257
'units' : 'MHz',
@@ -4350,7 +4353,7 @@ angular.module('patternfly.views').directive('pfDataToolbar',
43504353

43514354

43524355
$templateCache.put('charts/trends/trends-chart.html',
4353-
"<span ng-switch on=config.layout><div ng-switch-default ng-class=\"{'trend-card-large-pf': showLargeCardLayout,'trend-card-small-pf': showSmallCardLayout}\"><span class=trend-header-pf ng-if=config.title>{{config.title}}</span> <span ng-if=showActualValue><span class=trend-title-big-pf>{{getLatestValue()}}</span> <span class=trend-title-small-pf>{{config.units}}</span></span> <span ng-if=showPercentageValue><span class=trend-title-big-pf>{{getPercentageValue() + '%'}}</span> <span class=trend-title-small-pf>of {{chartData.total + ' ' + config.units}}</span></span><div pf-sparkline-chart config=config chart-data=chartData chart-height=getChartHeight() show-x-axis=showXAxis show-y-axis=showYAxis></div><span class=trend-footer-pf ng-if=config.timeFrame>{{config.timeFrame}}</span></div><div ng-switch-when=compact><div class=\"row trend-compact-row\"><div class=col-md-4 style=padding-right:0px><span ng-if=showActualValue><span class=trend-title-compact-big-pf>{{getLatestValue()}}</span> <span class=trend-title-compact-small-pf>{{config.units}}</span></span> <span ng-if=showPercentageValue><span class=trend-title-compact-big-pf>{{getPercentageValue() + '%'}}</span> <span class=trend-title-compact-small-pf>of {{chartData.total + ' ' + config.units}}</span></span> <span class=trend-header-compact-pf ng-if=config.title>{{config.title}}</span></div><div class=col-md-8 style=padding-left:0px><div pf-sparkline-chart config=config chart-data=chartData chart-height=getChartHeight() show-x-axis=showXAxis show-y-axis=showYAxis></div></div></div></div></span>"
4356+
"<span ng-switch on=config.layout><div ng-switch-default ng-class=\"{'trend-card-large-pf': showLargeCardLayout,'trend-card-small-pf': showSmallCardLayout}\"><span class=trend-header-pf ng-if=config.title>{{config.title}}</span> <span ng-if=showActualValue><span class=trend-title-big-pf>{{getLatestValue()}}</span> <span class=trend-title-small-pf>{{config.units}}</span></span> <span ng-if=showPercentageValue><span class=trend-title-big-pf>{{getPercentageValue() + '%'}}</span> <span class=trend-title-small-pf>of {{chartData.total + ' ' + config.units}}</span></span><div pf-sparkline-chart config=config chart-data=chartData chart-height=getChartHeight() show-x-axis=showXAxis show-y-axis=showYAxis></div><span class=trend-footer-pf ng-if=config.timeFrame>{{config.timeFrame}}</span></div><div ng-switch-when=compact><div class=\"row trend-row\"><div class=\"col-sm-4 col-md-4\"><div class=trend-compact-details><span ng-if=showActualValue><span class=trend-title-compact-big-pf>{{getLatestValue()}}</span> <span class=trend-title-compact-small-pf>{{config.units}}</span></span> <span ng-if=showPercentageValue><span class=trend-title-compact-big-pf>{{getPercentageValue() + '%'}}</span> <span class=trend-title-compact-small-pf>of {{chartData.total + ' ' + config.units}}</span></span> <span class=trend-header-compact-pf ng-if=config.title>{{config.title}}</span></div></div><div class=\"col-sm-8 col-md-8\"><div pf-sparkline-chart config=config chart-data=chartData chart-height=getChartHeight() show-x-axis=showXAxis show-y-axis=showYAxis></div></div></div></div><div ng-switch-when=inline><div class=\"row trend-row\"><div class=\"col-sm-8 col-md-8 trend-flat-col\"><div pf-sparkline-chart config=config chart-data=chartData chart-height=getChartHeight() show-x-axis=showXAxis show-y-axis=showYAxis></div></div><div class=\"col-sm-4 col-md-4 trend-flat-col\"><div class=trend-flat-details><div class=trend-flat-details-cell><span class=trend-title-flat-big-pf>{{getPercentageValue() + '%'}}</span></div><div class=trend-flat-details-cell><span class=trend-label-flat-strong-pf>{{config.trendLabel}}</span> <span class=trend-label-flat-pf>{{getLatestValue()}} of {{chartData.total + ' ' + config.units}}</span></div></div></div></div></div></span>"
43544357
);
43554358

43564359

dist/angular-patternfly.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/styles/angular-patternfly.css

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,31 +282,57 @@
282282
font-weight: 400;
283283
}
284284

285+
.trend-flat-details {
286+
display: table;
287+
margin-top: 5px;
288+
}
289+
290+
@media (min-width: 768px) {
291+
.trend-flat-details {
292+
margin-top: 25px;
293+
}
294+
}
295+
296+
.trend-flat-details-cell {
297+
display: table-cell;
298+
vertical-align: bottom;
299+
}
300+
301+
.trend-header-compact-pf {
302+
display: block;
303+
font-size: 12px;
304+
font-weight: 400;
305+
}
306+
285307
.trend-title-compact-big-pf {
286308
font-size: 36px;
287309
font-weight: 300;
288-
margin-left: 10px;
310+
line-height: 1;
289311
}
290312

291313
.trend-title-compact-small-pf {
292314
font-size: 12px;
293315
font-weight: 400;
294316
}
295317

296-
.trend-header-compact-pf {
318+
.trend-title-flat-big-pf {
319+
font-size: 26px;
320+
font-weight: 300;
321+
line-height: 1;
322+
margin-right: 15px;
323+
}
324+
325+
.trend-label-flat-pf {
297326
font-size: 12px;
298327
font-weight: 400;
299-
display: block;
300-
margin-left: 10px;
301-
margin-top: -5px;
328+
line-height: 1;
302329
}
303330

304-
.trend-compact-row > * {
305-
float: none;
306-
display: inline-block;
307-
}
308-
.trend-compact-row > *:last-child {
309-
vertical-align: bottom;
331+
.trend-label-flat-strong-pf {
332+
display: block;
333+
font-size: 12px;
334+
font-weight: 700;
335+
line-height: 1;
310336
}
311337

312338
.trend-footer-pf {

dist/styles/angular-patternfly.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)