~l3on/ubuntu/precise/rkward/rebuild1

« back to all changes in this revision

Viewing changes to rkward/plugins/plots/histogram_options.js

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Friedrichsmeier
  • Date: 2009-10-26 14:30:00 UTC
  • mfrom: (1.1.13 upstream) (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20091026143000-wzwt6cryjnwce23k
Tags: 0.5.2-1
* new upstream release
  closes: #551306 (added support for the new dynamic help system)
* Add "DM-Upload-Allowed: yes" in control
* bump standards version to 3.8.3 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// globals
 
2
var headeroptions;
 
3
var histcalcoptions;
 
4
var histplotoptions;
 
5
 
 
6
function makeCodes () {
 
7
        histcalcoptions = ", breaks=";
 
8
        histplotoptions = "";
 
9
        headeroptions = "";
 
10
        varname = getValue ("varname");
 
11
 
 
12
        histbreaks = getValue ("histbreaksFunction");
 
13
        headeroptions += ', "Break points", "';
 
14
        if (histbreaks == "cells") {
 
15
                histcalcoptions += getValue ("histbreaks_ncells");
 
16
                headeroptions += 'Approximately ' + getValue ("histbreaks_ncells") + ' cells"';
 
17
        } else if (histbreaks == "int") {
 
18
                histcalcoptions += "seq (floor (min (" + varname + ", na.rm=TRUE))-0.5, ceiling (max (" + varname + ", na.rm=TRUE))+0.5)";
 
19
                headeroptions += 'Integers"';
 
20
        }
 
21
        else if (histbreaks == "vec") {
 
22
                histcalcoptions += "(function(x) {y = extendrange(x,f=0.1); seq(from=y[1], to=y[2], length=" + getValue ("histbreaks_veclength") + ")})(" + varname + ")";
 
23
                headeroptions += 'Equally spaced vector of length ' + getValue ("histbreaks_veclength") + '"';
 
24
        } else {
 
25
                histcalcoptions += "\"" + histbreaks + "\"";
 
26
                headeroptions += histbreaks + '"';
 
27
        }
 
28
 
 
29
        right = getValue ("rightclosed");
 
30
        if (!right) {
 
31
                headeroptions += ', "Right closed", "FALSE"';
 
32
                histcalcoptions += ", right=FALSE";
 
33
        } else {
 
34
                headeroptions += ', "Right closed", "TRUE"';
 
35
        }
 
36
 
 
37
        inclowest = getValue ("include_lowest");
 
38
        if (!inclowest) {
 
39
                headeroptions += ', "Include in lowest cell", "FALSE"';
 
40
                histcalcoptions += ", include.lowest=FALSE";
 
41
        } else {
 
42
                headeroptions += ', "Include in lowest cell", "TRUE"';
 
43
        }
 
44
 
 
45
        freq = getValue ("freq");
 
46
        if (!freq) {
 
47
                histplotoptions += ", freq=FALSE";
 
48
                headeroptions += ', "Scale", "Density"';
 
49
        } else {
 
50
                headeroptions += ', "Scale", "Frequency"';
 
51
        }
 
52
 
 
53
        addbars = getValue ("addtoplot");
 
54
        if (addbars) histplotoptions += ", add=TRUE";
 
55
 
 
56
        labels = getValue ("barlabels");
 
57
        if (labels) histplotoptions += ", labels=TRUE";
 
58
 
 
59
        histlty = getValue ("histlinetype");
 
60
        histplotoptions += ", lty=" + "\"" + histlty + "\"";
 
61
 
 
62
        if (histlty != "blank") {
 
63
                density = getValue ("density");
 
64
                histplotoptions += ", density=" + density;
 
65
                if (density > 0) histplotoptions += ", angle=" + getValue ("angle");
 
66
                if (getValue ("doborder")) histbordercol = getValue ("histbordercol.code.printout");
 
67
                else histbordercol = ", border=FALSE";
 
68
        }
 
69
 
 
70
        histfillcol = "";
 
71
        if (getValue ("usefillcol")) histfillcol = getValue ("histfillcol.code.printout");
 
72
 
 
73
        histplotoptions += histbordercol + histfillcol;
 
74
}
 
75
 
 
76
function preprocess () {
 
77
        makeCodes();
 
78
 
 
79
        echo (headeroptions);
 
80
}
 
81
 
 
82
function calculate () {
 
83
        
 
84
 
 
85
        echo (histcalcoptions);
 
86
}
 
87
 
 
88
function printout () {
 
89
        
 
90
 
 
91
        echo (histplotoptions);
 
92
}
 
93