Project

General

Profile

Revision be8790c3

IDbe8790c3705bf47f916dfdde235a96e24ebae974
Parent e381d893
Child 3104ae2b

Added by Francois POIROTTE about 13 years ago

Léger recouvrement des graphes (10%), cf. #730

Fait en sorte qu'une partie du graphe précédent reste visible lorsqu'on
se déplace dans VigiGraph (recouvrement).
La valeur par défaut est 10%, mais on pourrait facilement la rendre
paramétrable au niveau de l'interface.

Ce commit corrige aussi un problème lorsque la période d'affichage du
graphe a été passée dans l'URL (les timestamps générés étaient alors
excessivement grand car il s'agissait d'une concaténation de chaînes
constituées de la date de début et de la durée d'affichage).
Le problème est résolu en convertissant tous les paramètres en entiers
lors de l'appel au constructeur de la classe Graph.

Change-Id: I6a909d6eb52bc3886b435c0b625a06edf4e08630

View differences:

vigigraph/public/js/graph.js
12 12
    Implements: [Events, Options],
13 13

  
14 14
    options: {
15
        // Les valeurs par défaut sont assignées dans reset().
16 15
        duration: 86400,
17 16
        start: null,
18 17
        autoRefresh: 0,
19 18
        refreshDelay: null,
20 19
        left: null,
21
        top: null
20
        top: null,
21
        overlay: 10    // Pourcentage de recouvrement (voir #730)
22 22
    },
23 23

  
24 24
    initialize: function (options, host, graph) {
......
31 31
        new Request.JSON({
32 32
            url: app_path + 'rpc/startTime',
33 33
            onSuccess: function (data) {
34
                this.startTime = data.starttime;
34
                this.startTime = data.starttime.toInt();
35 35
            }.bind(this)
36 36
        }).get({'host': this.host});
37 37

  
......
61 61
            menuItem.options.period = period[1] * 60 * 60;
62 62
            menuItem.addEvent('click', function () {
63 63
                this[0].options.start = null;
64
                this[0].options.duration = this[1].options.period;
64
                this[0].options.duration = (this[1].options.period).toInt();
65 65
                this[0].updateGraph();
66 66
            }.bind([this, menuItem]));
67 67
            timeframe.add(menuItem);
......
168 168
                onClick: function() {
169 169
                    this.options.start =
170 170
                        this.getStartTime() -
171
                        this.options.duration;
171
                        this.options.duration +
172
                        (this.options.overlay * this.options.duration / 100).toInt();
172 173
                    this.updateGraph();
173 174
                }.bind(this)
174 175
            }),
......
178 179
                onClick: function() {
179 180
                    this.options.start =
180 181
                        this.getStartTime() +
181
                        this.options.duration;
182
                        this.options.duration -
183
                        (this.options.overlay * this.options.duration / 100).toInt();
182 184
                    this.updateGraph();
183 185
                }.bind(this)
184 186
            }),
......
423 425

  
424 426
            params.each(function (param) {
425 427
                if (this[0].has(param))
426
                    this[1].set(param, this[0].get(param));
428
                    this[1].set(param, (this[0].get(param)).toInt());
427 429
            }, [qs, options]);
428 430

  
429 431
            new Graph(

Also available in: Unified diff