SimpleOutput 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/simplechartkick.rb +23 -1
- data/lib/simpleoutput.rb +14 -12
- data/lib/simpleplot.rb +1 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1021b8e727bd57ca7306f798c4ce7e6adab255f
|
4
|
+
data.tar.gz: 72a7123861c4cdb39571563629b5f1e9c10b2a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 262dbd68dca7299bfde5ffbe08a706563ca250e7e7d01c7c637da4bba61213f68fde2ae9f089df9c3cf7a583e0db67d2a9df7e1f95efe2e2d437c4a79153d19a
|
7
|
+
data.tar.gz: cec519a4297f141e42540c647b0cd1c1be0711cd7c13840c26a91dbeb8d511c85a0ba9c6bd8c85c2ce9c94d1ba7209881306275ab5bd0fae05bacb0fbf6808b0
|
data/lib/simplechartkick.rb
CHANGED
@@ -24,14 +24,36 @@ class SimpleChartkick < SimpleOutput::SimpleOutputPlugin
|
|
24
24
|
super()
|
25
25
|
@filename = filename
|
26
26
|
@metadata = {}
|
27
|
+
@series_next = 0
|
27
28
|
chartkick_path = javascript_path + ((javascript_path[-1] == "/") ? "chartkick.js" : "/chartkick.js");
|
28
29
|
@html = "<html>\n<title>\n#{title}\n</title>\n<script src='http://www.google.com/jsapi'></script>\n
|
29
30
|
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>
|
30
31
|
<script src='#{chartkick_path}'></script>\n<body>\n"
|
31
32
|
|
32
33
|
end
|
34
|
+
|
35
|
+
def check_title(name, options)
|
36
|
+
if options.has_key?('series')
|
37
|
+
@metadata[name]['series_titles'] << options['series']
|
38
|
+
else
|
39
|
+
@metadata[name]['series_titles'] << "set-#{@series_next}"
|
40
|
+
@series_next += 1
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def set_x_callback(data, name, options)
|
46
|
+
xmin = data.min
|
47
|
+
xmax = data.max
|
48
|
+
@metadata[name]['xmin'] = xmin
|
49
|
+
@metadata[name]['xmax'] = xmax
|
50
|
+
@metadata[name]['length'] = (@metadata[name]['length'] < data.size) ? data.size : @metadata[name]['length']
|
51
|
+
check_title(name, options)
|
52
|
+
end
|
53
|
+
|
33
54
|
def new_data_callback(name)
|
34
|
-
|
55
|
+
name = translate_name(name)
|
56
|
+
@metadata[name] = {'length' => 0, 'chart_type' => 'LineChart', 'bincount' => 10, 'series_titles' => []}
|
35
57
|
end
|
36
58
|
|
37
59
|
def options_callback(options)
|
data/lib/simpleoutput.rb
CHANGED
@@ -28,7 +28,7 @@ module SimpleOutput
|
|
28
28
|
@series_names = {}
|
29
29
|
@data_id = 0
|
30
30
|
@annotations = {}
|
31
|
-
@current_name = ""
|
31
|
+
@current_name = "NameError"
|
32
32
|
@series_id = 0
|
33
33
|
@metadata = {}
|
34
34
|
end
|
@@ -53,12 +53,6 @@ module SimpleOutput
|
|
53
53
|
if name == nil
|
54
54
|
name = @current_name
|
55
55
|
end
|
56
|
-
if !@x.has_key?(name)
|
57
|
-
@x[name] = []
|
58
|
-
end
|
59
|
-
if !@y.has_key?(name)
|
60
|
-
@y[name] = []
|
61
|
-
end
|
62
56
|
return name
|
63
57
|
end
|
64
58
|
|
@@ -86,6 +80,10 @@ module SimpleOutput
|
|
86
80
|
end
|
87
81
|
end
|
88
82
|
|
83
|
+
def new_data_check(name=nil)
|
84
|
+
(!@x.has_key?(name)) || (!@y.has_key?(name))
|
85
|
+
end
|
86
|
+
|
89
87
|
def setXData(data, name, options={})
|
90
88
|
@x[name] = []
|
91
89
|
@x[name] << data
|
@@ -109,11 +107,15 @@ module SimpleOutput
|
|
109
107
|
#Interface Functions ===================================
|
110
108
|
def appendXY( x=[], y=[],name=nil, options={})
|
111
109
|
name = translate_name(name)
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
110
|
+
if !self.new_data_check(name)
|
111
|
+
@x[name] << x
|
112
|
+
@y[name] << y
|
113
|
+
self.append_series_name(name, options)
|
114
|
+
self.options_callback(options)
|
115
|
+
self.append_callback(x,y,name,options)
|
116
|
+
else
|
117
|
+
self.newData(x,y,name,options)
|
118
|
+
end
|
117
119
|
end
|
118
120
|
|
119
121
|
def setXY(x=[], y=[], name=nil, options={})
|
data/lib/simpleplot.rb
CHANGED
@@ -98,16 +98,12 @@ class SimplePlot < SimpleOutput::SimpleOutputPlugin
|
|
98
98
|
xmax = x.max
|
99
99
|
ymin = y.min
|
100
100
|
ymax = y.max
|
101
|
-
if !@metadata.has_key?(name)
|
102
|
-
new_data_callback(name)
|
103
|
-
end
|
104
101
|
@metadata[name]['length'] = @metadata[name]['length'] < x.size ? x.size : @metadata[name]['length']
|
105
102
|
@metadata[name]['xmin'] = xmin < @metadata[name]['xmin'] ? xmin : @metadata[name]['xmin']
|
106
103
|
@metadata[name]['xmax'] = xmax > @metadata[name]['xmax'] ? xmax : @metadata[name]['xmax']
|
107
104
|
@metadata[name]['ymin'] = ymin < @metadata[name]['ymin'] ? ymin : @metadata[name]['ymin']
|
108
105
|
@metadata[name]['ymax'] = ymax > @metadata[name]['ymax'] ? ymax : @metadata[name]['ymax']
|
109
|
-
check_title(name, options)
|
110
|
-
|
106
|
+
check_title(name, options)
|
111
107
|
end
|
112
108
|
|
113
109
|
def save()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SimpleOutput
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austen Higgins-Cassidy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gnuplot
|