canvas_exporting 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/canvas_exporting/exporter.rb +1 -1
- data/lib/canvas_exporting/version.rb +1 -1
- data/phantomjs/canvas-convert.js +8 -16
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79b33d4267f595dd29c93e9dc297d1a824bbaf81
|
4
|
+
data.tar.gz: 2f7412402f798bac834e00c4f1319917c5cc9c0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed87a6458cef3875b96a6992615b090802a38902a821960b8bacb4196c5462a56e9c00dc696677b875cc2462552bdd101414cca057289751abdfa08025dee55e
|
7
|
+
data.tar.gz: 6599b85233978a33b6fb9ef7415cdff8fca5e1cde67b2eb0fa55ff344ed1da4dcbf31d67181ce4cd9275cd4788699fe16ba0f2172b6cedc5b493788f806b9fcd
|
@@ -30,7 +30,7 @@ module CanvasExporting
|
|
30
30
|
@output_file = output_path + filename
|
31
31
|
|
32
32
|
scale = params[:scale] || 2
|
33
|
-
width = params[:width]
|
33
|
+
width = params[:width] || 400
|
34
34
|
constr = params[:constr] || 'Chart'
|
35
35
|
|
36
36
|
convert_args = convert_args({infile: @infile_tmp_file.path,
|
data/phantomjs/canvas-convert.js
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
exitCallback(result);
|
122
122
|
};
|
123
123
|
|
124
|
-
loadChart = function( string_in, outputType ) {
|
124
|
+
loadChart = function( string_in, outputType, width ) {
|
125
125
|
|
126
126
|
try {
|
127
127
|
|
@@ -133,24 +133,20 @@
|
|
133
133
|
|
134
134
|
container = $('<div>').appendTo(document.body);
|
135
135
|
container.attr('id', 'chartContainer' );
|
136
|
-
|
137
|
-
|
138
|
-
|
136
|
+
|
137
|
+
var sizing = 'width: ' + width + 'px;';
|
138
|
+
$("#chartContainer").attr('style', sizing)
|
139
|
+
|
139
140
|
var json_in = JSON.parse(string_in);
|
140
|
-
//json_in = JSON.parse(json_in);
|
141
141
|
json_in["animationEnabled"] = false;
|
142
142
|
|
143
|
-
//console.log ("just before canvas rendering");
|
144
|
-
|
145
143
|
var chartTest = new CanvasJS.Chart("chartContainer", json_in );
|
146
|
-
console.log ("complete the object create");
|
147
144
|
|
148
145
|
var rs = chartTest.render();
|
149
|
-
console.log ("completed the rendering");
|
150
146
|
|
151
147
|
var htmlout = $('.canvasjs-chart-canvas')[0];
|
152
|
-
|
153
|
-
var imageData = htmlout.toDataURL('image/'+outputType, 0.92 );
|
148
|
+
var imageData = htmlout.toDataURL(outputType, 0.92 );
|
149
|
+
//var imageData = htmlout.toDataURL('image/'+outputType, 0.92 );
|
154
150
|
} catch (e) {
|
155
151
|
console.log('ERROR: Cannot create CanvasJS object.');
|
156
152
|
console.log('Error message: ' + e.number + " - " + e.message)
|
@@ -199,7 +195,7 @@
|
|
199
195
|
}
|
200
196
|
}
|
201
197
|
|
202
|
-
var rs = page.evaluate(loadChart, input, outType );
|
198
|
+
var rs = page.evaluate(loadChart, input, outType, width );
|
203
199
|
|
204
200
|
try {
|
205
201
|
var result = rs["html"].split(",")
|
@@ -258,9 +254,6 @@
|
|
258
254
|
|
259
255
|
args = mapCLArguments();
|
260
256
|
|
261
|
-
//console.log("made it past the args mapper")
|
262
|
-
//console.log("arguments: " + JSON.stringify(args));
|
263
|
-
// set tmpDir, for output temporary files.
|
264
257
|
if (args.tmpdir === undefined) {
|
265
258
|
config.tmpDir = fs.workingDirectory + '/tmp';
|
266
259
|
} else {
|
@@ -281,7 +274,6 @@
|
|
281
274
|
startServer(args.host, args.port);
|
282
275
|
} else {
|
283
276
|
// presume commandline usage
|
284
|
-
//console.log("calling the renderer");
|
285
277
|
render(args, function (msg) {
|
286
278
|
console.log(msg);
|
287
279
|
phantom.exit();
|