所以我使用chart.js创建了一个简单的图表,使用以下代码:
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Chart.js demo</title>
<script src='Chart.min.js'></script>
</head>
<body>
<canvas id="buyers" width="600" height="400"></canvas>
<script>
var buyerData = {
labels : ["January","February","March","April","May","June"],
datasets : [
{
fillColor : "rgba(172,194,132,0.4)",
strokeColor : "#ACC26D",
pointColor : "#fff",
pointStrokeColor : "#9DB86D",
data : [203,156,99,251,305,247]
}
]
}
var buyers = document.getElementById('buyers').getContext('2d');
new Chart(buyers).Line(buyerData);
</script>
</body>
</html>
我想在netsuite中重新创建图形,我相信我遇到的问题是尝试包含chart.js库。我试过去我的脚本,并在“库脚本文件”下添加chart.js文件。我还尝试将其放在我的web hosted files中,然后在代码中添加<script src="http://www.wndauthors.com/Other/Chart.min.js"></script>
,但似乎都没有正常工作。
在套房内重建上述代码的正确方法是什么?
答案 0 :(得分:1)
尝试使用Chart.js
对于库文件我将chart.min上传到文件柜中并在src中给出了你的文件
以下是工作代码段
function demoHTML(request, response)
{
var html = '<html lang="en"><head><title>Chart.js demo</title><script src="https://system.netsuite.com/core/media/media.nl............=.js"></script></head><body>Hi<canvas id="buyers" width="600" height="400"></canvas><script>var buyerData = {labels : ["January","February","March","April","May","June"],datasets : [{fillColor : "rgba(172,194,132,0.4)",strokeColor : "#ACC26D",pointColor : "#fff",pointStrokeColor : "#9DB86D",data : [203,156,99,251,305,247]}]};var buyers = document.getElementById("buyers").getContext("2d");new Chart(buyers).Line(buyerData); </script> </body></html>';
response.write( html );
//prefix header with Custom-Header. See nlobjResponse.setHeader(name, value)
response.setHeader('Custom-Header-Demo', 'Demo');
}
你错过了一个;对于变量buyerData