export - line shown in bold when exporting Highcharts with Phantomjs -
i want export line chart server using highcharts , phantomjs, image exported line shown in bold:
here source code used generate chart:
var system = require('system'); var page = require('webpage').create(); var fs = require('fs'); page.injectjs("/var/www/test/public/jquery.js") || (console.log("unable load jquery") && phantom.exit()); page.injectjs("/var/www/test/public/js/highcharts.js") || (console.log("unable load highcharts") && phantom.exit()); page.injectjs("/var/www/test/public/js/exporting.js") || (console.log("unable load exporting") && phantom.exit()); page.onconsolemessage = function(msg) { console.log(msg); } var width = 550, height = 400; if(system.args.length == 4) { width = parseint(system.args[2], 10); height = parseint(system.args[3], 10); } console.log("load result file"); var result = [['nintendo', 54030288], ['electronic arts', 31367739], ['activision', 30230170], ['ubisoft', 25318980], ['microsoft', 24372261], ['sony computer entertainment', 138059037], ['bethesda softworks', 10813372], ['take-two interactive', 10012212], ['others', 33910911] ]; var evalarg = { width: width, height: height }; var svg = page.evaluate(function(opt){ $('body').append('<div id="container"></div>'); var chart = new highcharts.chart({ chart: { renderto: 'container', animation: false }, title: { text: 'population ages 65 , on (% of total)', }, credits: { position: { align: 'left', x: 20 }, text: 'data world bank' }, xaxis: { categories: [ '1980', '1981', '1982', '1983', '1984', '1985', '1986', '1987', '1988', '1989', '1990', '1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010' ], labels: { step: 5 } }, yaxis: { title: { text: 'percentage %', } }, tooltip:{ enabled: false }, series: [{ name: 'algeria - 65 , over', data: [ 9, 9, 9, 10, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 14, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 23 ], enablemousetraking: false }] }); console.log('exported svg'); return chart.getsvg(); }, evalarg); fs.isfile("/var/www/test/autoscripts/sanbi/images/hoc.svg") && fs.remove("/var/www/test/autoscripts/sanbi/images/hoc.svg"); console.log('saved svg file'); fs.write("/var/www/test/autoscripts/sanbi/images/hoc.svg", svg); phantom.exit();
to get run command:
phantomjs test.js
please idea avoid behaviour? thanks
please ensure if have newest highcharts-convert.js, because have tested on own phantomjs , works well.
Comments
Post a Comment