@@ -536,104 +536,23 @@ angular.module('patternfly.card').directive('pfCard', function () {
536
536
; ( function ( ) {
537
537
'use strict' ;
538
538
539
+ var patternflyDefaults = $ ( ) . c3ChartDefaults ( ) ;
540
+
539
541
angular . module ( 'patternfly.charts' ) . constant ( 'c3ChartDefaults' , {
540
- getDefaultDonut : function ( title ) {
541
- return {
542
- title : title ,
543
- label : {
544
- show : false
545
- } ,
546
- width : 11
547
- } ;
548
- } ,
549
- getDefaultDonutSize : function ( ) {
550
- return {
551
- height : 171 // produces a diameter of 150 and a centered chart
552
- } ;
553
- } ,
554
- getDefaultDonutColor : function ( ) {
555
- return {
556
- pattern : [ '#0088CE' , '#D1D1D1' ]
557
- } ;
558
- } ,
559
- getDefaultDonutTooltip : function ( ) {
560
- return {
561
- show : false
562
- } ;
563
- } ,
564
- getDefaultDonutLegend : function ( ) {
565
- return {
566
- show : false
567
- } ;
568
- } ,
569
- getDefaultDonutConfig : function ( title ) {
570
- return {
571
- donut : this . getDefaultDonut ( title ) ,
572
- size : this . getDefaultDonutSize ( ) ,
573
- legend : this . getDefaultDonutLegend ( ) ,
574
- color : this . getDefaultDonutColor ( ) ,
575
- tooltip : this . getDefaultDonutTooltip ( )
576
- } ;
577
- } ,
578
- getDefaultSparklineArea : function ( ) {
579
- return {
580
- zerobased : true
581
- } ;
582
- } ,
583
- getDefaultSparklineSize : function ( ) {
584
- return {
585
- height : 60
586
- } ;
587
- } ,
588
- getDefaultSparklineAxis : function ( ) {
589
- return {
590
- x : {
591
- show : false
592
- } ,
593
- y : {
594
- show : false
595
- }
596
- } ;
597
- } ,
598
- getDefaultSparklineColor : function ( ) {
599
- return {
600
- pattern : [ '#0088ce' , '#00659c' , '#3f9c35' , '#ec7a08' , '#cc0000' ]
601
- } ;
602
- } ,
603
- getDefaultSparklineLegend : function ( ) {
604
- return {
605
- show : false
606
- } ;
607
- } ,
608
- getDefaultSparklinePoint : function ( ) {
609
- return {
610
- r : 1 ,
611
- focus : {
612
- expand : {
613
- r : 4
614
- }
615
- }
616
- } ;
617
- } ,
618
- getDefaultSparklineTooltip : function ( ) {
619
- return {
620
- // because a sparkline should only contain a single data column, the tooltip will only work for a single data column
621
- contents : function ( d ) {
622
- return '<span class="c3-tooltip-sparkline">' + d [ 0 ] . value + ' ' + d [ 0 ] . name + '</span>' ;
623
- }
624
- } ;
625
- } ,
626
- getDefaultSparklineConfig : function ( ) {
627
- return {
628
- area : this . getDefaultSparklineArea ( ) ,
629
- size : this . getDefaultSparklineSize ( ) ,
630
- axis : this . getDefaultSparklineAxis ( ) ,
631
- color : this . getDefaultSparklineColor ( ) ,
632
- legend : this . getDefaultSparklineLegend ( ) ,
633
- point : this . getDefaultSparklinePoint ( ) ,
634
- tooltip : this . getDefaultSparklineTooltip ( )
635
- } ;
636
- }
542
+ getDefaultColors : patternflyDefaults . getDefaultColors ,
543
+ getDefaultDonut : patternflyDefaults . getDefaultDonut ,
544
+ getDefaultDonutSize : patternflyDefaults . getDefaultDonutSize ,
545
+ getDefaultDonutColor : patternflyDefaults . getDefaultDonutColors ,
546
+ getDefaultDonutLegend : patternflyDefaults . getDefaultDonutLegend ,
547
+ getDefaultDonutConfig : patternflyDefaults . getDefaultDonutConfig ,
548
+ getDefaultSparklineArea : patternflyDefaults . getDefaultSparklineArea ,
549
+ getDefaultSparklineSize : patternflyDefaults . getDefaultSparklineSize ,
550
+ getDefaultSparklineAxis : patternflyDefaults . getDefaultSparklineAxis ,
551
+ getDefaultSparklineColor : patternflyDefaults . getDefaultColors ,
552
+ getDefaultSparklineLegend : patternflyDefaults . getDefaultSparklineLegend ,
553
+ getDefaultSparklinePoint : patternflyDefaults . getDefaultSparklinePoint ,
554
+ getDefaultSparklineTooltip : patternflyDefaults . getDefaultSparklineTooltip ,
555
+ getDefaultSparklineConfig : patternflyDefaults . getDefaultSparklineConfig
637
556
} ) ;
638
557
} ) ( ) ;
639
558
; /**
@@ -674,34 +593,17 @@ angular.module('patternfly.card').directive('pfCard', function () {
674
593
$scope.total = 1000;
675
594
$scope.available = $scope.total - $scope.used;
676
595
677
- $scope.chartConfig = {
596
+ $scope.chartConfig = $().c3ChartDefaults().getDefaultDonutConfig('MHz Used');
597
+ $scope.chartConfig.data = {
678
598
type: "donut",
679
- donut: {
680
- title: "MHz Used",
681
- label: {show: false},
682
- width: 10
683
- },
684
- size: {
685
- height: 130
686
- },
687
- legend: {
688
- show: false
689
- },
690
- color: {
691
- pattern: ["#0088CE","#D1D1D1"]
692
- },
693
- tooltip: {},
694
- data: {
695
- type: "donut",
696
- columns: [
697
- ["Used", $scope.used],
698
- ["Available", $scope.total - $scope.used]
699
- ],
700
- groups: [
701
- ["used", "available"]
702
- ],
703
- order: null
704
- }
599
+ columns: [
600
+ ["Used", $scope.used],
601
+ ["Available", $scope.total - $scope.used]
602
+ ],
603
+ groups: [
604
+ ["used", "available"]
605
+ ],
606
+ order: null
705
607
};
706
608
707
609
$scope.updateAvailable = function (val) {
@@ -973,7 +875,7 @@ angular.module('patternfly.card').directive('pfCard', function () {
973
875
</file>
974
876
</example>
975
877
*/
976
- angular . module ( 'patternfly.charts' ) . directive ( 'pfDonutPctChart' , [ "c3ChartDefaults" , " pfUtils", "$timeout" , function ( c3ChartDefaults , pfUtils , $timeout ) {
878
+ angular . module ( 'patternfly.charts' ) . directive ( 'pfDonutPctChart' , [ "pfUtils" , "$timeout" , function ( pfUtils , $timeout ) {
977
879
'use strict' ;
978
880
979
881
return {
@@ -1098,7 +1000,7 @@ angular.module('patternfly.charts').directive('pfDonutPctChart', ["c3ChartDefaul
1098
1000
$scope . config . data . onclick = $scope . config . onClickFn ;
1099
1001
} ;
1100
1002
1101
- $scope . config = pfUtils . merge ( c3ChartDefaults . getDefaultDonutConfig ( ) , $scope . config ) ;
1003
+ $scope . config = pfUtils . merge ( $ ( ) . c3ChartDefaults ( ) . getDefaultDonutConfig ( ) , $scope . config ) ;
1102
1004
$scope . updateAll ( $scope ) ;
1103
1005
}
1104
1006
] ,
@@ -1549,7 +1451,7 @@ angular.module('patternfly.charts').directive('pfHeatmap', ["$compile", function
1549
1451
</file>
1550
1452
</example>
1551
1453
*/
1552
- angular . module ( 'patternfly.charts' ) . directive ( 'pfSparklineChart' , [ "c3ChartDefaults" , " pfUtils", function ( c3ChartDefaults , pfUtils ) {
1454
+ angular . module ( 'patternfly.charts' ) . directive ( 'pfSparklineChart' , [ "pfUtils" , function ( pfUtils ) {
1553
1455
'use strict' ;
1554
1456
return {
1555
1457
restrict : 'A' ,
@@ -1631,7 +1533,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
1631
1533
'</tr>' ;
1632
1534
break ;
1633
1535
default :
1634
- tipRows = c3ChartDefaults . getDefaultSparklineTooltip ( ) . contents ( d ) ;
1536
+ tipRows = $ ( ) . c3ChartDefaults ( ) . getDefaultSparklineTooltip ( ) . contents ( d ) ;
1635
1537
}
1636
1538
}
1637
1539
return $scope . getTooltipTableHTML ( tipRows ) ;
@@ -1677,7 +1579,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
1677
1579
$scope . showYAxis = ( $scope . config . showAxis !== undefined ) && $scope . config . showAxis ;
1678
1580
}
1679
1581
1680
- $scope . defaultConfig = c3ChartDefaults . getDefaultSparklineConfig ( ) ;
1582
+ $scope . defaultConfig = $ ( ) . c3ChartDefaults ( ) . getDefaultSparklineConfig ( ) ;
1681
1583
$scope . defaultConfig . axis = {
1682
1584
x : {
1683
1585
show : $scope . showXAxis === true ,
@@ -5287,7 +5189,7 @@ angular.module('patternfly.views').directive('pfDataToolbar', function () {
5287
5189
'use strict' ;
5288
5190
5289
5191
$templateCache . put ( 'filters/simple-filter-fields.html' ,
5290
- "<div class=\"simple-filter filter-fields\"><form><div class=\"form-group toolbar-pf-filter\"><div class=input-group><div dropdown class=input-group-btn><button dropdown-toggle type=button class=\"btn btn-default dropdown-toggle filter-fields\" aria-haspopup=true aria-expanded=false tooltip=\"Filter by\" tooltip-placement=bottom>{{currentField.title}} <span class=caret></span></button><ul class=dropdown-menu><li ng-repeat=\"item in config.fields\"><a class=filter-field role=menuitem tabindex=-1 ng-click=selectField(item)>{{item.title}}</a></li></ul></div><div ng-if=\"currentField.filterType !== 'select'\"><input class=form-control type={{currentField.filterType}} ng-model=config.currentValue placeholder={{currentField.placeholder}} ng-keypress=\"onValueKeyPress($event)\"></div><div ng-if=\"currentField.filterType === 'select'\"><select pf-select class=\"form-control filter-select\" id=currentValue ng-model=config.currentValue ng-options=\"filterValue for filterValue in currentField.filterValues\" ng-change=selectValue(config.currentValue)><option value=\"\">{{currentField.placeholder}}</option></select></div></div></div></form></div>"
5192
+ "<div class=\"simple-filter filter-fields\"><form><div class=\"form-group toolbar-pf-filter\"><div class=input-group><div dropdown class=input-group-btn><button dropdown-toggle type=button class=\"btn btn-default dropdown-toggle filter-fields\" aria-haspopup=true aria-expanded=false tooltip=\"Filter by\" tooltip-placement=top>{{currentField.title}} <span class=caret></span></button><ul class=dropdown-menu><li ng-repeat=\"item in config.fields\"><a class=filter-field role=menuitem tabindex=-1 ng-click=selectField(item)>{{item.title}}</a></li></ul></div><div ng-if=\"currentField.filterType !== 'select'\"><input class=form-control type={{currentField.filterType}} ng-model=config.currentValue placeholder={{currentField.placeholder}} ng-keypress=\"onValueKeyPress($event)\"></div><div ng-if=\"currentField.filterType === 'select'\"><select pf-select class=\"form-control filter-select\" id=currentValue ng-model=config.currentValue ng-options=\"filterValue for filterValue in currentField.filterValues\" ng-change=selectValue(config.currentValue)><option value=\"\">{{currentField.placeholder}}</option></select></div></div></div></form></div>"
5291
5193
) ;
5292
5194
5293
5195
0 commit comments