|
From: <j-...@us...> - 2012-09-18 18:48:17
|
Revision: 1013
http://openautomation.svn.sourceforge.net/openautomation/?rev=1013&view=rev
Author: j-n-k
Date: 2012-09-18 18:48:10 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
Added "legend"-attribute to diagram-Plugin ("both", "popup", "inline", "none")
Fixed XSD for diagram-Plugin
Modified Paths:
--------------
CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
CometVisu/trunk/visu/visu_config.xsd
Modified: CometVisu/trunk/visu/plugins/diagram/structure_plugin.js
===================================================================
--- CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-09-18 16:06:39 UTC (rev 1012)
+++ CometVisu/trunk/visu/plugins/diagram/structure_plugin.js 2012-09-18 18:48:10 UTC (rev 1013)
@@ -35,7 +35,7 @@
* - rrd: required, name of RRD
* - unit: optional, unit for axis-labels
* - series: optional, "hour", "day" (default), "week", "month", "year"
- * - period: optional, ?
+ * - period: optional, number of "series" to be shown
* - datasource: optional, RRD-datasource, "MIN", "AVERAGE" (default), "MAX"
* - refresh: optional, refresh-rate in seconds, no refresh if missing
* - yaxismin, yaxismax: optional, limits for y-axis
@@ -43,6 +43,7 @@
* - width, height: optional, width and height of "inline"-diagram
* - previewlabels: optional, show labels on "inline"-diagram
* - popup: optional, make diagram clickable and open popup
+ * - legend: optional, "none", "both", "inline", "popup" select display of legend
* - title: optional, diagram title (overrides label-content)
*
* functions:
@@ -131,6 +132,7 @@
diagram.data("series", $p.attr("series") || "day");
diagram.data("period", $p.attr("period") || 1);
diagram.data("datasource", $p.attr("datasource") || "AVERAGE");
+ diagram.data("legend", $p.attr("legend") || "both");
if ($p.attr("title")) {
diagram.data("label", $p.attr("title"));
} else {
@@ -144,9 +146,12 @@
diagram.addClass("clickable");
var data = jQuery.extend({}, diagram.data());
+ diagram.data("ispopup", false);
+
if ((oldType=="popup") || ($p.attr("popup")=="true")) {
diagram.bind("click", function() {
bDiagram.data(data);
+ bDiagram.data("ispopup", true);
bDiagram.css({height: "90%"});
showPopup("unknown", {title: bDiagram.data('label'), content: bDiagram});
bDiagram.parent("div").css({height: "100%", width: "90%", margin: "auto"}); // define parent as 100%!
@@ -275,6 +280,7 @@
height: {type: "string", required: false},
previewlabels: {type: "list", required: false, list: {'true': "yes", 'false': "no"}},
popup: {type: "list", required: false, list: {'true': "yes", 'false': "no"}},
+ showlegend: {type: "list", required: false, list: {'both': "both", 'inline': "inline", 'popup': "popup", 'none': "none"}},
title: {type: "string", required: false}
},
elements: {
@@ -337,6 +343,7 @@
bDiagram.data("series", $p.attr("series") || "day");
bDiagram.data("period", $p.attr("period") || 1);
bDiagram.data("datasource", $p.attr("datasource") || "AVERAGE");
+ bDiagram.data("legend", $p.attr("legend") || "both");
if ($p.attr("title")) {
bDiagram.data("label", $p.attr("title"));
} else {
@@ -345,13 +352,15 @@
bDiagram.data("refresh", $p.attr("refresh"));
bDiagram.data("gridcolor", $p.attr("gridcolor") || "");
-
+
+
var data = jQuery.extend({}, bDiagram.data());
$actor.bind("click", function() {
bDiagram.data(data);
bDiagram.css({height: "90%"});
-
+ bDiagram.data("ispopup", true);
+
showPopup("unknown", {title: bDiagram.data('label'), content: bDiagram});
bDiagram.parent("div").css({height: "100%", width: "90%", margin: "auto"}); // define parent as 100%!
bDiagram.empty();
@@ -416,6 +425,7 @@
format: { type: 'format', required: false },
mapping: { type: 'mapping', required: false },
styling: { type: 'styling', required: false },
+ legend: {type: "list", required: false, list: {'both': "both", 'inline': "inline", 'popup': "popup", 'none': "none"}},
title: {type: "string", required: false}
},
elements: {
@@ -448,6 +458,10 @@
if (typeof (content) == "undefined") { // Fenster schon geschlossen oder keine Achsen und RRD konfiguriert
return;
}
+
+ var showlegend = !((diagram.data("legend")=="none")
+ || (diagram.data("ispopup") && (diagram.data("legend")=="inline"))
+ || (!diagram.data("ispopup") && (diagram.data("legend")=="popup")));
var label = diagram.data("label"); // title of diagram
var refresh = diagram.data("refresh");
@@ -470,7 +484,7 @@
mode: "time"
}],
legend: {
- show: 1,
+ show: showlegend,
backgroundColor: "#101010"
},
series: {
Modified: CometVisu/trunk/visu/visu_config.xsd
===================================================================
--- CometVisu/trunk/visu/visu_config.xsd 2012-09-18 16:06:39 UTC (rev 1012)
+++ CometVisu/trunk/visu/visu_config.xsd 2012-09-18 18:48:10 UTC (rev 1013)
@@ -215,6 +215,7 @@
<xsd:element name="diagram_popup" type="diagram_popup" />
<xsd:element name="diagram_inline" type="diagram_inline" />
<xsd:element name="diagram_info" type="diagram_info" />
+ <xsd:element name="diagram" type="diagram" />
<xsd:element name="gweather" type="gweather" />
<xsd:element name="rss" type="rss" />
<xsd:element name="rsslog" type="rsslog" />
@@ -271,6 +272,7 @@
<xsd:element name="diagram_popup" type="diagram_popup" />
<xsd:element name="diagram_inline" type="diagram_inline" />
<xsd:element name="diagram_info" type="diagram_info" />
+ <xsd:element name="diagram" type="diagram" />
<xsd:element name="gweather" type="gweather" />
<xsd:element name="rss" type="rss" />
<xsd:element name="rsslog" type="rsslog" />
@@ -311,6 +313,7 @@
<xsd:element name="diagram_popup" type="diagram_popup" />
<xsd:element name="diagram_inline" type="diagram_inline" />
<xsd:element name="diagram_info" type="diagram_info" />
+ <xsd:element name="diagram" type="diagram" />
<xsd:element name="gweather" type="gweather" />
<xsd:element name="rss" type="rss" />
<xsd:element name="jqclock" type="jqclock" />
@@ -511,6 +514,31 @@
</xsd:choice>
</xsd:complexType>
+ <xsd:complexType name="diagram">
+ <xsd:choice maxOccurs="unbounded" minOccurs="0">
+ <xsd:element name="label" type="label" maxOccurs="1" />
+ <xsd:element name="layout" type="layout" minOccurs="0" maxOccurs="1" />
+ <xsd:element name="axis" type="axis"></xsd:element>
+ <xsd:element name="rrd" type="rrd"></xsd:element>
+ </xsd:choice>
+ <xsd:attribute name="rrd" type="xsd:string" use="optional" />
+ <xsd:attribute name="unit" type="xsd:string" use="optional" />
+ <xsd:attribute name="width" type="dimension" use="optional" />
+ <xsd:attribute name="series" type="xsd:string" use="optional" />
+ <xsd:attribute name="height" type="dimension" use="optional" />
+ <xsd:attribute name="refresh" type="xsd:integer" use="optional" />
+ <xsd:attribute name="period" type="xsd:string" use="optional" />
+ <xsd:attribute name="datasource" type="xsd:string" use="optional" />
+ <xsd:attribute name="linecolor" type="xsd:string" use="optional" />
+ <xsd:attribute name="gridcolor" type="xsd:string" use="optional" />
+ <xsd:attribute name="yaxismin" type="xsd:string" use="optional" />
+ <xsd:attribute name="yaxismax" type="xsd:string" use="optional" />
+ <xsd:attribute name="legend" type="xsd:string" use="optional" />
+ <xsd:attribute name="popup" type="xsd:boolean" use="optional" />
+ <xsd:attribute name="previewlabels" type="xsd:boolean" use="optional" />
+ <xsd:attribute name="title" type="xsd:string" use="optional" />
+ </xsd:complexType>
+
<xsd:complexType name="diagram_inline">
<xsd:choice maxOccurs="unbounded" minOccurs="0">
<xsd:element name="label" type="label" maxOccurs="1" />
@@ -518,7 +546,7 @@
<xsd:element name="axis" type="axis"></xsd:element>
<xsd:element name="rrd" type="rrd"></xsd:element>
</xsd:choice>
- <xsd:attribute name="rrd" type="xsd:string" use="required" />
+ <xsd:attribute name="rrd" type="xsd:string" use="optional" />
<xsd:attribute name="unit" type="xsd:string" use="optional" />
<xsd:attribute name="width" type="dimension" use="optional" />
<xsd:attribute name="series" type="xsd:string" use="optional" />
@@ -540,7 +568,7 @@
<xsd:element name="axis" type="axis"></xsd:element>
<xsd:element name="rrd" type="rrd"></xsd:element>
</xsd:choice>
- <xsd:attribute name="rrd" type="xsd:string" use="required" />
+ <xsd:attribute name="rrd" type="xsd:string" use="optional" />
<xsd:attribute name="unit" type="xsd:string" use="optional" />
<xsd:attribute name="series" type="xsd:string" use="optional" />
<xsd:attribute name="refresh" type="xsd:integer" use="optional" />
@@ -576,6 +604,7 @@
<xsd:attribute name="gridcolor" type="xsd:string" use="optional" />
<xsd:attribute name="yaxismin" type="xsd:string" use="optional" />
<xsd:attribute name="yaxismax" type="xsd:string" use="optional" />
+ <xsd:attribute name="legend" type="xsd:string" use="optional" />
<xsd:attribute name="title" type="xsd:string" use="optional" />
</xsd:complexType>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|