summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/epoch/src/time/bar.coffee
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:41:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 10:41:59 +0000
commitbe05184b2324848b4f33e6e5d9c716bc95f581f3 (patch)
tree4da6fcfe204d1694377e90c44b02f1b0790aabe8 /debian/missing-sources/epoch/src/time/bar.coffee
parentAdding upstream version 5.3.1. (diff)
downloadknot-resolver-be05184b2324848b4f33e6e5d9c716bc95f581f3.tar.xz
knot-resolver-be05184b2324848b4f33e6e5d9c716bc95f581f3.zip
Adding debian version 5.3.1-1+deb11u1.debian/5.3.1-1+deb11u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/epoch/src/time/bar.coffee')
-rw-r--r--debian/missing-sources/epoch/src/time/bar.coffee48
1 files changed, 48 insertions, 0 deletions
diff --git a/debian/missing-sources/epoch/src/time/bar.coffee b/debian/missing-sources/epoch/src/time/bar.coffee
new file mode 100644
index 0000000..7bcb7be
--- /dev/null
+++ b/debian/missing-sources/epoch/src/time/bar.coffee
@@ -0,0 +1,48 @@
+
+# Real-time Bar Chart implementation.
+class Epoch.Time.Bar extends Epoch.Time.Stack
+ constructor: (@options={}) ->
+ @options.type ?= 'time.bar'
+ super(@options)
+ @draw()
+
+ # @return [Number] An offset used to align the ticks to the center of the rendered bars.
+ _offsetX: ->
+ 0.5 * @w() / @pixelRatio
+
+ # Sets the styles for the graphics context given a layer class name.
+ # @param [String] className The class name to use when deriving the styles.
+ setStyles: (className) ->
+ styles = @getStyles "rect.bar.#{className.replace(/\s/g,'.')}"
+ @ctx.fillStyle = styles.fill
+
+ if !styles.stroke? or styles.stroke == 'none'
+ @ctx.strokeStyle = 'transparent'
+ else
+ @ctx.strokeStyle = styles.stroke
+
+ if styles['stroke-width']?
+ @ctx.lineWidth = styles['stroke-width'].replace('px', '')
+
+ # Draws the stacked bar chart.
+ draw: (delta=0) ->
+ @clear()
+ [y, w] = [@y(), @w()]
+
+ for layer in @getVisibleLayers()
+ continue unless Epoch.isNonEmptyArray(layer.values)
+ @setStyles(layer.className)
+
+ [i, k, trans] = [@options.windowSize, layer.values.length, @inTransition()]
+ iBoundry = if trans then -1 else 0
+
+ while (--i >= iBoundry) and (--k >= 0)
+ entry = layer.values[k]
+ [ex, ey, ey0] = [i*w+delta, entry.y, entry.y0]
+ ex += w if trans
+ args = [ex+1, y(ey+ey0), w-2, @innerHeight()-y(ey)+0.5*@pixelRatio]
+
+ @ctx.fillRect.apply(@ctx, args)
+ @ctx.strokeRect.apply(@ctx, args)
+
+ super()