Reviewers: ,


Please review this at http://codereview.tryton.org/422001/

Affected files:
  M CHANGELOG
  M doc/topics/views/index.rst
  M trytond/ir/ui/graph.rnc
  M trytond/ir/ui/graph.rng


Index: CHANGELOG
===================================================================

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Add constant interpolation on line graph
 * Add create/delete field access
 * Add dynamic size limit on the One2Many, Many2Many and Char
 * Replace __tryton__.py by tryton.cfg

Index: doc/topics/views/index.rst
===================================================================

--- a/doc/topics/views/index.rst
+++ b/doc/topics/views/index.rst
@@ -541,6 +541,22 @@
     * ``empty``: defined if the line graph must put a point for missing
       dates.

+ * ``interpolation``: defined how the line graph must interpolate points.
+      The default is ``linear``.
+
+        * ``constant-center``: use the value of the nearest point, see
+          `Nearest-neighbor interpolation`_
+
+        * ``constant-left``: use the value of the nearest left point.
+
+        * ``constant-right``: use the value of the nearest right point.
+
+        * ``linear``: see `linear interpolation`_
+
+.. _`Nearest-neighbor interpolation`:
+    http://en.wikipedia.org/wiki/Nearest-neighbor_interpolation
+.. _`linear interpolation`: http://en.wikipedia.org/wiki/Linear_interpolation
+

 Example
 -------

Index: trytond/ir/ui/graph.rnc
===================================================================

--- a/trytond/ir/ui/graph.rnc
+++ b/trytond/ir/ui/graph.rnc
@@ -25,6 +25,9 @@
 attlist.field &= attribute color { text }?
 attlist.field &= attribute widget { "float_time" }?
 attlist.field &= attribute float_time { text }?
+attlist.field &=
+    [ a:defaultValue = "linear" ]
+ attribute interpolation { "constant-left" | "constant-right" | "constant-center" | "linear" }?
 data = element data { attlist.data, xpath+ }
 attlist.data &= empty
 xpath = element xpath { attlist.xpath,

Index: trytond/ir/ui/graph.rng
===================================================================

--- a/trytond/ir/ui/graph.rng
+++ b/trytond/ir/ui/graph.rng
@@ -125,6 +125,18 @@
       <attribute name="float_time"/>
     </optional>
   </define>
+  <define name="attlist.field" combine="interleave">
+    <optional>
+      <attribute name="interpolation" a:defaultValue="linear">
+        <choice>
+          <value>constant-left</value>
+          <value>constant-right</value>
+          <value>constant-center</value>
+          <value>linear</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
   <define name="data">
     <element name="data">
       <ref name="attlist.data"/>



--
[email protected] mailing list

Reply via email to