From 72a1946cd3712cc68b69371c004a63cd97ea73a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 25 Jul 2012 20:34:17 +0200 Subject: [PATCH] Add constant interpolation on line graph review422001 --- CHANGELOG | 1 + doc/topics/views/index.rst | 16 ++++++++++++++++ trytond/ir/ui/graph.rnc | 3 +++ trytond/ir/ui/graph.rng | 12 ++++++++++++ 4 files changed, 32 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d2a9d15b1d..c278ed60fb 100644 --- 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 diff --git a/doc/topics/views/index.rst b/doc/topics/views/index.rst index 06b0dae04c..2d42f7e28c 100644 --- a/doc/topics/views/index.rst +++ b/doc/topics/views/index.rst @@ -541,6 +541,22 @@ field * ``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 ------- diff --git a/trytond/ir/ui/graph.rnc b/trytond/ir/ui/graph.rnc index 2d19297a78..3a74cfc563 100644 --- a/trytond/ir/ui/graph.rnc +++ b/trytond/ir/ui/graph.rnc @@ -25,6 +25,9 @@ attlist.field &= attribute empty { "0" | "1" }? 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, diff --git a/trytond/ir/ui/graph.rng b/trytond/ir/ui/graph.rng index 71cdb68961..125c49c339 100644 --- a/trytond/ir/ui/graph.rng +++ b/trytond/ir/ui/graph.rng @@ -125,6 +125,18 @@ + + + + + constant-left + constant-right + constant-center + linear + + + +