Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate SVG using dimple in Node.js #276

Open
KalaiselvanMahendran opened this issue Jun 23, 2017 · 0 comments
Open

How to generate SVG using dimple in Node.js #276

KalaiselvanMahendran opened this issue Jun 23, 2017 · 0 comments

Comments

@KalaiselvanMahendran
Copy link

Here my question is very simple,

I need to generate SVG using dimple in Node.js.

And i installed this node module npm install dimple-js but there is no proper documentation for this ?

i have tried this below code:

var jsdom = require("node-jsdom");
globals = {};
global.window = jsdom.jsdom().parentWindow;
global.document = jsdom.jsdom('<!doctype html></html>');

var d3 = require('dimple-js/lib/d3.v3.4.8.js');
var dimple = require('dimple-js/dist/dimple.v2.1.6.js');

module.exports = function(router){

    router.get('/', function(req, res){
        var svg = dimple.newSvg('body', 800, 600);
        var data = [
          { "Word":"Hello", "Awesomeness":2000 },
          { "Word":"World", "Awesomeness":3000 }
        ];
        var myChart = new dimple.chart(svg, data);
        myChart.addCategoryAxis("x", "Word");
        myChart.addMeasureAxis("y", "Awesomeness");
        myChart.addSeries(null, dimple.plot.bar);
        myChart.draw();
        res.json({success: true, svg: svg});
    });
}

but am getting below error

untitled

So is that possible to generate SVG using dimple in server side ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant