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

Integrating with Node js Application on windows #11

Open
vibhuti12 opened this issue Aug 19, 2018 · 10 comments
Open

Integrating with Node js Application on windows #11

vibhuti12 opened this issue Aug 19, 2018 · 10 comments
Assignees

Comments

@vibhuti12
Copy link

I have installed rsvg and imagemgick but still when I run the application it says
Warning! Please install imagemagick utility. (https://www.imagemagick.org/script/binary-releases.php)
Warning! Please install rsvglib utility. (https://github.com/AnyChart/AnyChart-NodeJS)
Error: Stream yields empty buffer

Is there anything else that needs to be done ?

@Shestac92 Shestac92 self-assigned this Aug 20, 2018
@Shestac92
Copy link

@vibhuti12
The quick guide doesn't provide the full information about the installation process on Windows. I will prepare a detailed guide for you soon.

@Shestac92
Copy link

@vibhuti12
Here is a installation guide for required libraries:

  1. Go to imagemagick

  2. In section "Windows Binary Release" choose a suitable version of ImageMagick

  3. Install it

  4. Go to GTK+ bundle

  5. Download the bundle (if the zip is unavailable, please, tell us and we will share it with you)

  6. To use it, create some empty folder like "c:\gtk", Using either
    Windows Explorer's built-in zip file management, or the command-line
    unzip.exe, available for instance at
    ftp://tug.ctan.org/tex-archive/tools/zip/info-zip/WIN32/unz552xN.exe
    unzip this bundle. Avoid Winzip! It is known to behave oddly.

(But you presumably already did extract the files, as you are reading
this file.)

Then add the bin folder to your PATH. Make sure you have no other
versions of GTK+ in PATH. Run:
pkg-config --cflags gtk+-3.0
and verify that it prints out something reasonable. Prepare Pango :
pango-querymodules > c:\gtk\etc\pango\pango.modules
Prepare GDK-Pixbuf :
gdk-pixbuf-query-loaders > c:\gtk\lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
Prepare GTK+-IMModules :
gtk-query-immodules-3.0 > c:\gtk\lib\gtk-3.0\3.0.0\immodules.cache
Run:
gtk3-demo
and verify that it works.

  1. Go to RSVG lib
  2. Download the rsvg-convert.exe
  3. Add path to the exe file in Environment Variables, for example 'C:\export\rsvg-convert'
  4. After that you can try to launch generationg charts

I hope this will help you!

@vibhuti12
Copy link
Author

vibhuti12 commented Aug 24, 2018

Did you try running this on windows ? I just want to be sure it works on
windows because the official documentation for rsvg lib says it is not
downloadable for windows. They only accept pull request.

Also, the example provided on the github repository of any charts, did you
try running it on windows ?

@vibhuti12
Copy link
Author

The GTK+ bundle link is not available.

@Shestac92
Copy link

@vibhuti12
Yes, it works on Windows. Probably you will need additional fonts. But this depends on existing fonts in your system.
You can download GTK bundle from our CDN.

@vibhuti12
Copy link
Author

@Shestac92 I have completed the steps till gtk3-demo and that seems to be working fine. But the error for rsvglib still persists. I have added path to the rsvglib.exe in the Path as well. I am assuming we need to do something to add it to node modules. Did you do something to add it to npm ?

Error:
Warning! Please install rsvglib utility. (https://github.com/AnyChart/AnyChart-NodeJS)
Error: Stream yields empty buffer
at Socket. (C:\Users\vt062640\Desktop\POCGraph\node_modules\gm\lib\command.js:57:17)
at emitNone (events.js:111:20)
at Socket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

This is the error my program says when I'm running it.

@Shestac92
Copy link

@vibhuti12
It doesn't require any actions with NPM. If the PATH is ok, you should be able to run rsvg-convert in the terminal.
Just execute the following line in the promt command:
rsvg-convert
If it doesn't work, please, make sure that the PATH is ok.

@Jucesr
Copy link

Jucesr commented Sep 14, 2018

Hi @Shestac92.

When I run my app with the cmd everthing works well.

When windows runs my app from the task scheduler I got the error
Error: Stream yields empty buffer.

Any ideas why?

@Shestac92
Copy link

@Jucesr
Please, make sure that librsvg, imageMagick and GTK library are installed correctly and all paths are ok.
If everything is ok, please, share with us your JS exporting script. We will use it to reproduce the issue.

@Jucesr
Copy link

Jucesr commented Sep 14, 2018

@Shestac92
Everthing is installed correctly. I am able to run my app with node myapp.js.

When I create the windows task I got the error message. It is the same source code. I believe it has something with scheduler not being able to find the path to some library use by GM.

const fs = require('fs')
const path = require('path')

// Require JSDOM Class.
const JSDOM = require('jsdom').JSDOM
// Create instance of JSDOM.
const jsdom = new JSDOM('<body><div id="container"></div></body>', {runScripts: 'dangerously'})
// Get window
const window = jsdom.window

// require anychart and anychart export modules
const anychart = require('anychart')(window)
const anychartExport = require('anychart-nodejs')(anychart)

var chart = anychart.column();

chart.bounds(0, 0, 800, 600);
chart.title('Example')
chart.container('container');

let char_data_set = anychart.data.set([
    ["Red", 1],
    ["Blue", 2]
])

let chart_serie = char_data_set.mapAs({x: 0, value: 1})
chart.column(chart_serie)

chart.draw();

anychartExport.exportTo(chart, 'jpeg').then(function(image) {
    fs.writeFile(path.join(__dirname, 'example.jpeg'), image, function(fsWriteError) {
      if (fsWriteError) {
        console.log(fsWriteError);
      } else {
        console.log('Complete');
      }
    });
    
  }, function(generationError) {
    console.log(generationError);
  });

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

3 participants