Skip to content

Commit a15335d

Browse files
committed
Update Plotly distribution used
1 parent 08e058f commit a15335d

5 files changed

Lines changed: 68 additions & 2721 deletions

File tree

danfojs/src/plotting/plot.js

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { newPlot } from 'plotly.js';
21
import { Utils } from "../core/utils";
32
import { Series } from "../core/series";
3+
import Plotly from 'plotly.js-dist';
4+
45

56
const utils = new Utils();
67

@@ -41,7 +42,7 @@ export class Plot {
4142
trace["y"] = y;
4243
trace['type'] = "line";
4344

44-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
45+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
4546

4647
} else {
4748
//check if plotting two columns against each other
@@ -69,7 +70,7 @@ export class Plot {
6970
this_config['layout']['xaxis'] = xaxis;
7071
this_config['layout']['yaxis'] = yaxis;
7172

72-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
73+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
7374

7475
} else if (utils.__key_in_object(this_config, 'x') || utils.__key_in_object(this_config, 'y')) {
7576
//plot single column specified in either of param [x | y] against index
@@ -102,7 +103,7 @@ export class Plot {
102103
data.push(trace);
103104

104105
});
105-
newPlot(this.div, data, this_config['layout'], this_config);
106+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
106107

107108
} else {
108109
//plot columns against index
@@ -128,7 +129,7 @@ export class Plot {
128129
data.push(trace);
129130

130131
});
131-
newPlot(this.div, data, this_config['layout'], this_config);
132+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
132133

133134
}
134135

@@ -163,7 +164,7 @@ export class Plot {
163164
trace["y"] = y;
164165
trace['type'] = "bar";
165166

166-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
167+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
167168

168169
} else {
169170
//check if plotting two columns against each other
@@ -192,7 +193,7 @@ export class Plot {
192193
this_config['layout']['xaxis'] = xaxis;
193194
this_config['layout']['yaxis'] = yaxis;
194195

195-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
196+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
196197

197198
} else if (utils.__key_in_object(this_config, 'x') || utils.__key_in_object(this_config, 'y')) {
198199
//plot single column specified in either of param [x | y] against index
@@ -211,7 +212,7 @@ export class Plot {
211212
}
212213
trace['type'] = "bar";
213214

214-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
215+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
215216

216217
} else {
217218
//plot columns against index
@@ -238,7 +239,7 @@ export class Plot {
238239
data.push(trace);
239240

240241
});
241-
newPlot(this.div, data, this_config['layout'], this_config);
242+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
242243

243244
}
244245

@@ -274,7 +275,7 @@ export class Plot {
274275
trace['type'] = "scatter";
275276
trace['mode'] = "markers";
276277

277-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
278+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
278279

279280
} else {
280281
//check if plotting two columns against each other
@@ -303,7 +304,7 @@ export class Plot {
303304
this_config['layout']['xaxis'] = xaxis;
304305
this_config['layout']['yaxis'] = yaxis;
305306

306-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
307+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
307308

308309
} else if (utils.__key_in_object(this_config, 'x') || utils.__key_in_object(this_config, 'y')) {
309310
//plot single column specified in either of param [x | y] against index
@@ -327,7 +328,7 @@ export class Plot {
327328
trace['type'] = "scatter";
328329
trace['mode'] = "markers";
329330

330-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
331+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
331332

332333
} else {
333334
//plot columns against index
@@ -354,7 +355,7 @@ export class Plot {
354355
data.push(trace);
355356

356357
});
357-
newPlot(this.div, data, this_config['layout'], this_config);
358+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
358359

359360
}
360361

@@ -388,7 +389,7 @@ export class Plot {
388389
trace["x"] = this.ndframe.values;
389390
trace['type'] = "histogram";
390391

391-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
392+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
392393

393394
} else if (utils.__key_in_object(this_config, 'x')) {
394395
//plot as vertical histogram
@@ -402,7 +403,7 @@ export class Plot {
402403
trace['x'] = this.ndframe[this_config['y']].values;
403404
trace['type'] = "histogram";
404405

405-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
406+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
406407

407408
} else if (utils.__key_in_object(this_config, 'y')) {
408409
//plot as vertical histogram
@@ -416,7 +417,7 @@ export class Plot {
416417
trace['y'] = this.ndframe[this_config['y']].values;
417418
trace['type'] = "histogram";
418419

419-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
420+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
420421

421422
} else {
422423
let data = [];
@@ -436,7 +437,7 @@ export class Plot {
436437
data.push(trace);
437438

438439
});
439-
newPlot(this.div, data, this_config['layout'], this_config);
440+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
440441

441442
}
442443

@@ -465,7 +466,7 @@ export class Plot {
465466
automargin: true
466467
} ];
467468

468-
newPlot(this.div, data, this_config['layout'], this_config);
469+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
469470

470471
} else if (utils.__key_in_object(this_config, 'values') && utils.__key_in_object(this_config, 'labels')) {
471472
if (!this.ndframe.column_names.includes(this_config['labels'])) {
@@ -483,7 +484,7 @@ export class Plot {
483484
automargin: true
484485
} ];
485486

486-
newPlot(this.div, data, this_config['layout'], this_config);
487+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
487488

488489
} else {
489490
let cols_to_plot;
@@ -541,7 +542,7 @@ export class Plot {
541542
this_config['grid'] = { rows: size, columns: size };
542543
}
543544
this_config['layout']['grid'] = this_config['grid'];
544-
newPlot(this.div, data, this_config['layout'], this_config);
545+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
545546

546547

547548
}
@@ -573,7 +574,7 @@ export class Plot {
573574
trace["y"] = y;
574575
trace['type'] = "box";
575576

576-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
577+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
577578

578579
} else {
579580
//check if plotting two columns against each other
@@ -602,7 +603,7 @@ export class Plot {
602603
this_config['layout']['xaxis'] = xaxis;
603604
this_config['layout']['yaxis'] = yaxis;
604605

605-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
606+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
606607

607608
} else if (utils.__key_in_object(this_config, 'x') || utils.__key_in_object(this_config, 'y')) {
608609
//plot single column specified in either of param [x | y] against index
@@ -624,7 +625,7 @@ export class Plot {
624625
trace['type'] = 'box';
625626
}
626627

627-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
628+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
628629

629630
} else {
630631
//plot columns against index
@@ -649,7 +650,7 @@ export class Plot {
649650
data.push(trace);
650651

651652
});
652-
newPlot(this.div, data, this_config['layout'], this_config);
653+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
653654

654655
}
655656

@@ -683,7 +684,7 @@ export class Plot {
683684
trace["y"] = y;
684685
trace['type'] = "violin";
685686

686-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
687+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
687688

688689
} else {
689690
//check if plotting two columns against each other
@@ -712,7 +713,7 @@ export class Plot {
712713
this_config['layout']['xaxis'] = xaxis;
713714
this_config['layout']['yaxis'] = yaxis;
714715

715-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
716+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
716717

717718
} else if (utils.__key_in_object(this_config, 'x') || utils.__key_in_object(this_config, 'y')) {
718719
//plot single column specified in either of param [x | y] against index
@@ -734,7 +735,7 @@ export class Plot {
734735
trace['type'] = 'violin';
735736
}
736737

737-
newPlot(this.div, [ trace ], this_config['layout'], this_config);
738+
Plotly.newPlot(this.div, [ trace ], this_config['layout'], this_config);
738739

739740
} else {
740741
//plot columns against index
@@ -759,7 +760,7 @@ export class Plot {
759760
data.push(trace);
760761

761762
});
762-
newPlot(this.div, data, this_config['layout'], this_config);
763+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
763764

764765
}
765766

@@ -819,7 +820,7 @@ export class Plot {
819820
header: header,
820821
cells: cells
821822
} ];
822-
newPlot(this.div, data, this_config['layout'], this_config);
823+
Plotly.newPlot(this.div, data, this_config['layout'], this_config);
823824

824825
}
825826

lib/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
"danfojs/types"
2222
],
2323
"dependencies": {
24+
"@babel/runtime": "^7.12.13",
2425
"@tensorflow/tfjs": "2.8.5",
2526
"mathjs": "7.5.1",
26-
"plotly.js": "1.54.7",
27+
"plotly.js-dist": "^1.58.4",
2728
"table": "^5.4.6",
28-
"xlsx": "^0.16.7",
29-
"@babel/runtime": "^7.12.13"
29+
"xlsx": "^0.16.7"
3030
},
3131
"scripts": {
3232
"test": "yarn run build && karma start --single-run --browsers ChromeHeadless karma.conf.js",
@@ -94,4 +94,4 @@
9494
]
9595
},
9696
"sideEffects": false
97-
}
97+
}

0 commit comments

Comments
 (0)