当我sgvizler.visualization.Table
使用 Sgvizler 0.6 创建一个并且 SPARQL 查询没有结果时,Sgvizler 不绘制任何内容,甚至不绘制表头。这可能会使用户感到困惑,他们可能认为结果仍在计算中或脚本已崩溃。即使结果为空,如何配置 Sgvizler 以绘制表头?
最小工作示例
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://mgskjaeveland.github.io/sgvizler/v/0.6/sgvizler.js"></script>
<script>
sgvizler
.defaultEndpointURL("https://dbpedia.org/sparql")
.defaultChartFunction("sgvizler.visualization.Table")
.defaultChartWidth(1000);
$(document).ready(function (){ sgvizler.containerDrawAll(); });
</script>
</head>
<body>
<h2>First Table</h2>
<div id="results"
data-sgvizler-query="
select distinct ?class
{
?class rdfs:subClassOf dbo:Animal.
}
">
</div>
<h2>Second Table</h2>
<div id="noresults"
data-sgvizler-query="
select distinct ?class
{
?class rdfs:subClassOf dbo:Unicorn.
}
">
</div>
</body>
</html>