highcharts / lucky.html
changxin's picture
Update lucky.html
eed43f6
<html>
<head>
<title>吹牛逼</title>
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/pluginsCss.css" />
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/plugins.css" />
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/luckysheet.css" />
<link rel="stylesheet" href="https://huggingface.co/spaces/changxin/highcharts/raw/main/iconfont.css" />
<script src="https://huggingface.co/spaces/changxin/highcharts/raw/main/plugin.js"></script>
<script src="https://huggingface.co/spaces/changxin/highcharts/raw/main/luckysheet.umd.js"></script>
<script>
$(function () {
var options = {
container: "pq",
title: "畅心测试",
lang: "zh",
myFolderUrl: "https://pbihub.cn/users/44",
userInfo: {userName:"畅心"},
data: [{"name":"吹水","index":0,"status":1,"order":0,"color":"#ff0066","row":18,"column":12,"celldata":luckysheet.transToCellData([["维度表","度量值名称","表达式"],])}]
}
luckysheet.create(options)
})
</script>
</head>
<body>
<div id="md" style="position: absolute;z-index: 1000000;left: 0px;top: 0px;bottom: 0px;right: 0px; background: rgba(255, 255, 255, 0.8); text-align: center;font-size: 40px;align-items:center;justify-content: center;display: none;">Downloading</div>
<p style="text-align:center;"> <input style="font-size:16px;" type="file" id="test" name="test" change="demoHandler" /></p>
<div id="pq" style="margin:0px;padding:0px;position:absolute;width:100%;left: 0px;top: 50px;bottom: 0px;outline: none;"></div>
<script src="luckyexcel.umd.js"></script>
<script>
function demoHandler(){
let upload = document.getElementById("test");
let mask = document.getElementById("md");
if(upload){
window.onload = () => {
upload.addEventListener("change", function(evt){
var files = evt.target.files;
if(files==null || files.length==0){alert("没有待加载文件!");return;}
let name = files[0].name;
let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
if(suffix!="xlsx"){alert("目前只支持xlsx文档导入!");return;}
LuckyExcel.transformExcelToLucky(files[0], function(exportJson, luckysheetfile){
if(exportJson.sheets==null || exportJson.sheets.length==0){alert("读取失败, 目前不支持xls文件!");return;}
console.log(exportJson, luckysheetfile);
window.luckysheet.destroy();
window.luckysheet.create({
container: 'pq',
showinfobar:false,
data:exportJson.sheets,
title:exportJson.info.name,
userInfo:exportJson.info.name.creator
});
});
});
}
}
}
demoHandler();
</script>
</body>
</html>