Skip to content

Commit

Permalink
feat(demo): add new Example to demo Real-time Market Trading
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Jan 3, 2022
1 parent 15d23e5 commit e50434a
Show file tree
Hide file tree
Showing 11 changed files with 568 additions and 1 deletion.
4 changes: 4 additions & 0 deletions examples/webpack-demo-vanilla-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@
"whatwg-fetch": "^3.6.2"
},
"devDependencies": {
"@fnando/sparkline": "^0.3.10",
"@types/faker": "^5.5.9",
"@types/fnando__sparkline": "^0.3.4",
"@types/jquery": "^3.5.11",
"@types/moment": "^2.13.0",
"@types/node": "^17.0.5",
"@types/webpack": "^5.28.0",
"clean-webpack-plugin": "4.0.0",
"copy-webpack-plugin": "^10.2.0",
"css-loader": "^6.5.1",
"faker": "^5.5.3",
"file-loader": "^6.2.0",
"fork-ts-checker-webpack-plugin": "^6.5.0",
"html-loader": "^3.0.1",
Expand Down
1 change: 1 addition & 0 deletions examples/webpack-demo-vanilla-bundle/src/app-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class AppRouting {
{ route: 'example15', name: 'example15', title: 'Example15', moduleId: './examples/example15' },
{ route: 'example16', name: 'example16', title: 'Example16', moduleId: './examples/example16' },
{ route: 'example17', name: 'example17', title: 'Example17', moduleId: './examples/example17' },
{ route: 'example18', name: 'example18', title: 'Example18', moduleId: './examples/example18' },
{ route: 'icons', name: 'icons', title: 'icons', moduleId: './examples/icons' },
{ route: '', redirect: 'example01' },
{ route: '**', redirect: 'example01' }
Expand Down
13 changes: 12 additions & 1 deletion examples/webpack-demo-vanilla-bundle/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h4 class="title is-4 has-text-white">Slickgrid-Universal</h4>
</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
Examples
Examples 1-15
</a>

<div class="navbar-dropdown">
Expand Down Expand Up @@ -72,12 +72,23 @@ <h4 class="title is-4 has-text-white">Slickgrid-Universal</h4>
<a class="navbar-item" onclick.delegate="loadRoute('example15')">
Example15 - OData Backend Service with RxJS
</a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
16-30
</a>

<div class="navbar-dropdown">
<a class="navbar-item" onclick.delegate="loadRoute('example16')">
Example16 - Regular & Custom Tooltips
</a>
<a class="navbar-item" onclick.delegate="loadRoute('example17')">
Example17 - Auto-Scroll for Selector
</a>
<a class="navbar-item" onclick.delegate="loadRoute('example18')">
Example18 - Real-Time Trading Platform
</a>
</div>
</div>
</div>
Expand Down
59 changes: 59 additions & 0 deletions examples/webpack-demo-vanilla-bundle/src/examples/example18.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<h3 class="title is-3">
Example 18 - Real-Time Trading Platform
<span class="subtitle">(with Material Theme)</span>
<div class="subtitle" style="float: right; margin-top: -20px">
<a class="is-size-5" target="_blank"
href="https://github.com/ghiscoding/slickgrid-universal/blob/master/examples/webpack-demo-vanilla-bundle/src/examples/example18.ts">
<span class="mdi mdi-link mdi-v-align-sub"></span> code
</a>
</div>
</h3>
<h6 class="title is-6 italic">
Simulate a stock trading platform with lot of price changes, to show SlickGrid HUGE PERF., do the following: (1) lower
Changes Rate (2) increase both Changes per Cycle and (3) lower Highlight Duration
</h6>

<div class="trading-platform">
<div class="row simulation-form">
<div>
<div class="range">
<label for="refreshRateRange" class="form-label">Changes Rate(ms)</label>
<input type="range" class="form-range" id="refreshRateRange" min="0" max="250" value.bind="refreshRate">
<span class="refresh-rate">
<input type="number" value.bind="refreshRate">
</span>
</div>
<span>
<button class="button is-small" data-test="start-btn" onclick.delegate="startSimulation()">
<span class="icon mdi mdi-play-circle-outline"></span>
<span>Start Simulation</span>
</button>
</span>
<span>
<button class="button is-small" data-test="stop-btn" onclick.delegate="stopSimulation()">
<span class="icon mdi mdi-stop-circle-outline"></span>
<span>Stop Simulation</span>
</button>
</span>
<span>
<label for="change-per-cycle-input">Changes p/Cycle</label>
<input type="number" id="change-per-cycle-input" value.bind="minChangePerCycle" max.bind="maxChangePerCycle">
to
<input type="number" value.bind="maxChangePerCycle" min.bind="minChangePerCycle">
</span>
<span>
<label for="highlight-input">Highlight Duration(ms)</label>
<input type="number" id="highlight-input" data-test="highlight-input" value.bind="highlightDuration">
</span>
<span style="float: right">
<button class="button is-small" onclick.delegate="toggleFullScreen()">
<span class.bind="toggleClassName"></span>
<span>Toggle Full-Screen</span>
</button>
</span>
</div>
</div>

<div class="grid18">
</div>
</div>
51 changes: 51 additions & 0 deletions examples/webpack-demo-vanilla-bundle/src/examples/example18.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// @import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-salesforce.lite.scss';

$sparkline-color: #00b78d;
// $sparkline-color: #573585;

.trading-platform.full-screen {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 10px 12px 0 10px;
background-color: white;
z-index: 8000;
position: fixed;
}
.changed-gain {
background-color: #eafae8 !important;
}
.changed-loss {
background-color: #ffeae8 !important;
}
.simulation-form {
margin-bottom: 15px;

input[type=number] {
height: 30px;
width: 50px;
border: 1px solid #c0c0c0;
border-radius: 3px;
}
div.range {
display: contents;
width: 200px;
label.form-label {
margin: 0;
}
input.form-range {
width: 120px;
}
}
.refresh-rate input {
height: 30px;
width: 46px;
}
}
.sparkline {
stroke: $sparkline-color;
// fill: none;
fill: rgba($sparkline-color, 0.03);
}
Loading

0 comments on commit e50434a

Please sign in to comment.