Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added idd.assembled.js #189

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
44 changes: 43 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,47 @@
}
}
},
webpack: {
config: {
mode: 'production',
entry: [
'./src/idd/idd.selfcontained.js'
],
output: {
filename: 'idd.selfcontained.js'
},
optimization: {
minimize: true
},
stats: {
warnings: false
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(jpe?g|png|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
use: {
loader: 'base64-inline-loader',
options: {
limit: 3000,
name: '[name].[ext]',

fallback: "file-loader",
name: '[name].[ext]',
}
}
},
]
}
}
},
});

grunt.loadNpmTasks('grunt-contrib-uglify');
Expand All @@ -205,8 +246,9 @@
grunt.loadNpmTasks('grunt-base64');
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks('grunt-tsd');
grunt.loadNpmTasks('grunt-webpack');

grunt.registerTask('update-tsd', ['tsd']);
grunt.registerTask('default', ['concat:heatmap_worker', 'base64', 'concat:heatmap_worker_embedded', 'concat:styles', 'concat:dist_ko', 'ts:dist', 'concat:dist', 'uglify', 'copy', 'concat:umd', 'concat:umdTs', 'ts:testGlobal', 'ts:test', 'jasmine']);
grunt.registerTask('default', ['concat:heatmap_worker', 'base64', 'concat:heatmap_worker_embedded', 'concat:styles', 'concat:dist_ko', 'ts:dist', 'concat:dist', 'uglify', 'copy', 'concat:umd', 'concat:umdTs', 'ts:testGlobal', 'ts:test', 'jasmine', 'webpack']);
grunt.registerTask('test', ['jasmine']);
};
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ Interactive Data Display is available as Bower package. You can download IDD as

`bower install idd`

Using in offline projects
-------------------------

Interactive Data Display is available as self contained script.
You may use idd.selfcontained.js in small or offline projects. This script contains all IDD dependencies inside and easy to import.

Licensing
---------

Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@
"svg.js": "~2.3.6"
},
"devDependencies": {
"base64-inline-loader": "^1.1.1",
"css-loader": "^2.1.1",
"grunt": "^0.4.5",
"grunt-base64": "^0.1.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-jasmine": "^1.0.0",
"grunt-contrib-uglify": "^0.9.1",
"grunt-ts": "^5.2.0",
"grunt-tsd": "^0.1.0"
"grunt-tsd": "^0.1.0",
"grunt-webpack": "^3.1.3",
"jquery-ui-touch-punch": "^0.2.3",
"knockout": "^3.5.0",
"script-loader": "^0.7.2",
"style-loader": "^0.23.1",
"webpack": "^4.29.6"
},
"scripts": {
"test": "grunt default test --verbose"
Expand Down
57 changes: 57 additions & 0 deletions samples/Idd.SelfContained Dynamic Gradient Heatmap.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=10; IE=Edge"/>
<title>Dynamic Gradient Heatmap</title>
<link rel="stylesheet" type="text/css" href="../src/css/IDDTheme.css"/>

<script src="../dist/idd.selfcontained.js"></script>

<script type="text/javascript">
var N = 200;
var M = 200;
var phase = 0.0;

// 1D arrays for grids x,y and 1D array for values f.
// Size of data array here is one less than size of the grid.
// HeatmapGraph will render in gradient mode, when grid of size N x M
// defines N x M rectangular cells filled with gradient brush according to
// corresponding 4 elements of the data array.
var x, y, f;
var heatmap;

$(document).ready(function () {
// Initializing chart
heatmap = InteractiveDataDisplay.asPlot('chart').get("heatmap");
// Allocating arrays
x = new Array(N);
y = new Array(M);
f = new Array(N);
for (var i = 0; i < N; i++) f[i] = new Array(M);
// Coordinate grid is constant and it is initialized once
for (var i = 0; i < N; i++) x[i] = -Math.PI + 2 * i * Math.PI / N;
for (var j = 0; j < M; j++) y[j] = -Math.PI / 2 + j * Math.PI / M;
// Running the model for the first time
modelRun();
});

function modelRun() {
// Compute next iteration and store it in data array
for (var i = 0; i < N; i++)
for (var j = 0; j < M; j++)
f[i][j] = Math.sqrt(x[i] * x[i] + y[j] * y[j])
* Math.abs(Math.cos(x[i] * x[i] + y[j] * y[j] + phase));
phase += 0.1;
heatmap.draw({ x: x, y: y, values: f });
setTimeout(modelRun, 1000 / 60.0);
}
</script>
</head>
<body>
<div id="chart" data-idd-plot="chart" style="width: 800px; height: 600px;">
<div data-idd-placement="top" style="text-align: center">Dynamic Heatmap</div>
<div id="heatmap" data-idd-plot="heatmap" data-idd-style="colorPalette:0=#00A8C6,#40C0CB,#F9F2E7,#AEE239,#8FBE00=3">
</div>
</div>
</body>
</html>
11 changes: 11 additions & 0 deletions src/idd/idd.selfcontained.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "script-loader!npm-modernizr"
import "script-loader!jquery"
import "script-loader!jqueryui"
import "script-loader!rx"
import "script-loader!svg.js"
import "script-loader!file-saver"
import "script-loader!jquery-ui-touch-punch"
import "script-loader!jquery-mousewheel"
import "script-loader!knockout"
import "script-loader!../../dist/idd.js"
import "../../dist/idd.css"
Loading