加载中...

k线图


调试运行

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>图形展示</title>
</head>
<body>
 
<div class="detail-section">
    <div id="canvas">
 
    </div>
</div>
 
<script src="http://g.tbcdn.cn/bui/acharts/1.0.32/acharts-min.js"></script>
<!-- https://g.alicdn.com/bui/acharts/1.0.29/acharts-min.js -->
 
 
<script src="http://g.tbcdn.cn/bui/acharts/1.0.32/astock-min.js"></script>
<!-- https://g.alicdn.com/bui/acharts/1.0.29/astock-min.js -->
 
<script src="http://g.tbcdn.cn/fi/bui/jquery-1.8.1.min.js"></script>
 
  <script type="text/javascript">
  //数据格式依次为 ['时间',开盘','最高','最低','收盘']
  var data = [
        [1318597860000,417.78,417.87,417.7,417.81],
        [1318597920000,417.785,417.82,417.7,417.75],
        [1318597980000,417.72,417.82,417.72,417.7915],
        [1318598040000,417.81,417.95,417.79,417.9288],
        [1318598100000,417.93,418.04,417.82,417.97],
        [1318598160000,417.97,418.08,417.881,418.03],
        [1318598220000,418.07,418.15,417.97,418.07],
        [1318598280000,418.05,418.17,417.99,418.12],
        [1318598340000,418.09,418.22,417.95,418.13],
        [1318598400000,418.05,418.06,417.77,417.81],
        [1318598460000,417.81,418.022,417.76,417.964],
        [1318598520000,417.97,418.01,417.8,417.9326],
        [1318598580000,417.9499,417.99,417.83,417.94],
        [1318598640000,417.94,418.01,417.841,417.95],
        [1318598700000,417.969,418,417.86,417.99],
        [1318598760000,417.96,418,417.86,417.92],
        [1318598820000,417.91,417.95,417.87,417.89],
        [1318598880000,417.88,417.929,417.661,417.73],
        [1318598940000,417.74,417.92,417.67,417.67],
        [1318599000000,417.66,417.75,417.61,417.71],
        [1318599060000,417.71,417.86,417.7,417.77],
        [1318599120000,417.79,417.88,417.75,417.875],
        [1318599180000,417.865,417.97,417.86,417.91],
        [1318599240000,417.94,417.964,417.8,417.83],
        [1318599300000,417.9,417.95,417.84,417.9032],
        [1318599360000,417.9,417.95,417.86,417.86],
        [1318599420000,417.88,417.89,417.71,417.849],
        [1318599480000,417.87,417.9,417.75,417.75],
        [1318599540000,417.78,417.88,417.7,417.76],
        [1318599600000,417.78,417.79,417.7,417.73],
        [1318599660000,417.772,417.84,417.76,417.84],
        [1318599720000,417.829,417.94,417.77,417.86],
        [1318599780000,417.887,417.94,417.76,417.92],
        [1318599840000,417.938,418.16,417.9,418.12],
        [1318599900000,418.13,418.3,418.11,418.2],
        [1318599960000,418.229,418.38,418.19,418.38],
        [1318600020000,418.33,418.48,418.26,418.43],
        [1318600080000,418.367,418.53,418.34,418.47],
        [1318600140000,418.4995,418.4995,418.3,418.34],
        [1318600200000,418.34,418.4,418.23,418.26],
        [1318600260000,418.31,418.35,418.23,418.307],
        [1318600320000,418.31,418.32,418.18,418.32],
        [1318600380000,418.34,418.5,418.29,418.5],
        [1318600440000,418.41,418.55,418.36,418.51],
        [1318600500000,418.52,418.8,418.52,418.7888],
        [1318600560000,418.71,418.97,418.67,418.97],
        [1318600620000,418.97,419.15,418.9,419.04],
        [1318600680000,419.1,419.27,418.99,419.16],
        [1318600740000,419.176,419.2274,419.05,419.115],
        [1318600800000,419.1,419.18,418.94,419],
        [1318600860000,418.99,419.25,418.92,419.238],
        [1318600920000,419.2499,419.33,419.12,419.25],
        [1318600980000,419.26,419.33,419.15,419.163],
        [1318601040000,419.16,419.22,419.15,419.151],
        [1318601100000,419.21,419.38,419.15,419.328],
        [1318601160000,419.32,419.45,419.32,419.42],
        [1318601220000,419.4108,419.57,419.39,419.538],
        [1318601280000,419.53,419.57,419.43,419.48],
        [1318601340000,419.471,419.512,419.41,419.42],
        [1318601400000,419.42,419.45,419.28,419.36],
        [1318601460000,419.39,419.39,419.08,419.08],
        [1318601520000,419.14,419.24,419.05,419.159],
        [1318601580000,419.16,419.24,419.1,419.13],
        [1318601640000,419.12,419.122,418.88,418.931],
        [1318601700000,418.92,419.05,418.78,418.79],
        [1318601760000,418.7801,419.07,418.7801,419.03],
        [1318601820000,419.06,419.28,419.05,419.28],
        [1318601880000,419.27,419.36,419.23,419.3],
        [1318601940000,419.33,419.479,419.27,419.458],
        [1318602000000,419.43,419.49,419.4,419.44],
        [1318602060000,419.43,419.54,419.3,419.54],
        [1318602120000,419.52,419.71,419.47,419.67],
        [1318602180000,419.6888,419.71,419.591,419.6],
        [1318602240000,419.63,419.74,419.606,419.67],
        [1318602300000,419.71,419.74,419.59,419.6],
        [1318602360000,419.59,419.67,419.501,419.551],
        [1318602420000,419.55,419.64,419.4,419.6],
        [1318602480000,419.51,419.68,419.49,419.67],
        [1318602540000,419.65,419.68,419.47,419.53],
        [1318602600000,419.54,419.586,419.42,419.42],
        [1318602660000,419.47,419.4901,419.27,419.4356],
        [1318602720000,419.4317,419.444,419.25,419.4099],
        [1318602780000,419.38,419.41,419.23,419.33],
        [1318602840000,419.38,419.45,419.31,419.33],
        [1318602900000,419.345,419.55,419.3,419.55],
        [1318602960000,419.55,419.55,419.35,419.45],
        [1318603020000,419.52,419.67,419.458,419.63],
        [1318603080000,419.65,419.65,419.42,419.506],
        [1318603140000,419.48,419.69,419.4385,419.6112],
        [1318603200000,419.64,419.68,419.54,419.656],
        [1318603260000,419.6,419.72,419.6,419.66],
        [1318603320000,419.71,419.86,419.7,419.83],
        [1318603380000,419.83,419.87,419.65,419.65],
        [1318603440000,419.65,419.8643,419.6418,419.79],
        [1318603500000,419.79,419.85,419.72,419.77],
        [1318603560000,419.7524,419.87,419.74,419.79],
        [1318603620000,419.74,419.85,419.74,419.83],
        [1318603680000,419.83,419.8462,419.75,419.83],
        [1318603740000,419.85,419.93,419.83,419.85],
        [1318603800000,419.85,419.95,419.8,419.94],
        [1318603860000,419.95,420,419.87,419.93],
        [1318603920000,419.9,419.96,419.88,419.94],
        [1318603980000,419.92,420,419.77,419.848],
        [1318604040000,419.87,419.96,419.82,419.88],
        [1318604100000,419.88,419.95,419.83,419.94],
        [1318604160000,419.94,419.95,419.82,419.82],
        [1318604220000,419.84,420.09,419.82,420.02],
        [1318604280000,420.08,420.2,419.86,420.18],
        [1318604340000,420.18,420.28,420.13,420.21],
        [1318604400000,420.21,420.27,419.92,419.98],
        [1318604460000,420.01,420.07,419.84,419.88],
        [1318604520000,419.84,419.92,419.48,419.53],
        [1318604580000,419.53,419.62,419.16,419.37],
        [1318604640000,419.37,419.47,419.31,419.36],
        [1318604700000,419.366,419.68,419.366,419.671],
        [1318604760000,419.66,419.8,419.57,419.71],
        [1318604820000,419.694,419.719,419.61,419.62],
        [1318604880000,419.678,419.77,419.57,419.659],
        [1318604940000,419.64,419.64,419.34,419.3912],
        [1318605000000,419.4,419.55,419.1,419.101],
        [1318605060000,419.12,419.28,419.1,419.12],
        [1318605120000,419.17,419.36,419.12,419.275],
        [1318605180000,419.23,419.49,419.2,419.476],
        [1318605240000,419.46,419.5526,419.21,419.22],
        [1318605300000,419.216,419.3,419.08,419.28],
        [1318605360000,419.27,419.29,418.87,418.9],
        [1318605420000,418.89,418.95,418.64,418.92],
        [1318605480000,418.893,419.2,418.87,419.17],
        [1318605540000,419.189,419.38,419.11,419.28],
        [1318605600000,419.29,419.44,419.2,419.39],
        [1318605660000,419.4199,419.5499,419.3,419.5324],
        [1318605720000,419.5,419.55,419.39,419.41],
        [1318605780000,419.43,419.55,419.32,419.44],
        [1318605840000,419.4476,419.5,419.29,419.5],
        [1318605900000,419.5,419.75,419.48,419.72],
        [1318605960000,419.71,419.71,419.5,419.58],
        [1318606020000,419.552,419.74,419.44,419.71],
        [1318606080000,419.712,420.25,419.69,420.226],
        [1318606140000,420.25,420.5,420.199,420.45],
        [1318606200000,420.47,420.47,420,420.01],
        [1318606260000,420.075,420.48,420.05,420.4412],
        [1318606320000,420.44,420.77,420.39,420.4002],
        [1318606380000,420.45,420.67,420.4,420.49],
        [1318606440000,420.5,420.764,420.48,420.75],
        [1318606500000,420.71,420.77,420.41,420.43],
        [1318606560000,420.43,420.77,420.4,420.44],
        [1318606620000,420.41,420.58,420.4,420.58],
        [1318606680000,420.56,420.63,420.15,420.2],
        [1318606740000,420.15,420.25,420,420.09],
        [1318606800000,420.09,420.15,419.88,420.04],
        [1318606860000,420.04,420.1,419.88,420.07],
        [1318606920000,420.07,420.21,420.02,420.16],
        [1318606980000,420.14,420.31,420.01,420.12],
        [1318607040000,420.12,420.29,420.03,420.15],
        [1318607100000,420.15,420.285,420.05,420.248],
        [1318607160000,420.2588,420.38,420.11,420.2556],
        [1318607220000,420.24,420.45,420.15,420.3601],
        [1318607280000,420.4,420.43,420.15,420.24],
        [1318607340000,420.26,420.319,420.05,420.12],
        [1318607400000,420.13,420.23,420,420.05],
        [1318607460000,420.05,420.29,420,420.27],
        [1318607520000,420.258,420.35,420.17,420.21],
        [1318607580000,420.2,420.35,420.18,420.28],
        [1318607640000,420.3,420.6,420.29,420.5958],
        [1318607700000,420.58,421.14,420.575,421.0975],
        [1318607760000,421.07,421.49,420.7,421.46],
        [1318607820000,421.4601,421.71,421.36,421.69],
        [1318607880000,421.69,421.94,421.663,421.94],
        [1318607940000,421.94,422,421.8241,422]
    ];
        var stock = new AStock({
            theme : AChart.Theme.SmoothBase,
            id : 'canvas',
            width : 950,
            height : 400,
            plotCfg : {
                margin : [10,50,20,70] //画板的边距
            },
            xAxis : {//格式化时间
                type : 'timeCategory' ,
                formatter : function(value)   {
                    return Chart.Date.format(new Date(value),'hh:MM:ss');
                },
                labels : {
                  label : {
                    'font-size': '10'
                  }
                },
                animate : false
            },
            yAxis : [{
                position: 'left',
                grid : {
                    animate : false
                },
                animate : false,
                labels :{
                    label : {
                        fill : '#333',
                        'text-anchor' : 'end',
                        x: -30
                    }
                }
            }],
            xTickCounts : [1,8],//设置x轴tick最小数目和最大数目 
            tooltip : {
                valueSuffix : '¥',
                shared: true,
                crosshairs:true
            },
            series : [{
                type: 'candlestick',
                name: '股票',
                tipNames: ['开盘','最高','最低','收盘'],
                suffix: '元',
                data: data
            }]
        });
        stock.render();
  </script>
 
</body>
</html>

还没有评论.