mirror of
https://github.com/tradingview/lightweight-charts.git
synced 2024-11-25 16:50:59 +08:00
Added debug page
This commit is contained in:
parent
42e5d8227f
commit
eec8bcfef3
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,6 +3,8 @@ node_modules/
|
||||
npm-debug.log*
|
||||
package-lock.json
|
||||
|
||||
debug.html
|
||||
|
||||
# python
|
||||
*.pyc
|
||||
|
||||
|
@ -24,4 +24,7 @@ To bundle production builds (minified) too just set the `NODE_ENV` variable to `
|
||||
|
||||
## Tips
|
||||
|
||||
To make sure that your local copy passed all (almost) checks, you can use the `verify` npm script: `npm run verify`.
|
||||
- To make sure that your local copy passed all (almost) checks, you can use the `verify` npm script: `npm run verify`.
|
||||
- If you want to play with locally built package, you can create a `debug.html` page: `cp debug.html.example debug.html`.
|
||||
|
||||
This file (`debug.html`) is under gitignore, so you don't need to worry about changing it and you can modify it as you wish.
|
||||
|
44
debug.html.example
Normal file
44
debug.html.example
Normal file
@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
|
||||
<title>Debug page</title>
|
||||
|
||||
<script type="text/javascript" src="./dist/lightweight-charts.standalone.development.js"></script>
|
||||
</head>
|
||||
|
||||
<body style="padding: 0; margin: 0;">
|
||||
<div id="container" style="position: absolute; width: 100%; height: 100%;"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function generateData() {
|
||||
var res = [];
|
||||
var time = new Date(Date.UTC(2018, 0, 1, 0, 0, 0, 0));
|
||||
for (var i = 0; i < 500; ++i) {
|
||||
res.push({
|
||||
time: time.getTime() / 1000,
|
||||
value: i,
|
||||
});
|
||||
|
||||
time.setUTCDate(time.getUTCDate() + 1);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
var chart = LightweightCharts.createChart(document.getElementById('container'));
|
||||
|
||||
var mainSeries = chart.addLineSeries({
|
||||
priceFormat: {
|
||||
minMove: 1,
|
||||
precision: 0,
|
||||
},
|
||||
});
|
||||
|
||||
mainSeries.setData(generateData());
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user