ant-kline
Version:
对kline.js的自定义修改
90 lines (81 loc) • 2.4 kB
HTML
<html>
<head>
<title>K线图</title>
<link href="/src/css/main.css" rel="stylesheet"/>
<script src="../lib/require.js"></script>
<style type="text/css">
.kline {
width: 100%;
margin-left: auto;
margin-right: auto;
height: 462px;
position: relative;
}
</style>
</head>
<body>
<div class="kline">
<h1>K线图</h1>
<div style="display: flex;width: 100%">
<div style="width: 200px"></div>
<div>
<div id="kline_container"></div>
</div>
</div>
</div>
<script type="text/javascript">
require.config({
paths : {
"jquery" : "../lib/jquery",
"jquery.mousewheel" : "../lib/jquery.mousewheel",
"sockjs" : "../lib/sockjs",
"stomp" : "../lib/stomp",
"kline" : "../dist/kline"
},
shim : {
"jquery.mousewheel" : {
deps : [ "jquery" ]
},
"kline" : {
deps : [ "jquery.mousewheel", "sockjs", "stomp" ]
}
}
});
require([ 'kline' ], function () {
var kline = new Kline({
element : "#kline_container",
width : 0,
height : 650,
theme : 'dark', // light/dark
language : 'zh-cn', // zh-cn/en-us/zh-tw
ranges : [ "1w", "1d", "1h", "30m", "15m", "5m", "1m", "line" ],
symbol : "BTC",
symbolName : "BTC/USD",
type : "poll", // poll/socket
url : "http://t.001.gs/api/kline/get_backtest_kline?backtest_id=5bfb6ed48619bd42403bc4b4&limit=10000",
limit : 10000,
intervalTime : 5000,
debug : true,
showTrade : true,
showTradeLog : true,
onRangeChange : function (range) {
// window.data = []
// console.log('1')
// if (!window.range) {
// window.range = range
// // console.log(range)
// }
// kline.resend()
// if (window.range > range) {
// kline.resend()
// }
// kline.redraw()
// kline.draw();
}
});
kline.draw();
});
</script>
</body>
</html>