summaryrefslogtreecommitdiff
path: root/app/client/modules
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-06 05:04:09 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-06 05:04:09 +0200
commitd3eb42bea8906fda453498e8c4d4f012a555a2ac (patch)
tree3bc633b5ed559fd595d2cc35afb80281a36d6c80 /app/client/modules
parent678fa17ef0c1fd6d237c8d0fd6f0dcb4ef2e3828 (diff)
fixing canvas
Diffstat (limited to 'app/client/modules')
-rw-r--r--app/client/modules/samplernn/views/samplernn.graph.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/app/client/modules/samplernn/views/samplernn.graph.js b/app/client/modules/samplernn/views/samplernn.graph.js
index 9685802..e94db6c 100644
--- a/app/client/modules/samplernn/views/samplernn.graph.js
+++ b/app/client/modules/samplernn/views/samplernn.graph.js
@@ -40,9 +40,9 @@ class SampleRNNGraph extends Component {
canvas.style.width = canvas.width + 'px'
canvas.style.height = canvas.height + 'px'
- const ctx = canvas.getContext('2d-lodpi')
- const w = canvas.width = canvas.width * devicePixelRatio
- const h = canvas.height = canvas.height * devicePixelRatio
+ const ctx = canvas.getContext('2d')
+ const w = canvas.width
+ const h = canvas.height
ctx.clearRect(0,0,w,h)
const keys = Object.keys(lossReport).sort().filter(k => !!lossReport[k].length)
@@ -66,9 +66,9 @@ class SampleRNNGraph extends Component {
scaleMin = 0
const margin = 0
const wmin = 0
- const wmax = w
+ const wmax = w/2
const hmin = 0
- const hmax = h
+ const hmax = h/2
const epochsScaleFactor = 1 // 3/2
let X, Y
@@ -78,15 +78,15 @@ class SampleRNNGraph extends Component {
ctx.beginPath(0, 0)
ctx.moveTo(X, 0)
ctx.lineTo(X, h)
- ctx.lineWidth = 1
+ ctx.lineWidth = 0.5
// ctx.stroke()
if ( (ii % 5) === 0 ) {
- ctx.lineWidth = 2
+ ctx.lineWidth = 0.5
ctx.stroke()
const fontSize = 12
- ctx.font = 'italic ' + (fontSize * devicePixelRatio) + 'px "Georgia"'
+ ctx.font = 'italic ' + (fontSize) + 'px "Georgia"'
ctx.fillStyle = 'rgba(0,12,28,0.6)'
- ctx.fillText(ii/5*6, X + (8 * devicePixelRatio), h - ((fontSize + 4) * devicePixelRatio))
+ ctx.fillText(ii/5*6, X + (8), h - ((fontSize + 4)))
}
}
for (var ii = scaleMin; ii < scaleMax; ii += 1) {
@@ -106,9 +106,9 @@ class SampleRNNGraph extends Component {
ctx.stroke()
ctx.setLineDash([0,0])
const fontSize = 12
- ctx.font = 'italic ' + (fontSize * devicePixelRatio) + 'px "Georgia"'
+ ctx.font = 'italic ' + (fontSize) + 'px "Georgia"'
ctx.fillStyle = 'rgba(0,12,28,0.6)'
- ctx.fillText(ii.toFixed(1), w-50, (h-Y) + fontSize + (10 * devicePixelRatio))
+ ctx.fillText(ii.toFixed(1), w-50, (h-Y) + fontSize + (10))
// }
}
ctx.lineWidth = 1
@@ -144,7 +144,7 @@ class SampleRNNGraph extends Component {
const x = lerp((i-2)/(epochsMax/(epochsScaleFactor))*(epochsScaleFactor), wmin, wmax)
const y = lerp(norm(v, scaleMin, scaleMax), hmax, hmin)
const fontSize = 9
- ctx.font = 'italic ' + (fontSize * devicePixelRatio) + 'px "Georgia"'
+ ctx.font = 'italic ' + (fontSize) + 'px "Georgia"'
ctx.fillText(key, x + fontSize, y + fontSize)
})
}