mirror of https://github.com/akveo/blur-admin
fix(skin): add ability to change background styles
parent
20a036ef73
commit
6d5cbfab5b
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
blurAdminApp.controller('areaChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
|
blurAdminApp.controller('areaChartCtrl', ['$scope', '$timeout', '$element', 'tplSkinChartWatcherHelper', function($scope, $timeout, $element, tplSkinChartWatcherHelper) {
|
||||||
var id = $element[0].getAttribute('id');
|
var id = $element[0].getAttribute('id');
|
||||||
var areaChart = AmCharts.makeChart(id, {
|
var areaChart = AmCharts.makeChart(id, {
|
||||||
type: 'serial',
|
type: 'serial',
|
||||||
|
@ -125,6 +125,8 @@ blurAdminApp.controller('areaChartCtrl', ['$scope', '$timeout', '$element', func
|
||||||
pathToImages: 'img/'
|
pathToImages: 'img/'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.watchAxisChartStyleChanges($scope, areaChart);
|
||||||
|
|
||||||
areaChart.addListener('dataUpdated', zoomAreaChart);
|
areaChart.addListener('dataUpdated', zoomAreaChart);
|
||||||
|
|
||||||
function zoomAreaChart() {
|
function zoomAreaChart() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
blurAdminApp.controller('barChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
|
blurAdminApp.controller('barChartCtrl', ['$scope', '$timeout', '$element', 'tplSkinChartWatcherHelper', function($scope, $timeout, $element, tplSkinChartWatcherHelper) {
|
||||||
var id = $element[0].getAttribute('id');
|
var id = $element[0].getAttribute('id');
|
||||||
var barChart = AmCharts.makeChart(id, {
|
var barChart = AmCharts.makeChart(id, {
|
||||||
type: 'serial',
|
type: 'serial',
|
||||||
|
@ -72,4 +72,6 @@ blurAdminApp.controller('barChartCtrl', ['$scope', '$timeout', '$element', funct
|
||||||
creditsPosition: 'top-right',
|
creditsPosition: 'top-right',
|
||||||
pathToImages: 'img/'
|
pathToImages: 'img/'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.watchAxisChartStyleChanges($scope, barChart);
|
||||||
}]);
|
}]);
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
blurAdminApp.controller('funnelChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
|
blurAdminApp.controller('funnelChartCtrl', ['$scope', '$timeout', '$element', 'tplSkinChartWatcherHelper', function($scope, $timeout, $element, tplSkinChartWatcherHelper) {
|
||||||
var id = $element[0].getAttribute('id');
|
var id = $element[0].getAttribute('id');
|
||||||
var funnelChart = AmCharts.makeChart(id, {
|
var funnelChart = AmCharts.makeChart(id, {
|
||||||
type: 'funnel',
|
type: 'funnel',
|
||||||
|
@ -53,4 +53,6 @@ blurAdminApp.controller('funnelChartCtrl', ['$scope', '$timeout', '$element', fu
|
||||||
creditsPosition: 'bottom-left',
|
creditsPosition: 'bottom-left',
|
||||||
pathToImages: 'img/'
|
pathToImages: 'img/'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.watchFunnelChanges($scope, funnelChart);
|
||||||
}]);
|
}]);
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
blurAdminApp.controller('lineChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
|
blurAdminApp.controller('lineChartCtrl', ['$scope', '$timeout', '$element', 'tplSkinChartWatcherHelper', function($scope, $timeout, $element, tplSkinChartWatcherHelper) {
|
||||||
var id = $element[0].getAttribute('id');
|
var id = $element[0].getAttribute('id');
|
||||||
var lineChart = AmCharts.makeChart(id, {
|
var lineChart = AmCharts.makeChart(id, {
|
||||||
type: 'serial',
|
type: 'serial',
|
||||||
|
@ -131,6 +131,8 @@ blurAdminApp.controller('lineChartCtrl', ['$scope', '$timeout', '$element', func
|
||||||
pathToImages: 'img/'
|
pathToImages: 'img/'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.watchAxisChartStyleChanges($scope, lineChart);
|
||||||
|
|
||||||
lineChart.addListener('rendered', zoomChart);
|
lineChart.addListener('rendered', zoomChart);
|
||||||
if (lineChart.zoomChart) {
|
if (lineChart.zoomChart) {
|
||||||
lineChart.zoomChart();
|
lineChart.zoomChart();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
blurAdminApp.controller('pieChartCtrl', ['$scope', '$timeout', '$element', function($scope, $timeout, $element) {
|
blurAdminApp.controller('pieChartCtrl', ['$scope', '$timeout', '$element', 'tplSkinChartWatcherHelper', function($scope, $timeout, $element, tplSkinChartWatcherHelper) {
|
||||||
var id = $element[0].getAttribute('id');
|
var id = $element[0].getAttribute('id');
|
||||||
var pieChart = AmCharts.makeChart(id, {
|
var pieChart = AmCharts.makeChart(id, {
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
|
@ -116,6 +116,8 @@ blurAdminApp.controller('pieChartCtrl', ['$scope', '$timeout', '$element', funct
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.watchDonutChanges($scope, pieChart);
|
||||||
|
|
||||||
pieChart.addListener('init', handleInit);
|
pieChart.addListener('init', handleInit);
|
||||||
|
|
||||||
pieChart.addListener('rollOverSlice', function (e) {
|
pieChart.addListener('rollOverSlice', function (e) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
blurAdminApp.directive('amChart', function () {
|
blurAdminApp.directive('amChart', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
controller: ['$scope', 'tplSkinManager', function ($scope, tplSkinManager) {
|
controller: ['$scope', 'tplSkinManager', 'tplSkinChartWatcherHelper', function ($scope, tplSkinManager, tplSkinChartWatcherHelper) {
|
||||||
var chartData = [
|
var chartData = [
|
||||||
{ date: new Date(2012, 11), value: 0, value0: 0 },
|
{ date: new Date(2012, 11), value: 0, value0: 0 },
|
||||||
{ date: new Date(2013, 0), value: 15000, value0: 19000},
|
{ date: new Date(2013, 0), value: 15000, value0: 19000},
|
||||||
|
@ -39,15 +39,6 @@ blurAdminApp.directive('amChart', function () {
|
||||||
|
|
||||||
var chartColorProfile = tplSkinManager.getChartColorProfile();
|
var chartColorProfile = tplSkinManager.getChartColorProfile();
|
||||||
|
|
||||||
$scope.$on('tplSkinChanged', function() {
|
|
||||||
chartColorProfile = tplSkinManager.getChartColorProfile();
|
|
||||||
chart.categoryAxis.color = chartColorProfile.fontColors;
|
|
||||||
chart.categoryAxis.axisColor = chartColorProfile.axisColors;
|
|
||||||
chart.valueAxes[0].color = chartColorProfile.fontColors;
|
|
||||||
chart.valueAxes[0].axisColor = chartColorProfile.axisColors;
|
|
||||||
chart.drawChart();
|
|
||||||
});
|
|
||||||
|
|
||||||
var chart = AmCharts.makeChart('amchart', {
|
var chart = AmCharts.makeChart('amchart', {
|
||||||
type: 'serial',
|
type: 'serial',
|
||||||
theme: 'blur',
|
theme: 'blur',
|
||||||
|
@ -117,6 +108,8 @@ blurAdminApp.directive('amChart', function () {
|
||||||
pathToImages: 'img/'
|
pathToImages: 'img/'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.watchAxisChartStyleChanges($scope, chart);
|
||||||
|
|
||||||
function zoomChart() {
|
function zoomChart() {
|
||||||
chart.zoomToDates(new Date(2013, 3), new Date(2014, 0));
|
chart.zoomToDates(new Date(2013, 3), new Date(2014, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
* @author v.lugovsky
|
||||||
|
* created on 27.11.2015
|
||||||
|
*/
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
blurAdminApp
|
||||||
|
.service('tplSkinChartWatcherHelper', tplSkinChartWatcherHelper);
|
||||||
|
|
||||||
|
tplSkinChartWatcherHelper.$inject = ['tplSkinManager'];
|
||||||
|
function tplSkinChartWatcherHelper(tplSkinManager) {
|
||||||
|
|
||||||
|
this.watchAxisChartStyleChanges = function(scope, chart) {
|
||||||
|
_doUpdateStyles();
|
||||||
|
scope.$on('tplSkinChanged', _doUpdateStyles);
|
||||||
|
|
||||||
|
function _doUpdateStyles() {
|
||||||
|
var chartColorProfile = tplSkinManager.getChartColorProfile();
|
||||||
|
chart.color = chartColorProfile.fontColors;
|
||||||
|
chart.categoryAxis.color = chartColorProfile.fontColors;
|
||||||
|
chart.categoryAxis.axisColor = chartColorProfile.axisColors;
|
||||||
|
chart.valueAxes[0].color = chartColorProfile.fontColors;
|
||||||
|
chart.valueAxes[0].axisColor = chartColorProfile.axisColors;
|
||||||
|
chart.validateNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.watchChartColorChanges = function(scope, chart) {
|
||||||
|
_doUpdateStyles();
|
||||||
|
scope.$on('tplSkinChanged', _doUpdateStyles);
|
||||||
|
|
||||||
|
function _doUpdateStyles() {
|
||||||
|
var chartColorProfile = tplSkinManager.getChartColorProfile();
|
||||||
|
chart.color = chartColorProfile.fontColors;
|
||||||
|
chart.validateNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.watchDonutChanges = function(scope, chart) {
|
||||||
|
_doUpdateStyles();
|
||||||
|
scope.$on('tplSkinChanged', _doUpdateStyles);
|
||||||
|
|
||||||
|
function _doUpdateStyles() {
|
||||||
|
var chartColorProfile = tplSkinManager.getChartColorProfile();
|
||||||
|
chart.color = chartColorProfile.fontColors;
|
||||||
|
chart.legend.color = chartColorProfile.fontColors;
|
||||||
|
chart.labelTickColor = chartColorProfile.axisColors;
|
||||||
|
chart.validateNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.watchFunnelChanges = function(scope, chart) {
|
||||||
|
_doUpdateStyles();
|
||||||
|
scope.$on('tplSkinChanged', _doUpdateStyles);
|
||||||
|
|
||||||
|
function _doUpdateStyles() {
|
||||||
|
var chartColorProfile = tplSkinManager.getChartColorProfile();
|
||||||
|
chart.color = chartColorProfile.fontColors;
|
||||||
|
chart.labelTickColor = chartColorProfile.axisColors;
|
||||||
|
chart.validateNow();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
|
@ -1,7 +1,7 @@
|
||||||
@mixin overrideColors($color) {
|
@mixin overrideColors($color) {
|
||||||
color: $color;
|
color: $color;
|
||||||
|
|
||||||
p,.pie-charts,.panel-heading>.dropdown .dropdown-toggle, .panel-title, .panel-title>.small, .panel-title>.small>a, .panel-title>a, .panel-title>small, .panel-title>small>a,.traffic-text span {
|
p,.pie-charts,.panel-heading>.dropdown .dropdown-toggle, .panel-title, .panel-title>.small, .panel-title>.small>a, .panel-title>a, .panel-title>small, .panel-title>small>a,.traffic-text span, .form-group label {
|
||||||
color: $color;
|
color: $color;
|
||||||
}
|
}
|
||||||
.traffic-text {
|
.traffic-text {
|
||||||
|
|
Loading…
Reference in New Issue