Home > Web Front-end > H5 Tutorial > body text

HTML5的互动股票图形数据HumbleFinance

PHP中文网
Release: 2017-03-30 16:01:18
Original
2973 people have browsed it

HTML5的互动股票图形数据HumbleFinance。它是类似的股票软件在线显示。它完全用JavaScript编写,使用Prototype和Flotr库。它可用于显示任何两个2D的数据集的真实的数值数据共享的轴线。为了获得最佳效果使用FireFox, Chrome, or Safari。

1092.jpg

HTML

<p id="finance">
    <p id="labels">
        <p id="financeTitle">NASDAQ:GOOG</p>
        <p id="time"> 
        <a onclick="HumbleFinance.zoom(5);">1w</a>  
        <a onclick="HumbleFinance.zoom(21);">1m</a>
            <a
            onclick="HumbleFinance.zoom(65);">3m</a> 
            <a onclick="HumbleFinance.zoom(127);">6m</a>  
            <a onclick="HumbleFinance.zoom(254);">1y</a>
                <a
                onclick="HumbleFinance.zoom(1265);">5y</a>
        </p>
        <p id="dateRange"></p>
    </p>
</p>
Copy after login

JS

Event.observe(document, &#39;dom:loaded&#39;, function () {
    prettyPrint();
    HumbleFinance.trackFormatter = function (obj) {
        var x = Math.floor(obj.x);
        var data = jsonData[x];
        var text = data.date + " Price: " + data.close + " Vol: " + data.volume;
        return text;
    };
    HumbleFinance.yTickFormatter = function (n) {
        if (n == this.axes.y.max) {
            return false;
        }
        return &#39;$&#39; + n;
    };
    HumbleFinance.xTickFormatter = function (n) {
        if (n == 0) {
            return false;
        }
        var date = jsonData[n].date;
        date = date.split(&#39; &#39;);
        date = date[2];
        return date;
    }
    HumbleFinance.init(&#39;finance&#39;, priceData, volumeData, summaryData);
    HumbleFinance.setFlags(flagData);
    var xaxis = HumbleFinance.graphs.summary.axes.x;
    var prevSelection = HumbleFinance.graphs.summary.prevSelection;
    var xmin = xaxis.p2d(prevSelection.first.x);
    var xmax = xaxis.p2d(prevSelection.second.x);
    $(&#39;dateRange&#39;).update(jsonData[xmin].date + &#39; - &#39; + jsonData[xmax].date);
    Event.observe(HumbleFinance.containers.summary, &#39;flotr:select&#39;, function (e) {
        var area = e.memo[0];
        xmin = Math.floor(area.x1);
        xmax = Math.ceil(area.x2);
        var date1 = jsonData[xmin].date;
        var date2 = jsonData[xmax].date;
        $(&#39;dateRange&#39;).update(jsonData[xmin].date + &#39; - &#39; + jsonData[xmax].date);
    });
});
Copy after login


以上就是HTML5的互动股票图形数据HumbleFinance的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template