Skip to content
Snippets Groups Projects
Commit d357674a authored by Lidia Matei's avatar Lidia Matei Committed by Yas Naoi
Browse files

Issue #3231513 by XLD, yas: Fix K8s Node Allocated Resouces chart coloring

parent 540fa799
No related branches found
No related tags found
No related merge requests found
(function ($) { (function ($) {
'use strict'; 'use strict';
let color = d3.interpolateSpectral;
if (!drupalSettings.k8s || !drupalSettings.k8s.k8s_node_allocated_resources_chart_json_url) { if (!drupalSettings.k8s || !drupalSettings.k8s.k8s_node_allocated_resources_chart_json_url) {
return; return;
} }
...@@ -132,10 +131,16 @@ ...@@ -132,10 +131,16 @@
// Build chart. // Build chart.
$('#k8s_node_allocated_resources_chart').append('<div class="col-sm-9" style="float: none; margin: 0 auto"><canvas id="resource_chart"></canvas></div>'); $('#k8s_node_allocated_resources_chart').append('<div class="col-sm-9" style="float: none; margin: 0 auto"><canvas id="resource_chart"></canvas></div>');
let font_color = $('.panel-title').css("color");
let resource_ctx = document.getElementById('resource_chart').getContext('2d'); let resource_ctx = document.getElementById('resource_chart').getContext('2d');
let resource_cfg = { let resource_cfg = {
type: 'bar', type: 'bar',
options: { options: {
legend: {
labels: {
fontColor: font_color,
}
},
scales: { scales: {
xAxes: [{ xAxes: [{
type: 'time', type: 'time',
...@@ -149,13 +154,20 @@ ...@@ -149,13 +154,20 @@
bounds: 'ticks', bounds: 'ticks',
ticks: { ticks: {
source: 'ticks', source: 'ticks',
autoSkip: false autoSkip: false,
fontColor: font_color,
} }
}], }],
yAxes: [{ yAxes: [{
scaleLabel: { scaleLabel: {
display: true, display: true,
labelString: 'Resource Usage (%)' labelString: 'Resource Usage (%)',
fontColor: font_color,
},
ticks: {
source: 'ticks',
autoSkip: false,
fontColor: font_color,
} }
}] }]
}, },
...@@ -180,6 +192,7 @@ ...@@ -180,6 +192,7 @@
}; };
let resource_chart = new Chart(resource_ctx, resource_cfg); let resource_chart = new Chart(resource_ctx, resource_cfg);
console.log(resource_chart);
initChart(); initChart();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment