Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions js/mx.js
Original file line number Diff line number Diff line change
Expand Up @@ -5352,6 +5352,32 @@
mx.update_image_row = function(Mx, buf, data, row, zmin, zmax, xcompression) {
var imgd = new Uint32Array(buf, row * buf.width * 4, buf.width);

// special case xcompression type 6 should run outside of for loop
if (data && xcompression === 6) {

let formattedData = [];
let simplifiedData = [];
let reformattedData = [];

// format data with x and y properties
for (var index = 0; index < data.length; index++) {
value = data[index];
formattedData.push({ ['x']: index, ['y']: value });
}

// run formatted data through simplify js
simplifiedData = simplify(formattedData, 1, false);

// reformat array back to original
reformattedData = simplifiedData.map((item) => {
return item.y
});

// set data equal to reformatted, simplified data
data = reformattedData;
}


Mx.pixel.setRange(zmin, zmax);

var xc = Math.max(1, data.length / buf.width);
Expand Down Expand Up @@ -5379,6 +5405,7 @@
value = Math.max(Math.abs(value), Math.abs(data[didx + j]));
}
}

}
var colorIdx = Mx.pixel.getColorIndex(value);
imgd[i] = colorIdx;
Expand Down
1 change: 0 additions & 1 deletion js/sigplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -5001,7 +5001,6 @@
text: "XLABel...",
handler: function() {
var validator = function(value) {
console.log("The value is " + value);
var isValid = mx.intValidator(value);
return isValid;
};
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
},
"dependencies": {
"loglevel": "^1.4.1",
"simplify-js": "^1.2.3",
"spin": "0.0.1",
"tinycolor2": "^1.4.1",
"travis": "^0.1.1"
Expand Down
3 changes: 2 additions & 1 deletion test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>WebSigPlot Unit Test</title>
<link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
<!-- show all tests, even if they haven't run yet --!>
<!-- show all tests, even if they haven't run yet -->
<style>
#qunit-tests > li {
display: initial;
Expand All @@ -17,6 +17,7 @@
<div id="qunit-fixture"></div>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script src="../node_modules/qunit-assert-close/qunit-assert-close.js"></script>
<script src="../node_modules/simplify-js/simplify.js"></script>
<script>
// always run tests in-order
QUnit.config.reorder = false;
Expand Down
25 changes: 25 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,31 @@ QUnit.module('sigplot-interactive', {
}
}
});
interactiveTest('xcomp:6 (rdp)', 'This is our rdp xcmp 6 test', function(assert) {

var bfr = new sigplot.bluefile.BlueFileReader();
bfr.read_http("dat/sin.tmp", function(hdr) {
console.log('here is hdr ', hdr);
let dataPoints = hdr.dview;
console.log('here are the values: ', dataPoints);

var container = document.getElementById('plot');
var plot = new sigplot.Plot(container, {
xcmp: 6
});

plot.overlay_pipe({
type: 2000,
subsize: 16384
});
var cnt = 0;
ifixture.interval = window.setInterval(function() {
cnt = cnt + 1;
plot.push(0, dataPoints);
}, 100);
});
});

interactiveTest('sigplot empty', 'Do you see an empty plot scaled from -1 to 1 on both axis?', function(assert) {
var container = document.getElementById('plot');
assert.equal(container.childNodes.length, 0);
Expand Down