/openshift/adei

To get this branch, use:
bzr branch http://darksoft.org/webbzr/openshift/adei

« back to all changes in this revision

Viewing changes to js/plot.js

  • Committer: Suren A. Chilingaryan
  • Date: 2021-07-15 15:23:07 UTC
  • Revision ID: csa@suren.me-20210715152307-otk9cxx0g0ro03vd
Support different modes of assigning axes to the channels

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
function PLOT_CONFIG() 
2
2
{
3
3
    this.plot_mode = null;
 
4
    this.axes_mode = null;
4
5
}
5
6
 
6
 
function PLOT(plot_sel_id) 
 
7
function PLOT(plot_sel_id, axes_sel_id) 
7
8
{
8
9
    this.cfg = new PLOT_CONFIG();
9
10
    
10
11
    this.plotsel = new SELECT(plot_sel_id, plotUpdatePlotMode, this);
 
12
    this.axessel = new SELECT(axes_sel_id, plotUpdateAxesMode, this);
11
13
    
12
14
    this.updater = null;
13
15
    this.config = null;
38
40
        var opts = new Object(/*{'apply': true}*/);
39
41
        if (this.config.cfg.plot_mode) 
40
42
            opts.plot_mode = this.config.cfg.plot_mode;
 
43
        if (this.config.cfg.axes_mode) 
 
44
            opts.axes_mode = this.config.cfg.axes_mode;
41
45
        
42
46
        this.Update(opts);
43
47
    }
47
51
    if (opts) {
48
52
        if (opts.reload) {
49
53
            this.plotsel.Update(adei.GetSelectService("plot_modes"), opts, opts?opts.plot_mode:null);
 
54
            this.axessel.Update(adei.GetSelectService("axes_modes"), opts, opts?opts.axes_mode:null);
50
55
        } else {
51
56
            if (opts.plot_mode) {
52
57
                this.UpdatePlotMode(opts.plot_mode, opts);
53
58
                if (this.plotsel.GetValue() != opts.plot_mode)
54
59
                    this.plotsel.SetValue(opts.plot_mode);
 
60
 
 
61
            } 
 
62
            if (opts.axes_mode) {
 
63
                this.UpdateAxesMode(opts.axes_mode, opts);
 
64
                if (this.axessel.GetValue() != opts.axes_mode)
 
65
                    this.axessel.SetValue(opts.axes_mode);
55
66
            }
56
67
        }
57
68
    }
62
73
    this.cfg.plot_mode = val;
63
74
    
64
75
    if ((typeof opts == "undefined")||(opts.apply))
65
 
    this.Apply(val);
66
 
}
67
 
 
68
 
PLOT.prototype.Apply = function(plot_mode) {
69
 
    if (plot_mode)
70
 
        this.config.SetPlotSettings(plot_mode);
71
 
    else
72
 
        this.config.SetPlotSettings(this.cfg.plot_mode);
73
 
 
 
76
    this.Apply(val, null);
 
77
}
 
78
 
 
79
PLOT.prototype.UpdateAxesMode = function(val, opts)
 
80
{
 
81
    this.cfg.axes_mode = val;
 
82
    
 
83
    if ((typeof opts == "undefined")||(opts.apply))
 
84
    this.Apply(null, val);
 
85
}
 
86
 
 
87
PLOT.prototype.Apply = function(plot_mode, axes_mode) {
 
88
    this.config.SetPlotSettings(plot_mode?plot_mode:this.cfg.plot_mode, axes_mode?axes_mode:this.cfg.axes_mode);
74
89
    this.config.Save();
75
90
    if (this.updater) this.updater.Update();
76
91
}
79
94
{
80
95
    return self.UpdatePlotMode(val, opts);
81
96
}
 
97
 
 
98
function plotUpdateAxesMode(self, val, opts)
 
99
{
 
100
    return self.UpdateAxesMode(val, opts);
 
101
}