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

svg tag enclosed in div tag #22

Open
hellznrg opened this issue Jun 29, 2018 · 1 comment
Open

svg tag enclosed in div tag #22

hellznrg opened this issue Jun 29, 2018 · 1 comment

Comments

@hellznrg
Copy link

When I generate a chart, it returns a DIV enclosing a SVG. How can I get node-chartist to give me just the SVG?

@Kshitij978
Copy link

Follow the changes mentioned below.

Capture

const generate = R.curryN(3, co.wrap(function * (type, options, data) {
    const environment = yield chartist.initialize();
    const window = environment.window;
    const Chartist = environment.Chartist;
    // process options
    options = is.function(options) ? options(Chartist) : options;
    if (is.not.json(options)) throw new TypeError('options must be an object or a function that returns an object.');
    options = Ru.defaults({ legend: true }, options);
    // create chart
    const chart = yield generateChart(Chartist, window, type, options, data);
    const legend = options.legend ? generateLegend(data) : '';
-   return `<div class="ct-chart">${chart}${legend}</div>`;
+   return `${chart}${legend}`;
}));

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

2 participants