Skip to content

Commit c84ad6e

Browse files
Merge pull request #91 from dtaylor113/trendChartNewLayouts
Trend chart new 'compact' and 'inline' layouts
2 parents b815211 + 9c49be0 commit c84ad6e

File tree

8 files changed

+211
-27
lines changed

8 files changed

+211
-27
lines changed

dist/angular-patternfly.js

Lines changed: 15 additions & 11 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), and 'small'
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,21 +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>
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>
12341237
</select>
12351238
</div>
12361239
</form>
@@ -1248,6 +1251,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
12481251
'chartId' : 'exampleTrendsChart',
12491252
'title' : 'Network Utilization Trends',
12501253
'layout' : 'large',
1254+
'trendLabel' : 'Virtual Disk I/O',
12511255
'valueType' : 'actual',
12521256
'timeFrame' : 'Last 15 Minutes',
12531257
'units' : 'MHz',
@@ -4349,7 +4353,7 @@ angular.module('patternfly.views').directive('pfDataToolbar',
43494353

43504354

43514355
$templateCache.put('charts/trends/trends-chart.html',
4352-
"<span><div 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></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>"
43534357
);
43544358

43554359

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: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,59 @@
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+
307+
.trend-title-compact-big-pf {
308+
font-size: 36px;
309+
font-weight: 300;
310+
line-height: 1;
311+
}
312+
313+
.trend-title-compact-small-pf {
314+
font-size: 12px;
315+
font-weight: 400;
316+
}
317+
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 {
326+
font-size: 12px;
327+
font-weight: 400;
328+
line-height: 1;
329+
}
330+
331+
.trend-label-flat-strong-pf {
332+
display: block;
333+
font-size: 12px;
334+
font-weight: 700;
335+
line-height: 1;
336+
}
337+
285338
.trend-footer-pf {
286339
font-size: 10px;
287340
font-weight: 400;

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)