ela 3.1.1 → 3.2.0
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/Gemfile.lock +8 -8
- data/app/js/lib/views/base_graph.coffee +34 -22
- data/app/js/lib/views/graph_view.coffee +9 -2
- data/lib/ela/version.rb +1 -1
- 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: 931596436e4c496baf811835178c70761fe4e7b2
|
4
|
+
data.tar.gz: b548f627ac5a723a0f1ae3ee43afda8e525b5825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 827290ddd153f81e11049c5096feba7ac9fbeeeff00d034cd047a337cbd73c8a6c1c2ef00ec96b6590655e196e056cea2706c4a88d4fcc09747534c779d83997
|
7
|
+
data.tar.gz: ce6769b30ce2a1acf84265feaec2c703714eac5140f9698179466ab2cfce4179f4b43534a6c28ed83f39044e162a0e31e09059cb11b7b855450aaa2b7cba5c1a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ela (3.
|
4
|
+
ela (3.2.0)
|
5
5
|
andand (~> 1.3, >= 1.3.3)
|
6
6
|
bundler (~> 1.13)
|
7
7
|
coffee-script (~> 2.4, >= 2.4.1)
|
@@ -36,12 +36,12 @@ GEM
|
|
36
36
|
http_parser.rb (~> 0.6.0)
|
37
37
|
eventmachine (1.2.5)
|
38
38
|
execjs (2.7.0)
|
39
|
-
ffi (1.9.
|
39
|
+
ffi (1.9.23)
|
40
40
|
formatador (0.2.5)
|
41
|
-
guard (2.14.
|
41
|
+
guard (2.14.2)
|
42
42
|
formatador (>= 0.2.4)
|
43
43
|
listen (>= 2.7, < 4.0)
|
44
|
-
lumberjack (
|
44
|
+
lumberjack (>= 1.0.12, < 2.0)
|
45
45
|
nenv (~> 0.1)
|
46
46
|
notiffany (~> 0.0)
|
47
47
|
pry (>= 0.9.12)
|
@@ -83,7 +83,7 @@ GEM
|
|
83
83
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
84
84
|
rb-inotify (~> 0.9, >= 0.9.7)
|
85
85
|
ruby_dep (~> 1.2)
|
86
|
-
lumberjack (1.0.
|
86
|
+
lumberjack (1.0.13)
|
87
87
|
method_source (0.9.0)
|
88
88
|
multi_json (1.13.1)
|
89
89
|
nenv (0.3.0)
|
@@ -97,10 +97,10 @@ GEM
|
|
97
97
|
rack (1.6.9)
|
98
98
|
rack-protection (1.5.5)
|
99
99
|
rack
|
100
|
-
rack-test (0.
|
100
|
+
rack-test (1.0.0)
|
101
101
|
rack (>= 1.0, < 3)
|
102
102
|
rake (10.5.0)
|
103
|
-
rb-fsevent (0.10.
|
103
|
+
rb-fsevent (0.10.3)
|
104
104
|
rb-inotify (0.9.10)
|
105
105
|
ffi (>= 0.5.0, < 2)
|
106
106
|
ruby_dep (1.5.0)
|
@@ -127,7 +127,7 @@ GEM
|
|
127
127
|
stylus-source (0.54.5)
|
128
128
|
thor (0.20.0)
|
129
129
|
tilt (1.4.1)
|
130
|
-
uglifier (4.1.
|
130
|
+
uglifier (4.1.9)
|
131
131
|
execjs (>= 0.3.0, < 3)
|
132
132
|
|
133
133
|
PLATFORMS
|
@@ -43,6 +43,8 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
43
43
|
xPinchLocked: false
|
44
44
|
yPinchLocked: false
|
45
45
|
scaleLink: false
|
46
|
+
xAxis: { y: 0 }
|
47
|
+
yAxis: { x: 0 }
|
46
48
|
|
47
49
|
initialize: ->
|
48
50
|
super
|
@@ -321,7 +323,7 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
321
323
|
renderCurves: ->
|
322
324
|
# stub
|
323
325
|
|
324
|
-
renderXAxis: ->
|
326
|
+
renderXAxis: (y) ->
|
325
327
|
@context.setLineDash []
|
326
328
|
@context.font = @defaultFont
|
327
329
|
@context.strokeStyle = "#999999"
|
@@ -329,29 +331,30 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
329
331
|
@context.lineWidth = 2
|
330
332
|
|
331
333
|
@context.beginPath()
|
332
|
-
@
|
333
|
-
@context.
|
334
|
+
yPos = @yOrigin - y * @height / @yRange
|
335
|
+
@context.moveTo(0, yPos)
|
336
|
+
@context.lineTo(@width, yPos)
|
334
337
|
|
335
338
|
unless @params.get('xLabelPosition') is 'none'
|
336
339
|
labelY = dashY = 0
|
337
340
|
if @params.get('xLabelPosition') is 'bottom'
|
338
|
-
labelY =
|
339
|
-
dashY =
|
341
|
+
labelY = yPos + 15
|
342
|
+
dashY = yPos + 5
|
340
343
|
else
|
341
|
-
labelY =
|
342
|
-
dashY =
|
344
|
+
labelY = yPos - 15
|
345
|
+
dashY = yPos - 5
|
343
346
|
|
344
347
|
@context.textBaseline = 'middle'
|
345
348
|
@context.textAlign = 'center'
|
346
349
|
|
347
|
-
xRange = @maxRangeX()
|
350
|
+
xRange = @maxRangeX()
|
348
351
|
xMin = -@xOrigin * xRange / @width
|
349
352
|
xMax = (@width - @xOrigin) * xRange / @width
|
350
353
|
xStepSize = @roundStepSize(100 * xRange / @width)
|
351
354
|
for x in [(xMin - xMin % xStepSize) .. xMax] by xStepSize
|
352
355
|
if x <= (0 - xStepSize / 2) or (0 + xStepSize / 2) <= x
|
353
356
|
xPos = @xOrigin + x * @width / xRange
|
354
|
-
@context.moveTo(xPos,
|
357
|
+
@context.moveTo(xPos, yPos)
|
355
358
|
@context.lineTo(xPos, dashY)
|
356
359
|
@context.fillText("#{@xAxisValueLabel(x, xStepSize)}", xPos, labelY)
|
357
360
|
|
@@ -361,14 +364,14 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
361
364
|
else
|
362
365
|
@xOrigin/2
|
363
366
|
xPos = Math.round(xPos) if @context.pixelRatio is 1
|
364
|
-
@context.translate(xPos,
|
367
|
+
@context.translate(xPos, yPos + 15)
|
365
368
|
MarkupText.render(@context, @xAxisLabel(), @defaultFont)
|
366
369
|
@context.restore()
|
367
370
|
|
368
371
|
@context.stroke()
|
369
372
|
@context.closePath()
|
370
373
|
|
371
|
-
renderYAxis: (
|
374
|
+
renderYAxis: (x) ->
|
372
375
|
@context.setLineDash []
|
373
376
|
@context.font = @defaultFont
|
374
377
|
@context.strokeStyle = "#999999"
|
@@ -376,29 +379,30 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
376
379
|
@context.lineWidth = 2
|
377
380
|
|
378
381
|
@context.beginPath()
|
379
|
-
@
|
380
|
-
@context.
|
382
|
+
xPos = @xOrigin + x * @width / @xRange
|
383
|
+
@context.moveTo(xPos, 0)
|
384
|
+
@context.lineTo(xPos, @height)
|
381
385
|
|
382
386
|
unless @params.get('yLabelPosition') is 'none'
|
383
387
|
labelX = dashX = 0
|
384
388
|
if @params.get('yLabelPosition') is 'right'
|
385
|
-
labelX =
|
386
|
-
dashX =
|
389
|
+
labelX = xPos + 10
|
390
|
+
dashX = xPos + 5
|
387
391
|
@context.textAlign = 'left'
|
388
392
|
else
|
389
|
-
labelX =
|
390
|
-
dashX =
|
393
|
+
labelX = xPos - 10
|
394
|
+
dashX = xPos - 5
|
391
395
|
@context.textAlign = 'right'
|
392
396
|
@context.textBaseline = 'middle'
|
393
397
|
|
394
|
-
yRange = @maxRangeY()
|
398
|
+
yRange = @maxRangeY()
|
395
399
|
yMin = -(@height - @yOrigin) * yRange / @height
|
396
400
|
yMax = @yOrigin * yRange / @height
|
397
401
|
yStepSize = @roundStepSize(100 * yRange / @height)
|
398
402
|
for y in [(yMin - yMin % yStepSize) .. yMax] by yStepSize
|
399
403
|
if y <= (0 - yStepSize / 2) or y >= (0 + yStepSize / 2)
|
400
404
|
yPos = @yOrigin - y * @height / yRange
|
401
|
-
@context.moveTo(
|
405
|
+
@context.moveTo(xPos, yPos)
|
402
406
|
@context.lineTo(dashX, yPos)
|
403
407
|
@context.fillText(@yAxisValueLabel(y, yStepSize), labelX, yPos)
|
404
408
|
|
@@ -408,7 +412,7 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
408
412
|
else
|
409
413
|
@yOrigin/2
|
410
414
|
yPos = Math.round(yPos) if @context.pixelRatio is 1
|
411
|
-
@context.translate(
|
415
|
+
@context.translate(xPos - 15, yPos);
|
412
416
|
@context.rotate(-Math.PI / 2);
|
413
417
|
MarkupText.render(@context, @yAxisLabel(), @defaultFont)
|
414
418
|
@context.restore()
|
@@ -470,8 +474,16 @@ class ELA.Views.BaseGraph extends ELA.Views.Canvas
|
|
470
474
|
@beforeRender()
|
471
475
|
|
472
476
|
@renderGrid()
|
473
|
-
@
|
474
|
-
|
477
|
+
xAxis = @params.get('xAxis')
|
478
|
+
if $.isArray(xAxis.y)
|
479
|
+
@renderXAxis(y) for y in xAxis.y
|
480
|
+
else
|
481
|
+
@renderXAxis(xAxis.y)
|
482
|
+
yAxis = @params.get('yAxis')
|
483
|
+
if $.isArray(yAxis.x)
|
484
|
+
@renderYAxis(x) for x in yAxis.x
|
485
|
+
else
|
486
|
+
@renderYAxis(yAxis.x)
|
475
487
|
@renderCurves()
|
476
488
|
|
477
489
|
this
|
@@ -22,10 +22,15 @@ class ELA.Views.GraphView extends ELA.Views.ViewportView
|
|
22
22
|
if options.graphOverlay?.view?
|
23
23
|
@GraphOverlayView = options.graphOverlay.view.toFunction()
|
24
24
|
|
25
|
+
if options.graph?.axes?.x?.y?
|
26
|
+
@xAxis = _.pick(options.graph.axes.x, 'y')
|
27
|
+
|
28
|
+
if options.graph?.axes?.y?.x?
|
29
|
+
@yAxis = _.pick(options.graph.axes.y, 'x')
|
30
|
+
|
25
31
|
for axis, props of options.graph?.axes
|
26
32
|
if props.handler
|
27
|
-
|
28
|
-
position: switch axis
|
33
|
+
switch axis
|
29
34
|
when 'x' then @bottomAxisHandler = attribute: props.attribute
|
30
35
|
when 'y' then @leftAxisHandler = attribute: props.attribute
|
31
36
|
|
@@ -105,6 +110,8 @@ class ELA.Views.GraphView extends ELA.Views.ViewportView
|
|
105
110
|
guides: guides
|
106
111
|
curves: @curves
|
107
112
|
axisLabelingForCurve: @axisLabelingForCurve
|
113
|
+
xAxis: @xAxis
|
114
|
+
yAxis: @yAxis
|
108
115
|
localePrefix: @localePrefix
|
109
116
|
if @leftAxisHandler?
|
110
117
|
view.$el.on('tap', @subviews.leftAxisHandler.updateValue)
|
data/lib/ela/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ela
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franz Kißig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|