Generate SVG images with node

Source: Internet
Author: User

Recently, there is a need for background tuning statistics, the direct generation of pictures to spit to the front, originally thought relatively simple, the results in the middle or encountered a lot of problems:

Environment:

Windows:python 2.6+,visual Stdio Express Development Kit

Linux:gcc,python 2.6+

Node version: v0.10.35

Node component: [email protected] [email protected] [email protected]

Originally want to upgrade node to the latest version, in the installation of Jsdom error, can only be returned

[Email protected] Support node, higher version only supports IOJS

[Email protected] Install error on red Hat 4.4.7, [email protected] successfully installed

Request data:

Send HttpPost Request interface data:

The Content-length parameter in the header of the configuration request is equal to the length of the post data, which was not noticed causing the request to time out

Note that the accept-encoding parameter in the header is configured with gzip, and if Gzip is configured, it needs to be unpacked with zlib

Highchart Generating SVG:

The biggest problem is that the browser can generate SVG, after moving to node can not be generated, after Google, the parameters are constantly excluded, found in the Highchart configuration must add the following:

Chart: {
margin: [50, 30, 70, 50],//No, this doesn't show.
width:1000,
forexport:true//not add this will be an error
}

Hightchart version uses v2.3.3, background svg if there is a callout on the graph, it will be displayed abnormally, and the latest version will be improved. In this project, when using rsvg conversion png, the line width anomaly, suspect that the rsvg version is too low, in this requirement must use rsvg conversion, so you can only discard the latest version of the Highchart

Hightchart datetime type data, need to add 8 hours, to ensure that the display is normal, you need to adjust the YAxis x, y values, otherwise the y-coordinate display exception.

Summary:The module is open source in node, but the version compatibility of different modules is more troublesome. The complex presentation of the backend node's analog browser may have a variety of problems, the most troublesome is not debugging, difficult to find the reason.

For this project, consider using PHANTOMJS to solve

Generate SVG images with node

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.