Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getThemeChartColors() {
- return [
- {
- themeName: 'dark-theme',
- machineStatus: {
- datasets: [
- {
- backgroundColor: '#34495e' // Running
- },
- {
- backgroundColor: '#34495e' // Wait
- },
- {
- backgroundColor: '#34495e' // Error
- },
- {
- backgroundColor: '#34495e' // Unknown
- },
- {
- backgroundColor: '#34495e' // Disconnected
- }
- ]
- },
- lineUtilization: {
- pointBackgroundColor: '#34495e'
- }
- },
- {
- themeName: 'blue-theme',
- machineStatus: {
- datasets: [
- {
- backgroundColor: '#2980b9' // Running
- },
- {
- backgroundColor: '#2980b9' // Wait
- },
- {
- backgroundColor: '#2980b9' // Error
- },
- {
- backgroundColor: '#2980b9' // Unknown
- },
- {
- backgroundColor: '#2980b9' // Disconnected
- }
- ]
- },
- lineUtilization: {
- pointBackgroundColor: '#2980b9'
- }
- }
- ];
- }
- function changeTheme(themeName) {
- var themeList = getThemeChartColors();
- var theme = themeList.find(x => x.themeName === themeName);
- for (var i = 0; i < theme.machineStatus.datasets.length; ++i) {
- _widgetMachineStatus.data.datasets[i].backgroundColor = theme.machineStatus.datasets[i].backgroundColor;
- }
- _widgetMachineStatus.update();
- _widgetLineUtilization.data.datasets[0].pointBackgroundColor = theme.lineUtilization.pointBackgroundColor;
- _widgetLineUtilization.update();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement