canvasxpress-cli 62.2.0 → 62.4.5

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.
package/cmds/help.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const menus = {
2
-
2
+
3
3
  main: `
4
4
  canvasxpress [command] <options>
5
5
 
@@ -7,131 +7,189 @@ const menus = {
7
7
  svg ................ create a svg CanvasXpress file from inline parameters, file or url
8
8
  json ............... create a json CanvasXpress file from inline parameters, file or url
9
9
 
10
- canvas ............. run scripts files to test CanvasXpres [internal]
10
+ csv ................ create a CanvasXpress png file from a local csv file or url
11
+ reproduce .......... create CanvasXpress png files from a local file or url
12
+ canvas ............. run scripts files to test CanvasXpres
11
13
 
12
14
  test ............... test package. Creates images and json file in test directory
13
- version ............ show this package version
15
+ version ............ show this package version
14
16
  help ............... show this help. Add command to show correponding help
15
17
  `,
18
+
19
+ canvas: `
20
+ --input, -i ........ <required> path/to/js/file
21
+ --directory, -f .... [optional] directory of CanvasXpres version to check
22
+ --graph, -g ........ [optional] graph name
23
+ --number, -n ....... [optional] number for the graph
24
+ --timeout, -t ...... [optional] timeout in millisecods to close browser
25
+ {default} 500
26
+ --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
27
+
28
+ Examples:
16
29
 
17
- png: `
18
- --input, -i ........ [optional - required] file or url:
19
- /path/to/local/file.[json|png|csv|txt|html]
20
- http://page/with/file.[json|png|csv|txt|html]
21
- https://page/with/file.[json|png|csv|txt|html]
30
+ canvasxpress canvas -i canvas/scripts/compareImages.js
31
+
32
+ canvasxpress canvas -i canvas/scripts/compareImages.js -g violin -n 11
33
+ `,
34
+
35
+ csv: `
36
+ --input, -i ........ [optional - required] file or url with a csv file:
37
+ file:///path/to/local/file.csv
38
+ http://page/with/file.csv
39
+ https://page/with/file.csv
22
40
  --output, -o ....... [optional] directory path to save image
23
41
  {default} './'
24
42
  --width, -x ........ [optional] integer for image width
25
43
  {default} 800
26
44
  --height, -y ....... [optional] integer for image height
27
45
  {default} 800
28
- --target, -t ....... [optional] string id for CanvasXpress
29
46
  --data, -d ......... [optional - required] json string with the data for CanvasXpress
30
47
  --config, -c ....... [optional] json string with configuration for CanvasXpress
31
- --events, -e ....... [optional] json/javascript string with events for CanvasXpress
32
- --timeout, -q ...... [optional] timeout in millisecods to close browser
48
+ --timeout, -t ...... [optional] timeout in millisecods to close browser
33
49
  {default} 500
34
50
  --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
51
+
52
+ Examples:
35
53
 
54
+ canvasxpress csv -i ../src/ToothGrowth.csv -t 3000
55
+
56
+ canvasxpress csv -i https://raw.githubusercontent.com/neuhausi/Rdatasets/master/csv/datasets/ToothGrowth.csv -t 3000
57
+
58
+ canvasxpress csv -i file:///node/src/ToothGrownth.csv -c '{"graphType":"Boxplot","transposeData":true,"asVariableFactors":["dose"],"stringSampleFactors":["dose"],"groupingFactors":["dose"]}' -t 3000
59
+
60
+ canvasxpress csv -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}' -c '{"graphOrientation":"vertical","theme":"CanvasXpress","title":"Bar Graph Title"}' -t 3000
61
+ `,
62
+
63
+ reproduce: `
64
+ --input, -i ........ <required> file or url with a html file:
65
+ file:///path/to/local/file.html
66
+ http://page/with/file.html
67
+ https://page/with/file.html
68
+ --output, -o ....... [optional] directory path to save image
69
+ {default} './'
70
+ --timeout, -t ...... [optional] timeout in millisecods to close browser
71
+ {default} 500
72
+ --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
73
+
36
74
  Examples:
37
75
 
38
- canvasxpress png -i https://canvasxpress.org/examples/bar-3.html
76
+ canvasxpress reproduce -i https://canvasxpress.org/html/layout-7.html
77
+
78
+ canvasxpress reproduce -i file:///node/src/canvasXpress.html
39
79
 
40
- canvasxpress png -i ../src/area.json
80
+ canvasxpress reproduce -i ../src/canvasXpress.html
81
+ `,
41
82
 
42
- canvasxpress png -i ../src/dotplot.png
83
+ png: `
84
+ --input, -i ........ [optional - required] file or url with a html file:
85
+ file:///path/to/local/file.html
86
+ http://page/with/file.html
87
+ https://page/with/file.html
88
+ --output, -o ....... [optional] directory path to save image
89
+ {default} './'
90
+ --width, -x ........ [optional] integer for image width
91
+ {default} 800
92
+ --height, -y ....... [optional] integer for image height
93
+ {default} 800
94
+ --data, -d ......... [optional - required] json string with the data for CanvasXpress
95
+ --config, -c ....... [optional] json string with configuration for CanvasXpress --timeout, -t ...... [optional] timeout in millisecods to close browser
96
+ {default} 500
97
+ --timeout, -t ...... [optional] timeout in millisecods to close browser
98
+ {default} 500
99
+ --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
100
+
101
+ Examples:
43
102
 
44
- canvasxpress png -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}' -c '{"graphOrientation":"vertical","title":"Bar Graph Title"}'
103
+ canvasxpress png -i https://canvasxpress.org/html/bar-3.html
104
+
105
+ canvasxpress png -i file:///node/src/canvasXpress.html
45
106
 
46
- canvasxpress png -i ../src/ToothGrowth.csv -c '{"graphType":"Boxplot","asVariableFactors":["dose"],"stringSampleFactors":["dose"],"groupingFactors":["dose"]}'
107
+ canvasxpress png -i ../src/canvasXpress.html
108
+
109
+ canvasxpress png -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}'
110
+ -c '{"graphOrientation":"vertical","theme":"CanvasXpress","title":"Bar Graph Title"}'
47
111
  `,
48
112
 
49
113
  svg: `
50
- --input, -i ........ [optional - required] file or url:
51
- /path/to/local/file.[json|png|csv|txt|html]
52
- http://page/with/file.[json|png|csv|txt|html]
53
- https://page/with/file.[json|png|csv|txt|html]
114
+ --input, -i ........ [optional - required] file or url with a html file:
115
+ file:///path/to/local/file.html
116
+ http://page/with/file.html
117
+ https://page/with/file.html
54
118
  --output, -o ....... [optional] directory path to save image
55
119
  {default} './'
56
120
  --width, -x ........ [optional] integer for image width
57
121
  {default} 800
58
122
  --height, -y ....... [optional] integer for image height
59
123
  {default} 800
60
- --target, -t ....... [optional] string id for CanvasXpress
61
124
  --data, -d ......... [optional - required] json string with the data for CanvasXpress
62
125
  --config, -c ....... [optional] json string with configuration for CanvasXpress
63
- --events, -e ....... [optional] json/javascript string with events for CanvasXpress
64
- --timeout, -q ...... [optional] timeout in millisecods to close browser
126
+ --timeout, -t ...... [optional] timeout in millisecods to close browser
65
127
  {default} 500
66
128
  --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
67
-
129
+
68
130
  Examples:
69
131
 
70
- canvasxpress svg -i https://canvasxpress.org/examples/bar-3.html
132
+ canvasxpress svg -i https://canvasxpress.org/html/bar-3.html
133
+
134
+ canvasxpress svg -i file:///node/src/canvasXpress.html
71
135
 
72
- canvasxpress svg -i ../src/area.json
136
+ canvasxpress svg -i ../src/canvasXpress.html
73
137
 
74
- canvasxpress svg -i ../src/dotplot.png
75
-
76
- canvasxpress svg -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}' -c '{"graphOrientation":"vertical","title":"Bar Graph Title"}'
77
-
78
- canvasxpress svg -i ../src/ToothGrowth.csv -c '{"graphType":"Boxplot","asVariableFactors":["dose"],"stringSampleFactors":["dose"],"groupingFactors":["dose"]}'
138
+ canvasxpress svg -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}'
139
+ -c '{"graphOrientation":"vertical","theme":"CanvasXpress","title":"Bar Graph Title"}'
79
140
  `,
80
-
141
+
81
142
  json: `
82
- --input, -i ........ [optional - required] file or url:
83
- /path/to/local/file.[json|png|csv|txt|html]
84
- http://page/with/file.[json|png|csv|txt|html]
85
- https://page/with/file.[json|png|csv|txt|html]
143
+ --input, -i ........ [optional - required] file or url with a html file:
144
+ file:///path/to/local/file.html
145
+ http://page/with/file.html
146
+ https://page/with/file.html
86
147
  --output, -o ....... [optional] directory path to save image
87
148
  {default} './'
88
149
  --width, -x ........ [optional] integer for image width
89
150
  {default} 800
90
151
  --height, -y ....... [optional] integer for image height
91
152
  {default} 800
92
- --target, -t ....... [optional] string id for CanvasXpress
93
153
  --data, -d ......... [optional - required] json string with the data for CanvasXpress
94
154
  --config, -c ....... [optional] json string with configuration for CanvasXpress
95
- --events, -e ....... [optional] json/javascript string with events for CanvasXpress
96
- --timeout, -q ...... [optional] timeout in millisecods to close browser
155
+ --timeout, -t ...... [optional] timeout in millisecods to close browser
97
156
  {default} 500
98
157
  --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
99
-
158
+
100
159
  Examples:
101
160
 
102
- canvasxpress json -i https://canvasxpress.org/examples/bar-3.html
161
+ canvasxpress json -i https://canvasxpress.org/html/bar-3.html
162
+
163
+ canvasxpress json -i file:///node/src/canvasXpress.html
103
164
 
104
- canvasxpress json -i ../src/area.json
165
+ canvasxpress json -i ../src/canvasXpress.html
105
166
 
106
- canvasxpress json -i ../src/dotplot.png
107
-
108
- canvasxpress json -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}' -c '{"graphOrientation":"vertical","title":"Bar Graph Title"}'
109
-
110
- canvasxpress json -i ../src/ToothGrowth.csv -c '{"graphType":"Boxplot","asVariableFactors":["dose"],"stringSampleFactors":["dose"],"groupingFactors":["dose"]}'
167
+ canvasxpress json -d '{"y":{"vars":["Variable1"],"smps":["Sample1","Sample2","Sample3"],"data":[[33,44,55]]}}'
168
+ -c '{"graphOrientation":"vertical","theme":"CanvasXpress","title":"Bar Graph Title"}'
111
169
  `,
112
170
 
113
- canvas: `
114
- --input, -i ........ <required> path/to/js/file
115
- --directory, -f .... [optional] directory of CanvasXpres version to check
116
- --graph, -g ........ [optional] graph name
117
- --number, -n ....... [optional] number for the graph
118
- --timeout, -q ...... [optional] timeout in millisecods to close browser
119
- {default} 500
120
- --browser, -b ...... [optional] boolean to do not run headless and pause for debugging
171
+ target: `
172
+ --target, -t ....... [optional] string with CanvasXpress target Id
173
+ `,
121
174
 
122
- Examples:
175
+ data: `
176
+ --data, -d ......... [optional] json string with data for CanvasXpress
177
+ `,
123
178
 
124
- canvasxpress canvas -i canvas/scripts/compareImages.js
179
+ config:`
180
+ --config, -d ....... [optional] json string with configuration for CanvasXpress
181
+ `,
125
182
 
126
- canvasxpress canvas -i canvas/scripts/compareImages.js -g violin -n 11
183
+ events:`
184
+ --events, -e ....... [optional] javascript string with events for CanvasXpress
127
185
  `
128
186
 
129
187
  }
130
188
 
131
189
  module.exports = (args) => {
132
-
190
+
133
191
  const subCmd = args._[0] === 'help' ? args._[1] : args._[0];
134
192
 
135
193
  console.log(menus[subCmd] || menus.main);
136
-
194
+
137
195
  }
package/cmds/io.js CHANGED
@@ -10,11 +10,15 @@ module.exports = async (obj) => {
10
10
 
11
11
  const today = new Date().toISOString().replace('-', '').split('T')[0].replace('-', '');
12
12
 
13
- const logFile = fs.createWriteStream(('/tmp/io-' + today + '.log'), { flags: 'a' });
13
+ const logFile = fs.createWriteStream((dirname + '/logs/io-' + today + '.log'), { flags: 'a' });
14
14
 
15
15
  const logStdout = process.stdout;
16
16
 
17
- const html = (obj.input && obj.input.match(/.html$/) ? obj.input : ("file://" + dirname + "/src/canvasXpress.html")) + (obj.debug ? "?cXH" : "");
17
+ const defhtml = ("file://" + dirname + "/src/canvasXpress.html");
18
+
19
+ if (!fs.existsSync(dirname + '/logs')) {
20
+ fs.mkdirSync(dirname + '/logs');
21
+ }
18
22
 
19
23
  console.log = function () {
20
24
  logFile.write(util.format.apply(null, arguments) + '\n');
@@ -34,30 +38,43 @@ module.exports = async (obj) => {
34
38
  width: 1000,
35
39
  height: 1000
36
40
  },
37
- args: [
38
- '--no-sandbox',
39
- '--disable-setuid-sandbox',
41
+ args: ['--no-sandbox',
40
42
  '--allow-file-access-from-files',
41
- '--enable-local-file-accesses'
42
- ]
43
+ '--enable-local-file-accesses']
43
44
  });
44
45
 
45
46
  const page = await browser.newPage();
46
47
 
47
- page.on("console", (consoleObj) => console.log(consoleObj.text()));
48
+ // Print All
49
+ //page.on("console", (consoleObj) => console.log(consoleObj.text()));
50
+
51
+ // Print All except warnings
52
+ page.on('console', consoleObj => {
53
+ if (consoleObj.type() !== 'warning') {
54
+ console.log(consoleObj.text());
55
+ }
56
+ });
57
+
58
+ /*
59
+ // Print only logs
60
+ page.on('console', consoleObj => {
61
+ if (consoleObj.type() === 'log') {
62
+ console.log(consoleObj.text());
63
+ }
64
+ });
65
+ */
48
66
 
49
67
  if (obj.input && !obj.input.match(/^file|^http/)) {
50
68
  obj.input = "file://" + path.resolve(obj.input);
51
69
  }
52
70
 
53
71
  const func = function (obj) {
54
-
55
72
  if (obj.debug) {
56
73
  debugger;
57
74
  }
58
-
59
75
  var exec = function (cx, tg) {
60
76
  switch (obj.cmd) {
77
+ case 'csv':
61
78
  case 'png':
62
79
  cx.print(false, tg + '.png');
63
80
  break;
@@ -67,76 +84,69 @@ module.exports = async (obj) => {
67
84
  case 'json':
68
85
  cx.save(false, tg + '.json');
69
86
  break;
87
+ case 'reproduce':
88
+ cx.reproduce(false, true, true);
89
+ break;
70
90
  }
71
91
  }
72
-
73
92
  var clbk = function () {
74
- var cx = CanvasXpress.instances[0];
75
- var dt = arguments[0];
76
- if (dt.config) {
77
- dt.config.isNode = true;
78
- }
79
- cx.updateData(dt, false, false, JSON.parse(JSON.stringify(dt.config)));
80
- console.log(logStr);
81
- exec(cx, dt.renderTo);
93
+ var cxs = CanvasXpress.instances;
94
+ var cx = cxs[cxs.length - 1];
95
+ var tg = cx.target;
96
+ console.log("Creating " + (obj.cmd == 'csv' ? 'png' : obj.cmd) + " file from " + (obj.input ? obj.input : 'input data') + " (" + obj.output + (obj.target || cx.target) + ".png)");
97
+ exec(cx, tg);
82
98
  }
83
-
84
- var cx = CanvasXpress.instances[0];
85
-
86
- const extFile = obj.input ? obj.input.split(".").pop() : false;
87
-
88
- const logStr = "Creating " + obj.cmd + " file from " + (obj.input ? obj.input : 'input data') + " (" + obj.output + (obj.target || cx.target) + (extFile == 'html' ? '' : '-1') + "." + obj.cmd + ")";
89
-
90
- cx.setDimensions(obj.width, obj.height);
91
-
92
- if (obj.input) {
93
- try {
94
- switch (extFile) {
95
- case 'html':
96
- console.log(logStr);
99
+ var cxs = CanvasXpress.instances;
100
+ for (var i = 0; i < cxs.length; i++) {
101
+ var cx = cxs[i];
102
+
103
+ cx.setDimensions(obj.width, obj.height);
104
+ if (obj.input) {
105
+ try {
106
+ if (obj.cmd == 'csv') {
107
+ cx.dataURL = obj.input;
108
+ cx.remoteTransitionEffect = 'none';
109
+ cx.getDataFromURLOrString(obj.target || cx.target, obj.config, false, false, clbk);
110
+ } else {
111
+ console.log("Creating " + (obj.cmd == 'csv' ? 'png' : obj.cmd) + " file from " + (obj.input ? obj.input : 'input data') + " (" + obj.output + (obj.target || cx.target) + "." + obj.cmd + ")");
97
112
  exec(cx, obj.target || cx.target);
98
- return;
99
- case 'json':
100
- case 'csv':
101
- case 'text':
102
- case 'png':
103
- console.log(logStr);
104
- CanvasXpress.loadRemoteData(obj.target || cx.target, obj.input, obj.config, false, clbk);
105
- return;
113
+ }
114
+ } catch (err) {
115
+ console.error(err);
116
+ }
117
+ } else if (obj.data) {
118
+ try {
119
+ console.log("Creating " + (obj.cmd == 'csv' ? 'png' : obj.cmd) + " file from " + (obj.input ? obj.input : 'input data') + " (" + obj.output + (obj.target || cx.target) + "." + obj.cmd + ")");
120
+ cx.updateData(obj.data, false, false, obj.config);
121
+ exec(cx, obj.target || cx.target);
122
+ return;
123
+ } catch (err) {
124
+ console.error(err);
106
125
  }
107
- } catch (err) {
108
- console.error(err);
109
- }
110
- } else if (obj.data) {
111
- try {
112
- console.log(logStr);
113
- cx.updateData(obj.data, false, false, obj.config);
114
- exec(cx, obj.target || cx.target);
115
- return;
116
- } catch (err) {
117
- console.error(err);
118
126
  }
119
- }
120
127
 
128
+ }
121
129
  }
122
130
 
123
- const client = await page.target().createCDPSession();
124
-
125
- await client.send('Page.setDownloadBehavior', {
131
+ await page._client.send('Page.setDownloadBehavior', {
126
132
  behavior: 'allow',
127
133
  downloadPath: obj.output
128
- })
134
+ });
129
135
 
130
- await page.goto(html);
136
+ if (obj.input) {
137
+ await page.goto(obj.cmd == 'csv' ? defhtml : obj.cmd == 'reproduce' ? obj.input + '?showTransition=false' : obj.input);
138
+ } else {
139
+ await page.goto(defhtml);
140
+ }
131
141
 
132
- await page.waitForFunction('typeof (CanvasXpress) !== undefined && CanvasXpress.ready');
142
+ await page.waitFor(() => typeof (CanvasXpress) !== undefined && CanvasXpress.ready);
133
143
 
134
144
  await page.evaluate(`(${func.toString()})(${JSON.stringify(obj)})`);
135
145
 
136
146
  await setTimeout(() => {
137
147
  browser.close();
138
148
  spinner.stop();
139
- }, obj.tmout);
149
+ }, obj.cmd == 'csv' || obj.cmd == 'reproduce' ? obj.tmout + 2500 : obj.tmout);
140
150
 
141
151
  } catch (err) {
142
152
 
@@ -144,4 +154,4 @@ module.exports = async (obj) => {
144
154
 
145
155
  }
146
156
 
147
- }
157
+ }
package/cmds/version.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const { version } = require('../package.json')
2
2
 
3
3
  module.exports = (args) => {
4
-
4
+
5
5
  console.log(`v${version}`);
6
-
6
+
7
7
  }
package/index.js CHANGED
@@ -28,13 +28,11 @@ module.exports = () => {
28
28
 
29
29
  let height = args.height || args.y || 800;
30
30
 
31
- let tmout = args.timeout || args.q || 2500;
31
+ let tmout = args.timeout || args.t || 2500;
32
32
 
33
- let usePlaywright = args.playwright || args.pw || process.argv.includes('-playwright') || false;
33
+ let data = dat ? JSON.parse(dat) : { "y": { "vars": ["Variable1"], "smps": ["Sample1", "Sample2", "Sample3"], "data": [[55, 44, 33]] } };
34
34
 
35
- let data = dat ? JSON.parse(dat) : false;
36
-
37
- let config = conf ? JSON.parse(conf) : false;
35
+ let config = conf ? JSON.parse(conf) : { "graphType": "Boxplot", "transposeData": true, "asVariableFactors": ["dose"], "stringSampleFactors": ["dose"], "groupingFactors": ["dose"] };
38
36
 
39
37
  let obj = {
40
38
  cmd: cmd,
@@ -48,7 +46,6 @@ module.exports = () => {
48
46
  width: width,
49
47
  height: height,
50
48
  tmout: tmout,
51
- usePlaywright: usePlaywright,
52
49
  args: args
53
50
  }
54
51
 
@@ -74,11 +71,13 @@ module.exports = () => {
74
71
 
75
72
  switch (cmd) {
76
73
 
74
+ case 'csv':
77
75
  case 'png':
78
76
  case 'svg':
79
77
  case 'json':
78
+ case 'reproduce':
80
79
  if (input || data) {
81
- require(usePlaywright ? './cmds/io-playwright' : './cmds/io')(obj);
80
+ require('./cmds/io')(obj);
82
81
  } else {
83
82
  require('./cmds/help')(args);
84
83
  }
@@ -93,7 +92,7 @@ module.exports = () => {
93
92
  require('./cmds/help')(args);
94
93
  break;
95
94
  case 'test':
96
- require(usePlaywright ? './cmds/io-playwright' : './cmds/io')({
95
+ require('./cmds/io')({
97
96
  cmd: "png",
98
97
  input: "https://www.canvasxpress.org/examples/bar-1.html",
99
98
  output: "./test/",
@@ -107,7 +106,7 @@ module.exports = () => {
107
106
  tmout: tmout,
108
107
  args: args
109
108
  });
110
- require(usePlaywright ? './cmds/io-playwright' : './cmds/io')({
109
+ require('./cmds/io')({
111
110
  cmd: "svg",
112
111
  input: "https://www.canvasxpress.org/examples/bar-1.html",
113
112
  output: "./test/",
@@ -121,7 +120,7 @@ module.exports = () => {
121
120
  tmout: tmout,
122
121
  args: args
123
122
  });
124
- require(usePlaywright ? './cmds/io-playwright' : './cmds/io')({
123
+ require('./cmds/io')({
125
124
  cmd: "json",
126
125
  input: "https://www.canvasxpress.org/examples/bar-1.html",
127
126
  output: "./test/",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvasxpress-cli",
3
- "version": "62.2.0",
3
+ "version": "62.4.5",
4
4
  "license": {
5
5
  "type": "Dual licensing",
6
6
  "url": "https://www.canvasxpress.org/docs/license.html"
@@ -3,25 +3,29 @@
3
3
  <!-- CanvasXpress -->
4
4
  <link rel="stylesheet" href="../src/canvasXpress.css" type="text/css"/>
5
5
  <script type="text/javascript" src="../src/canvasXpress.js"></script>
6
+ <!-- Page Script -->
7
+ <script>
8
+ onReady(function () {
9
+ var cx = new CanvasXpress("cX",
10
+ {
11
+ "y" : {
12
+ "vars" : ["Variable1"],
13
+ "smps" : ["Sample1", "Sample2", "Sample3"],
14
+ "data" : [[33, 44, 55]]
15
+ }
16
+ },
17
+ {
18
+ "graphOrientation": "vertical",
19
+ "graphType": "Bar",
20
+ "title": "Simple Bar graph"
21
+ }
22
+ );
23
+ });
24
+ </script>
6
25
  </head>
7
26
  <body>
8
27
  <div>
9
28
  <canvas id='cX' width='600' height='600' data-responsive='true' data-aspectRatio='1:1'></canvas>
10
29
  </div>
11
- <!-- Page Script -->
12
- <script>
13
- var cx = new CanvasXpress("cX",
14
- {
15
- "y" : {
16
- "vars" : ["Variable1"],
17
- "smps" : ["Sample1", "Sample2", "Sample3"],
18
- "data" : [[33, 44, 55]]
19
- }
20
- }, {
21
- "graphOrientation": "vertical",
22
- "graphType": "Bar"
23
- }
24
- );
25
- </script>
26
30
  </body>
27
31
  </html>