How to use the highcharts-export-server.initPool function in highcharts-export-server

To help you get started, we’ve selected a few highcharts-export-server examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Bastian / bStats / util / chartRenderer.js View on Github external
const dataManager = require('./dataManager');
const exporter = require('highcharts-export-server');
const uuidv4 = require('uuid/v4');
const path = require('path');
const fs = require('fs');

exporter.initPool();

function renderPluginImage(pluginId, options, callback) {
    // TODO use waterfall
    dataManager.getChartByPluginIdAndChartId(pluginId, 'players', ['type', 'title', 'data'], function (err, players) {
        if (err) {
            console.log(err)
            return callback(err);
        }
        dataManager.getChartByPluginIdAndChartId(pluginId, 'servers', ['type', 'title', 'data'], function (err, servers) {
            if (err) {
                console.log(err)
                return callback(err);
            }
            if (players === null || servers === null) {
                return callback(null, {error: 'Unknown plugin or plugin without servers/players charts'});
            }
github whatl3y / restcharts / src / routes / 0.._chart_[colon]type..all.js View on Github external
import fs from 'fs'
import exporter from 'highcharts-export-server'
import ChartHelpers, { jsonParseFallback } from '../libs/ChartHelpers'

//Set up a pool of PhantomJS workers
exporter.initPool()

export default function Chart(req, res) {
  return new Promise((resolve, reject) => {
    try {
      const routeParams = req.params
      const body        = req.query || req.body || {}
      const chartType   = routeParams.type || body.type
      const rawConfig   = jsonParseFallback(body.raw || {}, {})
      const chartData   = (body.data || '').split(',')

      delete(body.data)

      if (chartData.length <= 1 && !rawConfig.series)
        return res.status(400).json({ status: 400, error: `Please pass valid data. If you passed a 'raw' param with data populated in the 'series' key, there is likely something wrong with the JSON config you passed.` })

      const finalConfig = ChartHelpers.getConfig(chartData, Object.assign(body, { type: chartType }), rawConfig)
github whatl3y / restcharts / src / routes / 0.._chart_[colon]type..get.js View on Github external
import fs from 'fs'
import exporter from 'highcharts-export-server'
import ChartConfig from '../libs/ChartConfig'

//Set up a pool of PhantomJS workers
exporter.initPool()

export default async function Chart(req, res) {
  try {
    const routeParams = req.params
    const type        = routeParams.type

    const body        = req.query || {}
    const chartData   = (body.data || '').split(',')
    const chartColor  = (body.hexcolor) ? `#${body.hexcolor}` : null
    const height      = (body.height) ? parseInt(body.height) : null
    const width       = (body.width) ? parseInt(body.width) : null
    const fillOpacity = (body.opacity) ? parseFloat(body.opacity) : null

    if (chartData.length <= 1)
      return res.status(400).json({ error: 'Please pass valid data.' })
github LeaPhant / flowabot / osu.js View on Github external
const ur_calc = require('./renderer/ur.js');
const frame = require('./renderer/render_frame.js');
const helper = require('./helper.js');

const highcharts = require('highcharts-export-server');
const {execFileSync} = require('child_process');
const Jimp = require('jimp');

const MINUTE = 60 * 1000;
const STRAIN_STEP = 400.0;
const DECAY_BASE = [ 0.3, 0.15 ];
const STAR_SCALING_FACTOR = 0.0675;
const EXTREME_SCALING_FACTOR = 0.5;
const DECAY_WEIGHT = 0.9;

highcharts.initPool();

const config = require('./config.json');

let tracked_users = {};

if(helper.getItem('tracked_users')){
	tracked_users = JSON.parse(helper.getItem('tracked_users'));
}else{
	helper.setItem('tracked_users', JSON.stringify(tracked_users));
}

let top_plays = {};

if(helper.getItem('top_plays')){
	top_plays = JSON.parse(helper.getItem('top_plays'));
}else{

highcharts-export-server

Convert Highcharts.JS charts to static image files.

MIT
Latest version published 3 months ago

Package Health Score

78 / 100
Full package analysis

Popular highcharts-export-server functions

Similar packages