raphael生成柱状图时横坐标显示文字说明
2014-12-09 21:32
423 查看
代码如下:
注:如果效果没有显示出来,并且报labeiles not function错,重新替换g.bar.js,下载地址 https://github.com/jhurt/g.raphael/blob/master/g.bar.js,OK。
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="demo.css" media="screen"> <link rel="stylesheet" href="demo-print.css" media="print"> <script src="raphael.js"></script> <script src="g.raphael.js"></script> <script src="g.bar.js"></script> <script> window.onload = function () { var r = Raphael("holder"), fin = function () { this.flag = r.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this); }, fout = function () { this.flag.animate({opacity: 0}, 300, function () {this.remove();}); }, fin2 = 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); }, fout2 = function () { this.flag.animate({opacity: 0}, 300, function () {this.remove();}); }, txtattr = { font: "12px sans-serif" }; r.text(160, 10, "单系列").attr(txtattr); // r.text(480, 10, "多系列堆叠").attr(txtattr); // r.text(160, 250, "多系列").attr(txtattr); // r.text(480, 250, "多系列堆叠").attr(txtattr); // var c = r.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]]).hover(fin, fout); r.barchart(10, 10, 550, 300, [ [5.5, 2.0, 7.6, 9.5] ]).hover(fin, fout)<span style="color:#FF0000;"><span style="color:#FF0000;">.<strong>label([['星期一','星期二','星期三','星期四']],true</strong>)</span></span>; // r.hbarchart(330, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], {stacked: true}).hover(fin, fout); // r.hbarchart(10, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]]).hover(fin, fout); // var c = r.barchart(330, 250, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], {stacked: true, type: "soft"}).hoverColumn(fin2, fout2); // c.label([["Uno", "Dos", "Tres", "Cuatro", "Cinco", "Seis", "Siete", "Ocho"]],true); }; </script> </head> <body class="raphael" > <div id="holder"></div> </body> </html>加粗的部分是添加label显示文本的代码,效果图如下:
注:如果效果没有显示出来,并且报labeiles not function错,重新替换g.bar.js,下载地址 https://github.com/jhurt/g.raphael/blob/master/g.bar.js,OK。
相关文章推荐
- oracle 生成带有说明文字的sql脚本
- ListView控件显示 图片加文字说明 并且可以对滚动条进行控制
- highcharts坐标轴中显示文字
- linux生成文字变成小框框,无法正常显示汉字
- linux生成文字变成小框框,无法正常显示汉字
- java5 unix/linux 中文字体配置说明 (jfreechart 图片生成后中文显示为“口”)
- visual studio 2015中的webapi生成helpPage,页面不显示方法说明问题解决
- JAVAWEB 生成excel文字在一格显示两位不变成#号
- PowerDesigner从数据库中反向生成PDM,Name不显示字段说明的解决方法
- linux生成文字变成小框框,无法正常显示汉字
- 将图片的说明文字显示在图片之上且背景半透明效果
- 感应鼠标滑过图片弹出层显示文字说明
- 鼠标悬停在图片上时,显示遮罩层说明文字
- Raphael绘制中国地图实现点击哪儿在哪儿显示柱状图
- php中文验证码不显示文字的原因-终端下可正常生成图片,在浏览器中没有文字只有底图
- 【JAVA】使用jacob生成的html,关于文字乱码处理,图片无法显示等问题。
- itextsharp 生成 pdf 文字之显示不出 。不兼容 解决办法
- opencv学习笔记11 在图片中添加文字,点击鼠标显示位置坐标
- 使用API,手工生成 Windows应用程序全过程(图解+文字说明)
- linux生成文字变成小框框,无法正常显示汉字