Console graph color scheme support (#2900)

Add a colorScheme parameter to PromConsole.Graph, to allow using custom colors in console graphs.
This commit is contained in:
Alin Sinpalean 2017-07-04 16:30:12 +02:00 committed by Brian Brazil
parent 43075d0215
commit 38de290d5f
2 changed files with 44 additions and 41 deletions

File diff suppressed because one or more lines are too long

View File

@ -311,6 +311,9 @@ PromConsole.graphDefaults = {
yAxisFormatter: PromConsole.NumberFormatter.humanize,
// Number formatter for y values hover detail.
yHoverFormatter: PromConsole.NumberFormatter.humanizeExact,
// Color scheme to be used by the plots. Can be either a list of hex color
// codes or one of the color scheme names supported by Rickshaw.
colorScheme: null,
};
PromConsole.Graph = function(params) {
@ -420,7 +423,7 @@ PromConsole.Graph.prototype._escapeHTML = function(string) {
PromConsole.Graph.prototype._render = function(data) {
var self = this;
var palette = new Rickshaw.Color.Palette();
var palette = new Rickshaw.Color.Palette({scheme: this.params.colorScheme});
var series = [];
// This will be used on resize.