Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to setup export server in node application with npm package highcharts-export-server v3.0.3 and above #494

Open
satyam20satyam opened this issue Mar 19, 2024 · 1 comment

Comments

@satyam20satyam
Copy link

We are using npm package highcharts-export-server in our express based server.
Axis label is not getting translated as per selected lang, this is same as #434 which is fixed and released in 3.0.3 version but while we are using version 3.0.3 or above, we are getting error while starting the server. We drilled more into the code and found it is happening because coreScript is undefined.
TypeError: Cannot read properties of undefined (reading 'map').

After that server got started with this above error and we tried to export the chart and got another error

Tue Mar 19 2024 23:06:31 GMT+0530 [verbose] - [chart] Starting exporting process.
Tue Mar 19 2024 23:06:31 GMT+0530 [verbose] - [chart] Attempting to export from a raw input.
TypeError: Cannot read properties of undefined (reading 'allowCodeExecution')

This is the request body we are passing and below are the configurations.

NODE_TLS_REJECT_UNAUTHORIZED=0
ACCEPT_HIGHCHARTS_LICENSE=1
HIGHCHARTS_ALLOW_CODE_EXECUTION=1
HIGHCHARTS_ALLOW_FILE_RESOURCES=1
HIGHCHARTS_LOG_LEVEL=2
await exporter.initPool({
    maxWorkers: 5,
    initialWorkers: 5,
    workLimit: 50,
    customCode: { allowCodeExecution: true, allowFileResources: true },
  });

The same configuration is working fine in npm highcharts-export-server v3.0.1 with translation issue.

Can someone please help me here to unblock me.

@sn2247
Copy link

sn2247 commented Mar 20, 2024

This is the request body.

{
  "options": {
  "lang": {
    "thousandsSep": ",",
    "month": [
      " 1 月",
      " 2 月",
      " 3 月",
      " 4 月",
      " 5 月",
      " 6 月",
      " 7 月",
      " 8 月",
      " 9 月",
      " 10 月",
      " 11 月",
      " 12 月"
    ],
    "shortMonths": [
      " 1 月",
      " 2 月",
      " 3 月",
      " 4 月",
      " 5 月",
      " 6 月",
      " 7 月",
      " 8 月",
      " 9 月",
      " 10 月",
      " 11 月",
      " 12 月"
    ],
    "weekdays": [
      "星期日",
      " 星期一",
      " 星期二",
      " 星期三",
      " 星期四",
      " 星期五",
      " 星期六"
    ],
    "shortWeekdays": [
      "周日",
      " 周一",
      " 周二",
      " 周三",
      " 周四",
      " 周五",
      " 周六"
    ],
    "decimalPoint": "."
  },
  "chart": {
    "type": "area"
  },
  "title": {
    "text": "设备总体趋势",
    "useHTML": true,
    "align": "center",
    "style": {
      "color": "#333333",
      "fontSize": "16px",
      "fontFamily": "Roboto",
      "fontWeight": "bold",
      "textTransform": "CAPITALIZE"
    }
  },
  "yAxis": {
    "lineWidth": 0,
    "allowDecimals": false,
    "title": {
      "enabled": false
    },
    "opposite": true,
    "labels": {
      "format": "{value}"
    }
  },
  "xAxis": {
    "type": "datetime",
    "tickPixelInterval": 1,
    "dateTimeLabelFormats": {
      "hour": "%I <br> %p",
      "day": "%e <br> %b",
      "month": "%b <br> %Y"
    },
    "lineWidth": 1,
    "lineColor": "#C0C0C0",
    "tickLength": 1,
    "tickWidth": 1
  },
  "legend": {
    "align": "center",
    "verticalAlign": "bottom",
    "layout": "horizontal",
    "symbolWidth": 4,
    "itemDistance": 30,
    "symbolPadding": 10,
    "symbolRadius": 0,
    "itemStyle": {
      "color": "#000000",
      "fontWeight": "normal",
      "fontFamily": "Roboto"
    }
  },
  "plotOptions": {
    "area": {
      "stacking": "normal",
      "lineColor": "#666666",
      "lineWidth": 1,
      "borderRadius": 0,
      "marker": {
        "lineWidth": 1,
        "lineColor": "#666666"
      },
      "events": {}
    }
  },
  "series": [
    {
      "name": "入站到客户",
      "data": [
        [
          1677628800000,
          16
        ],
        [
          1680307200000,
          0
        ],
        [
          1682899200000,
          47
        ]
      ],
      "color": "#E66268",
      "marker": {
        "symbol": "square",
        "radius": 4
      }
    },
    {
      "name": "操作中",
      "data": [
        [
          1677628800000,
          16
        ],
        [
          1680307200000,
          10
        ],
        [
          1682899200000,
          0
        ]
      ],
      "color": "#005A82",
      "marker": {
        "symbol": "square",
        "radius": 4
      }
    },
    {
      "name": "维修中",
      "data": [
        [
          1677628800000,
          96
        ],
        [
          1680307200000,
          110
        ],
        [
          1682899200000,
          47
        ],
        [
          1685577600000,
          76
        ],
        [
          1688169600000,
          93
        ],
        [
          1690848000000,
          103
        ],
        [
          1693526400000,
          151
        ],
        [
          1696118400000,
          70
        ],
        [
          1698796800000,
          91
        ],
        [
          1701388800000,
          122
        ],
        [
          1704067200000,
          75
        ],
        [
          1706745600000,
          97
        ]
      ],
      "color": "#333333",
      "marker": {
        "symbol": "square",
        "radius": 4
      }
    }
  ],
  "tooltip": {
    "shared": true,
    "dateTimeLabelFormats": {
      "hour": "%I %p",
      "day": "%b %e, %Y ",
      "month": "%b %Y"
    },
    "useHTML": true,
    "borderWidth": 1,
    "borderColor": "#007CB0",
    "style": {
      "padding": 5
    }
  }
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants