react-highcharts icon indicating copy to clipboard operation
react-highcharts copied to clipboard

ReactDOMServer.renderToStaticMarkup() compatibility?

Open viniciusbo opened this issue 9 years ago • 3 comments

Are there any plans to support ReactDOMServer.renderToStaticMarkup()? I mean, is it even possible with current Highcharts codebase? If positive, I'd be happy to dig it deeper for a solution.

const React = require('react');
const ReactDOMServer = require('react-dom/server');
const ReactHighCharts = require('react-highcharts');

const markup = ReactDOMServer.renderToStaticMarkup(React.createElement(ReactHighCharts, { config: {"credits":false,"chart":{"type":"column","height":300} } }));
console.log(markup);

Output:

<div></div>

viniciusbo avatar Dec 14 '16 18:12 viniciusbo

That's kind of related to #224.

I couldn't find a good solution for this, maybe it would be possible to make it work with JSDom? Last time I checked JSDom didn't work well with svg, but this might have been fixed since then.

I'm happy to hear your inputs/potential solutions on that.

kirjs avatar Mar 18 '17 16:03 kirjs

It seems Highcharts is strongly coupled to DOM itself. Unless we can inject JSDOM (or Cheerio) to Highcharts I don't think it would be possible to use JSDOM with current Highcharts codebase in order to render it server-side (or to make a better DOM diff as #224).

viniciusbo avatar Jun 30 '17 19:06 viniciusbo

Closing and there has been no activity in this issue for a while. if this is still relevant, please feel free to reopen

kirjs avatar Oct 13 '19 19:10 kirjs