Skip to content

Instantly share code, notes, and snippets.

View webbres's full-sized avatar

Sam webbres

  • Leeds, UK
View GitHub Profile
@webbres
webbres / plotlyKnimeSvgExport.js
Last active November 21, 2018 14:05
Working SVG export in KNIME 3.6 onwards - configure with chromium or chrome
// Remove an element with a specific class from the DOM
function removeElementsByClass(className){
var elements = document.getElementsByClassName(className);
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
}
// Remove the curso-crosshair class which is the interactive layer
// If this layer is present a series of black boxes will be added
@webbres
webbres / violinKnime.js
Created November 19, 2018 15:54
Violin plot multi col KNIME
// Load Plotly - Requires jQuery (tick Dependencies above)
require.config({
paths: {
'Plotly': 'https://cdn.plot.ly/plotly-latest.min'
}
});
// Enter the columns you wish to plot. This is case sensitive!
var columnNames = ['yield', 'Time'];
@webbres
webbres / 3d_scatter_knime.js
Last active March 13, 2018 01:20
3D scatter plot using Plotly in KNIME Generic JavaScript View
// Load Plotly - Requires jQuery (tick Dependencies above)
require.config({
paths: {
'Plotly': 'https://cdn.plot.ly/plotly-latest.min'
}
});
// The columns containing the data to display
var colSelectionX = knimeDataTable.getColumn(0);
@webbres
webbres / editRow.java
Last active August 29, 2015 14:03
KNIME example output row
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception
{
DataTableSpec inSpec = inData[0].getDataTableSpec();
BufferedDataContainer buf = exec.createDataContainer(inSpec);
int column_index = inSpec.findColumnIndex(m_colSel.getStringValue());
final int nrRows = inData[0].getRowCount();
int count=0;
for (DataRow row : inData[0])