How to use d3-node - 2 common examples

To help you get started, we’ve selected a few d3-node 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 d3-node / d3node-linechart / examples / index.js View on Github external
const fs = require('fs');
const output = require('d3node-output');
const d3 = require('d3-node')().d3;
const d3nLine = require('../');

const parseTime = d3.timeParse('%d-%b-%y');
const tsvString = fs.readFileSync('data/data.tsv').toString();
const data = d3.tsvParse(tsvString, d => {
  return {
    key: parseTime(d.date),
    value: +d.close
  };
});

// create output files
output('./examples/output', d3nLine({ data: data }), { width: 960, height: 550 });
github bonndan / dld4e-headless / src / dld4e / dld4e-icons.js View on Github external
var paths = xml.getElementsByTagName("path")
      for (i = 0; i < paths.length; i++) {
        if ((d.value.preserveWhite) && (paths[i].getAttribute("fill") == '#fff')) {
          //paths[i].setAttribute("fill", d.value.replaceWhite)
        } else if ((d.value.iconFill) && (paths[i].getAttribute("fill") != 'none')) {
          paths[i].setAttribute("fill", d.value.iconFill)
        }
        if ((d.value.iconStroke) && (paths[i].getAttribute("stroke") != 'none')) {
          paths[i].setAttribute("stroke", d.value.iconStroke)
        }
        if ((d.value.iconStrokeWidth) && (paths[i].getAttribute("stroke-width"))) {
          paths[i].setAttribute("stroke-width", d.value.iconStrokeWidth)
        }
      }

      const frag = new jsdom9.jsdom(xml.documentElement.outerHTML) // fix for imported is not a NodeImpl
      const newSvg = frag.getElementsByTagName("svg")[0]
      cell.insertBefore(newSvg, cellText)
    }

d3-node

Server-side D3 with ease

MIT
Latest version published 2 years ago

Package Health Score

47 / 100
Full package analysis