Comments (3)
You should be able to use the (undocumented) themeOptions
property to separate theme settings from chart options:
var exportSettings = {
options: {..chart options...},
themeOptions: {...theme options..}
};
exporter.export(exportSettings, function (err, res) {...}
So you could load your chart options into options
, your theme into themeOption
, and then set type
to e.g. png
or svg
. If you need it in two formats per. export (or with two different themes), the best way is probably to mutate the exportSettings
and do multiple calls to export(..)
.
from node-export-server.
Thanks for your response!
I tried using themeOptions
but now I'm seeing errors:
Wed Feb 15 2017 09:29:27 GMT-0800 (PST) [error] phantom worker 7 unexpected data - SyntaxError: Expected token ']'
undefined:1 in appendChild
:15
:16
{"filename":"chart.svg"}
The chart.svg
is output but without any themeOptions
applied.
I was worried this could be caused by some unrelated mistake in my code, so I stripped everything down to the barest essentials, but the issue still remains. Here's my complete simplified JS file:
const exporter = require('highcharts-export-server');
const options ={
"chart": {
"type": "pie"
},
"title": {
"text": "Example Title"
},
"subtitle": {
"text": "Example Subtitle"
},
"series": [{
"showInLegend": true,
"dataLabels": {
"enabled": true,
"format": "{y}"
},
"data": [
{
"y": 529,
"name": "Data Sample 1"
},
{
"y": 81,
"name": "Data Sample 2"
}
]
}]
};
const themeOptions = {
"lang": {
"thousandsSep": ","
},
"chart": {
"style": {
"fontFamily": "\"proxima-nova\", sans-serif"
}
},
"colors": [
"#008fc4",
"#46a088",
"#e21836",
"#f5d664",
"#ff6b35",
"#5b507a"
],
"title": {
"style": {
"color": "#353536",
"fontFamily": "\"proxima-nova-soft\", sans-serif",
"fontWeight": "600"
}
},
"subtitle": {
"style": {
"color": "#747476",
"fontWeight": "600"
}
},
"legend": {
"itemStyle": {
"fontWeight": "400",
"color": "#353536"
}
}
};
const settings = {
options: options,
themeOptions: themeOptions,
type: 'svg',
outfile: 'chart.svg'
};
exporter.initPool();
exporter.export(settings, (err, res) => {
exporter.killPool();
process.exit(1);
});
from node-export-server.
Sorry for the delay!
bbbbfa1 adds a fix for this, I'll push it to NPM once I've taken care of a couple more issues.
Please feel free to reopen if you still experience issues with this.
from node-export-server.
Related Issues (20)
- The Google fonts are not installed on the production server HOT 1
- The width and height are only taken from sourceHeight HOT 1
- column chart export https://export.highcharts.com/ 500 error HOT 1
- Cannot add series-on-point module to the export server HOT 3
- Highcharts.AST.allowedAttributes HOT 9
- Preview and download are not generating in windows HOT 2
- Different export results on the first and the second requests HOT 1
- Previous version output result error HOT 6
- v3: compiled CLI via pkg not working HOT 6
- Image with URL included in the exported chart only sporadically HOT 1
- Chart being not rendering correctly in case of file format: image/svg+xml HOT 3
- Chart options object is not available in the customCode context in current node-export-server (master) HOT 5
- Please add tags to repo which correspond to the current version HOT 2
- v4: dist folder missing HOT 4
- Startup error: no such file or directory, open '/usr/lib/node_modules/highcharts-export-server//msg/startup.msg HOT 2
- v4 'cachePath' with absolute path HOT 4
- v4: outdated example for Node.js module usage HOT 1
- v4: getting error HOT 6
- v4: make userDataDir configurable HOT 2
- Export server run issue for multiple request HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-export-server.