From a051ed2d6a63df0960aae87256a5fc31dec2d023 Mon Sep 17 00:00:00 2001 From: cvasseng Date: Thu, 18 Oct 2018 10:36:33 +0200 Subject: [PATCH] Added support for Gantt --- CHANGELOG.md | 9 +++++++++ README.md | 5 +++++ build.js | 35 +++++++++++++++++++++++++++++++---- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff58f05c..325b67c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 2.0.16 + + * Added support for bullet charts + * Added support for Gantt charts + * Added configuration option for chart generation timeout (`--timeoutThreshold`) + * Gracefull failing of 404 map collections now working properly + * Updated express version + * Updated docs + # 2.0.15 * Added `queueSize` option to `initPool` to set the request overfow queue size diff --git a/README.md b/README.md index 18902532..b92dfef1 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,11 @@ depending on your setup, it may be possible to set the env variable in your `pac } ``` +#### Including Maps and/or Gantt support in automated deployments + +Use the environment variables `HIGHCHARTS_USE_MAPS` and `HIGHCHARTS_USE_GANTT` +to enable support of either. + ## Note about process.exit listeners The export server attaches event listeners to process.exit. This is to diff --git a/build.js b/build.js index fc694031..37868b7a 100644 --- a/build.js +++ b/build.js @@ -85,7 +85,11 @@ const cdnLegacy = [ ]; const cdnMaps = [ - "maps/{{version}}/modules/map.js" + 'maps/{{version}}/modules/map.js' +]; + +const cdnGantt = [ + '{{version}}/modules/gantt.js' ]; const cdnMoment = [ @@ -129,6 +133,12 @@ let schema = { required: true, conform: boolConform }, + gantt: { + description: 'Include Gantt? (requires Gantt license, and >V6.2)', + default: 'no', + required: true, + conform: boolConform + }, styledMode: { description: 'Enable styled mode? (requires Highcharts/Highstock 5+ license)', default: 'no', @@ -273,11 +283,13 @@ function endMsg() { console.log('For documentation, see https://github.com/highcharts/node-export-server'); } -function embedAll(version, includeStyled, includeMaps, includeMoment, optionals) { +function embedAll(version, includeStyled, includeMaps, includeMoment, includeGantt, optionals) { var standard = cdnScriptsStandard.concat(cdnScriptsCommon).concat(cdnAdditional), styled = cdnScriptsStyled.concat(cdnScriptsCommon).concat(cdnAdditional) ; + optionals = optionals || {}; + if (includeMaps) { console.log('Including maps support'.green); standard = standard.concat(cdnMaps).concat(cdnMapCollection); @@ -285,7 +297,20 @@ function embedAll(version, includeStyled, includeMaps, includeMoment, optionals) // Map collections are user supplied, so we need to allow them to 404 cdnMapCollection.forEach((url) => { - cdnScriptsOptional[url] = 1; + optionals[url] = 1; + }); + } + + if (includeGantt) { + console.log('Including Gantt support'.green); + + standard = standard.concat(cdnGantt); + styled = styled.concat(cdnGantt); + + // Gantt was introduced in 6.2. To avoid 404 errors if fetching an + // older version by accident, let the fetch fail gracefully + cdnGantt.forEach((url) => { + optionals[url] = 1 }); } @@ -355,6 +380,7 @@ function startPrompt() { affirmative(result.styledMode), affirmative(result.maps), affirmative(result.moment), + affirmative(result.gantt), getOptionals(result) ); } else { @@ -372,7 +398,8 @@ if (process.env.ACCEPT_HIGHCHARTS_LICENSE) { useIfDefined(process.env.HIGHCHARTS_VERSION, 'latest'), useIfDefined(process.env.HIGHCHARTS_USE_STYLED, true), useIfDefined(process.env.HIGHCHARTS_USE_MAPS, true), - useIfDefined(process.env.HIGHCHARTS_MOMENT, false) + useIfDefined(process.env.HIGHCHARTS_MOMENT, false), + useIfDefined(process.env.HIGHCHARTS_USE_GANTT, true) ); } else { console.log(fs.readFileSync(__dirname + '/msg/licenseagree.msg').toString().bold);