mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 15:56:16 -04:00
Actually made operations work (and made the module 8MB)
Unfortunately they need jsdom
This commit is contained in:
parent
4ae875601a
commit
f8874fc586
8 changed files with 211 additions and 201 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as d3 from "d3";
|
||||
import jsdom from "jsdom";
|
||||
import { getScatterValues, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
|
||||
|
||||
|
||||
|
@ -89,8 +90,8 @@ class HeatmapChart extends Operation {
|
|||
* @returns {html}
|
||||
*/
|
||||
run(input, args) {
|
||||
const recordDelimiter = Utils.charRep[args[0]],
|
||||
fieldDelimiter = Utils.charRep[args[1]],
|
||||
const recordDelimiter = Utils.charRep(args[0]),
|
||||
fieldDelimiter = Utils.charRep(args[1]),
|
||||
vBins = args[2],
|
||||
hBins = args[3],
|
||||
columnHeadingsAreIncluded = args[4],
|
||||
|
@ -116,6 +117,7 @@ class HeatmapChart extends Operation {
|
|||
yLabel = headings.y;
|
||||
}
|
||||
|
||||
const document = new jsdom.JSDOM().window.document;
|
||||
let svg = document.createElement("svg");
|
||||
svg = d3.select(svg)
|
||||
.attr("width", "100%")
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import * as d3 from "d3";
|
||||
import * as d3hexbin from "d3-hexbin";
|
||||
import jsdom from "jsdom";
|
||||
import { getScatterValues, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
@ -94,8 +95,8 @@ class HexDensityChart extends Operation {
|
|||
* @returns {html}
|
||||
*/
|
||||
run(input, args) {
|
||||
const recordDelimiter = Utils.charRep[args[0]],
|
||||
fieldDelimiter = Utils.charRep[args[1]],
|
||||
const recordDelimiter = Utils.charRep(args[0]),
|
||||
fieldDelimiter = Utils.charRep(args[1]),
|
||||
packRadius = args[2],
|
||||
drawRadius = args[3],
|
||||
columnHeadingsAreIncluded = args[4],
|
||||
|
@ -119,6 +120,7 @@ class HexDensityChart extends Operation {
|
|||
yLabel = headings.y;
|
||||
}
|
||||
|
||||
const document = new jsdom.JSDOM().window.document;
|
||||
let svg = document.createElement("svg");
|
||||
svg = d3.select(svg)
|
||||
.attr("width", "100%")
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as d3 from "d3";
|
||||
import jsdom from "jsdom";
|
||||
import { getScatterValues, getScatterValuesWithColour, RECORD_DELIMITER_OPTIONS, COLOURS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
@ -77,8 +78,8 @@ class ScatterChart extends Operation {
|
|||
* @returns {html}
|
||||
*/
|
||||
run(input, args) {
|
||||
const recordDelimiter = Utils.charRep[args[0]],
|
||||
fieldDelimiter = Utils.charRep[args[1]],
|
||||
const recordDelimiter = Utils.charRep(args[0]),
|
||||
fieldDelimiter = Utils.charRep(args[1]),
|
||||
columnHeadingsAreIncluded = args[2],
|
||||
fillColour = args[5],
|
||||
radius = args[6],
|
||||
|
@ -89,7 +90,6 @@ class ScatterChart extends Operation {
|
|||
yLabel = args[4];
|
||||
|
||||
const dataFunction = colourInInput ? getScatterValuesWithColour : getScatterValues;
|
||||
|
||||
const { headings, values } = dataFunction(
|
||||
input,
|
||||
recordDelimiter,
|
||||
|
@ -101,7 +101,7 @@ class ScatterChart extends Operation {
|
|||
xLabel = headings.x;
|
||||
yLabel = headings.y;
|
||||
}
|
||||
|
||||
const document = new jsdom.JSDOM().window.document;
|
||||
let svg = document.createElement("svg");
|
||||
svg = d3.select(svg)
|
||||
.attr("width", "100%")
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as d3 from "d3";
|
||||
import jsdom from "jsdom";
|
||||
import { getSeriesValues, RECORD_DELIMITER_OPTIONS, FIELD_DELIMITER_OPTIONS } from "../lib/Charts";
|
||||
|
||||
import Operation from "../Operation";
|
||||
|
@ -62,8 +63,8 @@ class SeriesChart extends Operation {
|
|||
* @returns {html}
|
||||
*/
|
||||
run(input, args) {
|
||||
const recordDelimiter = Utils.charRep[args[0]],
|
||||
fieldDelimiter = Utils.charRep[args[1]],
|
||||
const recordDelimiter = Utils.charRep(args[0]),
|
||||
fieldDelimiter = Utils.charRep(args[1]),
|
||||
xLabel = args[2],
|
||||
pipRadius = args[3],
|
||||
seriesColours = args[4].split(","),
|
||||
|
@ -78,6 +79,7 @@ class SeriesChart extends Operation {
|
|||
allSeriesHeight = Object.keys(series).length * (interSeriesPadding + seriesHeight),
|
||||
svgHeight = allSeriesHeight + xAxisHeight + interSeriesPadding;
|
||||
|
||||
const document = new jsdom.JSDOM().window.document;
|
||||
let svg = document.createElement("svg");
|
||||
svg = d3.select(svg)
|
||||
.attr("width", "100%")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue