From da74005c2da72cab57c172b5406db76a273c83da Mon Sep 17 00:00:00 2001 From: Frank Wuerthwein Date: Thu, 7 May 2009 00:57:52 +0000 Subject: Title and label use each other as backup --- src/lib/rrdFlot.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/lib/rrdFlot.js b/src/lib/rrdFlot.js index e7f2ceb..e57ff6d 100644 --- a/src/lib/rrdFlot.js +++ b/src/lib/rrdFlot.js @@ -36,9 +36,9 @@ * with each element being a graph_option * The defaults for each element are * { - * title: ds_name // this is what is displayed at the radio button + * title: label or ds_name // this is what is displayed at the radio button * checked: first_ds_in_list? //boolean - * label: ds_name // this is what is displayed in the legend + * label: title or ds_name // this is what is displayed in the legend * color: ds_index // see Flot docs for details * lines: { show:true } // see Flot docs for details * yaxis: 1 // can be 1 or 2 @@ -209,7 +209,10 @@ rrdFlot.prototype.populateDScb = function() { if (dgo['title']!=null) { // if the user provided the title, use it title=dgo['title']; - } + } else if (dgo['label']!=null) { + // use label as a second choiceit + title=dgo['label']; + } // else leave the ds name if (dgo['checked']!=null) { // if the user provided the title, use it checked=dgo['checked']; @@ -286,7 +289,10 @@ rrdFlot.prototype.drawFlotGraph = function() { if (dgo['label']!=null) { // if the user provided the label, use it flot_obj.data[i].label=dgo['label']; - } + } else if (dgo['title']!=null) { + // use title as a second choice + flot_obj.data[i].label=dgo['title']; + } // else use the ds name if (dgo['lines']!=null) { // if the user provided the label, use it flot_obj.data[i].lines=dgo['lines']; -- cgit v1.2.3-54-g00ecf