node-chartist icon indicating copy to clipboard operation
node-chartist copied to clipboard

svg tag enclosed in div tag

Open hellznrg opened this issue 6 years ago • 1 comments

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

hellznrg avatar Jun 29 '18 05:06 hellznrg

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}`;
}));

Kshitij978 avatar Dec 17 '20 16:12 Kshitij978