RGraph : svg : 玫瑰图

www.rgraph.net 下载 RGraph.minified-2018-08-14.zip
解压后,将目录 libraries 简化为: lib
rose图例子: RGraph/svg_rose1.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>RGraph : SVG rose charts API </title>
<script src="./lib/RGraph.svg.common.core.js"></script>
<script src="./lib/RGraph.svg.common.key.js"></script>
<script src="./lib/RGraph.svg.common.tooltips.js"></script>
<script src="./lib/RGraph.svg.rose.js"></script>
</head>
<body>
<div style="width: 500px; height: 500px" id="chart-container"></div>
<div id="tab"></div>
<script>
var keys = ['周一','周二','周三','周四','周五','周六','周日'];
var data = [8,6,4,3,8,6,3];
var tips = ['Alf','Bertie','Charlie','Doug','Edgar','Frankie','Gary'];
var colors = ['blue','green','red','#aaa','black','brown','pink'];

var rose = new RGraph.SVG.Rose({
id: 'chart-container',
data: data,
options: {
tooltips: tips,
colors: colors,
colorsSequential: true,
//backgroundGridRadialsCount: 0,
linewidth: 2,
margin: '3deg',
key: keys,
keyOffsety: 455
}
}).draw().on('tooltip', function (obj)
{
var tooltip = RGraph.SVG.REG.get('tooltip');
var colors = rose.properties.colors;

tooltip.style.border = '4px solid ' + colors[tooltip.__index__]
});

RGraph.SVG.tooltips.style.backgroundColor = 'white';
RGraph.SVG.tooltips.style.color = 'black';
RGraph.SVG.tooltips.style.fontWeight = 'bold';
RGraph.SVG.tooltips.style.boxShadow = 'none';
// create table
var table = document.createElement("table");
table.border = "1"; // table.width = "100%";
var tb = document.createElement("tbody");
table.appendChild(tb);
var tr,td;
tr = tb.insertRow(0); // 创建第一行
for(var j=0; j<keys.length; j++){
td = tr.insertCell(tr.cells.length);
td.innerHTML = keys[j];
td.align = "center";
}
tr = tb.insertRow(tb.rows.length); // 创建一行
for(var j=0; j<tips.length; j++){
td = tr.insertCell(tr.cells.length);
td.innerHTML = tips[j];
td.align = "center";
}
tr = tb.insertRow(tb.rows.length); // 创建一行
for(var j=0; j<data.length; j++){
td = tr.insertCell(tr.cells.length);
td.innerHTML = data[j];
td.align = "center";
}
document.querySelector("#tab").appendChild(table);
</script>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值