How to use the dygraphs.getContextPixelRatio function in dygraphs

To help you get started, we’ve selected a few dygraphs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github numenta / numenta-apps / unicorn / js / browser / lib / Dygraphs / AnomalyBarChartPlugin.js View on Github external
_setElementRect(canvas, context, rect) {
    let canvasScale = Dygraph.getContextPixelRatio(context);

    canvas.style.top = `${rect.y}px`;
    canvas.style.left = `${rect.x}px`;
    canvas.width = rect.w * canvasScale;
    canvas.height = rect.h * canvasScale;
    canvas.style.width = `${rect.w}px`;
    canvas.style.height = `${rect.h}px`;

    if (canvasScale !== 1) {
      context.scale(canvasScale, canvasScale);
    }
  }
github numenta / numenta-apps / unicorn / app / browser / lib / Dygraphs / RangeSelectorBarChartPlugin.js View on Github external
_setElementRect(canvas, context, rect) {
    let canvasScale = Dygraph.getContextPixelRatio(context);

    canvas.style.top = `${rect.y}px`;
    canvas.style.left = `${rect.x}px`;
    canvas.width = rect.w * canvasScale;
    canvas.height = rect.h * canvasScale;
    canvas.style.width = `${rect.w}px`;
    canvas.style.height = `${rect.h}px`;

    if (canvasScale !== 1) {
      context.scale(canvasScale, canvasScale);
    }
  }