javascript - 这个js复制到一个空的html上,为什么不执行呢?

查看:66
本文介绍了javascript - 这个js复制到一个空的html上,为什么不执行呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

<script type="text/javascript">
    var options = {
        stacked: false,
        gutter:20,
        axis: "0 0 1 1", // Where to put the labels (trbl)
        axisystep: 10 // How many x interval labels to render (axisystep does the same for the y axis)
    };
    
    $(function() {
        // Creates canvas
        var r = Raphael("chartHolder");
        var data = [[10,20,30,50],[15,25,35,50]]
        
        // stacked: false
        var chart1 = r.barchart(40, 10, 320, 220, data, options).hover(function() {
            this.flag = r.popup(this.bar.x, this.bar.y, this.bar.value).insertBefore(this);
        }, function() {
            this.flag.animate({opacity: 0}, 500, ">", function () {this.remove();});
        });
        chart1.label([["A1",  "A2", "A3", "A4"],["B1",  "B2", "B3", "B4"]],true);
        
        
        // stacked: true
        options.stacked=true;
        
        var chart2 = r.barchart(400, 10, 320, 220, data, options).hoverColumn(function() {
            var y = [], res = [];
            for (var i = this.bars.length; i--;) {
                y.push(this.bars[i].y);
                res.push(this.bars[i].value || "0");
            }
            this.flag = r.popup(this.bars[0].x, Math.min.apply(Math, y), res.join(", ")).insertBefore(this);
        }, function() {
            this.flag.animate({opacity: 0}, 500, ">", function () {this.remove();});
        });
        chart2.label([["A"],["B"],["C"],["D"]],true);
    });
</script>

<div id="chartHolder"></div>

这是html页面,为什么用浏览器打开是空白页?

请输入代码

解决方案

Raphael???

这篇关于javascript - 这个js复制到一个空的html上,为什么不执行呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆