-
-
Save TorsteinHonsi/e8a1e6971608523eb8dd to your computer and use it in GitHub Desktop.
// This gist is deprecated, doesn't work with newer versions of JSDom. | |
// Instead, use https://www.npmjs.com/package/highcharts-jsdom |
@TorsteinHonsi can you please license this explicitly (eg MIT)
@TorsteinHonsi this also doesn't work anymore.
See my changes: https://gist.github.com/graingert/10ab7c6b6f9af4c87a3482dcdacc8bed
Does not seem to work with highcharts 5.0, thus usenpm install [email protected]
.
@silvangithub I added the following line in order to add highcharts-more:
var Highcharts_data = require('highcharts/modules/data')(Highcharts);
It has been working very well for ages but now it seams HIghcharts 5 has broken it; did someone find a solution?
it seams "ownerSVGElement" is missing
for me adding the ownerSVGElement property made the trick for highcharts 5.0.0:
unction findAncestor(el, nodeName) {
while ((el = el.parentElement) && el.nodeName !== nodeName);
return el;
}
document.createElementNS = function (ns, tagName) {
...
Object.defineProperty(elem, 'ownerSVGElement', {
get() { return findAncestor(elem, 'SVG'); },
enumerable: true,
configurable: true
});
...
Is it also applicable for stock chart?? I am trying to create stock chart using jsdom but not able to get clear image.
Hi, I have now deprecated this gist (didn't work with latest jsdom) and created an npm package instead. See https://www.npmjs.com/package/highcharts-jsdom.
I was able to create a stock chart using the following config:
hc({
infile: 'examples/column.json',
outfile: 'chart.svg',
// Constructor, defaults to 'chart'
constr: 'stockChart',
// Module files etc
extensions: [
'modules/stock'
]
}).then((result) => {
console.log(result);
});
Splendid, unfortunately it does create errors with "treemaps".
The only thing I changed from your code above is this part: