-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp%3A%2F%2Fhelp.metaphacts.com%2Fresource%2FSemanticChart.html
336 lines (314 loc) · 11.3 KB
/
http%3A%2F%2Fhelp.metaphacts.com%2Fresource%2FSemanticChart.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<div class="metaphacts_help">
<ol class="breadcrumb" style="background:white;border:none;padding-left:0px;">
<li>
<semantic-link title="Help" uri="http://help.metaphacts.com/resource/Start">Help</semantic-link>
</li>
<li>
<semantic-link title="Documentation" uri="http://help.metaphacts.com/resource/DocumentationOverview">Documentation</semantic-link>
</li>
<li>
<semantic-link title="Components" uri="http://help.metaphacts.com/resource/HTML5Components">Components</semantic-link>
</li>
<li class="active">Chart Component</li>
</ol>
<h1> Chart Component </h1>
<div class="documentation__intro">
<div class="documentation__intro__description">
Powerful widget for rendering line, bar, pie, donut or radar charts.
</div>
<div class="documentation__intro__demo" style="height:400px;">
<semantic-chart type='bar' provider='chartjs' query='
PREFIX person: <http://example.com/person/>
PREFIX org: <http://example.com/org/>
SELECT ?one (COUNT(distinct ?someone) as ?renown) (COUNT(distinct ?org) as ?memberships) WHERE {
{
SELECT * WHERE {
VALUES (?someone ?one)
{
(person:alice person:bob)
(person:alice person:carol)
(person:carol person:bob)
(person:carol person:mike)
(person:mike person:carol)
(person:mike person:alice)
(person:bob person:carol)
(person:bob person:mike)
}
}
}
{
SELECT * WHERE {
VALUES (?one ?org)
{
(person:alice org:W3C)
(person:alice org:IEEE)
(person:alice org:IETF)
(person:carol org:W3C)
(person:mike org:IEEE)
(person:mike org:IETF)
}
}
}
}
GROUP BY ?one
ORDER BY ?one
' sets='[
{"dataSetName": "Renown", "category": "one", "value": "renown"},
{"dataSetName": "Memberships", "category": "one", "value": "memberships"}
]'></semantic-chart>
</div>
</div>
<h2>Recommended Usage</h2>
The chart widget is a simple, yet powerful tool, to visualize trends and relationships between numbers, ratios, or proportions.
As all data is being presented to the user at once, appropriate filtering or aggregation should be applied to limit the amount of data to be displayed.
<h2> Rendering libraries</h2>
Charts can be rendered by two libraries:
<ul>
<li>ChartJS <a href="http://chartjs.org/">chartjs.org</a></li>
<li>Highcharts <a href="http://highcharts.com">highcharts.com</a></li>
</ul>
Data definition is the same among both libraries, but the provisioning of user styles is quite different. However, for the individual libraries the syntax and structure is the same as in the official library documentations (Highcharts 5.x, ChartJS 2.x) .
In any case, default styling is provided for each library and one could omit styling at all.
<div class="alert alert-info">
<strong>Info!</strong><br/>
Please note that Highcharts is a commercial library and requires appropriate licensing.
By default the platform <b>does not include or bundle</b> Highcharts.<br/>
In case you are inquiring for a bundled version including highcharts,
you have to take care of <a href="http://shop.highsoft.com/highcharts.html" target="_blank">licensing highcharts</a>.
</div>
<h3>Limitations</h3>
<ul>
<li>Both libraries will work reasonably fast if the quantity of data is limited based on visual perception limits.</li>
</ul>
<h2>Configuration</h2>
<h2>Examples</h2>
<h3>Sample dataset</h3>
<pre>
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix person: <http://example.com/person/> .
@prefix org: <http://example.com/org/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
person:alice foaf:knows person:bob, person:carol, person:mike ;
foaf:member org:W3C, org:IEEE, org:IETF;
rdfs:label "alice" .
person:carol foaf:knows person:mike ;
foaf:member org:W3C;
rdfs:label "carol" .
person:bob foaf:knows person:carol ;
rdfs:label "bob" .
person:mike foaf:member org:W3C, org:IEEE, org:IETF;
foaf:knows person:carol ;
rdfs:label "mike" .
</pre>
<h3>Simple bar chart</h3>
<div class="documentation__example">
<div class="documentation__example__description"></div>
<div class="documentation__example__demo">
<mp-code-example>
<semantic-chart type='bar' provider='chartjs' query='
PREFIX person: <http://example.com/person/>
PREFIX org: <http://example.com/org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?one (COUNT(distinct ?someone) as ?renown) WHERE {
VALUES (?someone ?predicate1 ?one)
{
(person:alice foaf:knows person:bob)
(person:alice foaf:knows person:carol)
(person:carol foaf:knows person:bob)
(person:carol foaf:knows person:mike)
(person:mike foaf:knows person:carol)
(person:mike foaf:knows person:alice)
(person:bob foaf:knows person:carol)
(person:bob foaf:knows person:mike)
}
}
GROUP BY ?one
ORDER BY ?one
' sets='[{"dataSetName": "Renown", "category": "one", "value": "renown"}]'>
</semantic-chart>
</mp-code-example>
</div>
</div>
<h3>Simple pie chart</h3>
<div class="documentation__example">
<div class="documentation__example__description"></div>
<div class="documentation__example__demo">
<mp-code-example>
<semantic-chart type='pie' provider='chartjs' query='
PREFIX person: <http://example.com/person/>
PREFIX org: <http://example.com/org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?one (COUNT(distinct ?someone) as ?renown) WHERE {
VALUES (?someone ?predicate1 ?one)
{
(person:alice foaf:knows person:bob)
(person:alice foaf:knows person:carol)
(person:carol foaf:knows person:bob)
(person:carol foaf:knows person:mike)
(person:mike foaf:knows person:carol)
(person:mike foaf:knows person:alice)
(person:bob foaf:knows person:carol)
(person:bob foaf:knows person:mike)
}
}
GROUP BY ?one
ORDER BY ?one
' sets='[{"dataSetName": "Renown", "category": "one", "value": "renown"}]'>
</semantic-chart>
</mp-code-example>
</div>
</div>
<h3>Line chart with multiple series</h3>
<div class="documentation__example">
<div class="documentation__example__description"></div>
<div class="documentation__example__demo">
<mp-code-example>
<semantic-chart type='line' provider='chartjs' query='
PREFIX person: <http://example.com/person/>
PREFIX org: <http://example.com/org/>
SELECT ?one (COUNT(distinct ?someone) as ?renown) (COUNT(distinct ?org) as ?memberships) WHERE {
{
SELECT * WHERE {
VALUES (?someone ?one)
{
(person:alice person:bob)
(person:alice person:carol)
(person:carol person:bob)
(person:carol person:mike)
(person:mike person:carol)
(person:mike person:alice)
(person:bob person:carol)
(person:bob person:mike)
}
}
}
{
SELECT * WHERE {
VALUES (?one ?org)
{
(person:alice org:W3C)
(person:alice org:IEEE)
(person:alice org:IETF)
(person:carol org:W3C)
(person:mike org:IEEE)
(person:mike org:IETF)
}
}
}
}
GROUP BY ?one
ORDER BY ?one
' sets='[
{"dataSetName": "Renown", "category": "one", "value": "renown"},
{"dataSetName": "Memberships", "category": "one", "value": "memberships"}
]'>
</semantic-chart>
</mp-code-example>
</div>
</div>
<h3>Pivot example</h3>
<div class="documentation__example">
<div class="documentation__example__description"></div>
<div class="documentation__example__demo">
<mp-code-example>
<semantic-chart type='radar' provider='chartjs' query='
PREFIX person: <http://example.com/person/>
PREFIX org: <http://example.com/org/>
SELECT ?someone ?org ?involvement WHERE {
VALUES (?someone ?org ?involvement)
{
(person:alice org:W3C 0.2)
(person:alice org:IEEE 0.1)
(person:alice org:IETF 0.3)
(person:carol org:W3C 0.8)
(person:carol org:IEEE 0.2)
(person:mike org:IEEE 0.5)
(person:mike org:IETF 0.5)
}
}
ORDER BY ?someone
' multi-data-set='{"dataSetVariable": "someone", "category": "org", "value": "involvement"}'>
</semantic-chart>
</mp-code-example>
</div>
</div>
<h3>Styling example</h3>
<div class="documentation__example">
<div class="documentation__example__description"></div>
<div class="documentation__example__demo">
<mp-code-example>
<semantic-chart type='line' provider='chartjs' query='
PREFIX person: <http://example.com/person/>
PREFIX org: <http://example.com/org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?one (COUNT(distinct ?someone) as ?renown) WHERE {
VALUES (?someone ?predicate1 ?one)
{
(person:alice foaf:knows person:bob)
(person:alice foaf:knows person:carol)
(person:carol foaf:knows person:bob)
(person:carol foaf:knows person:mike)
(person:mike foaf:knows person:carol)
(person:mike foaf:knows person:alice)
(person:bob foaf:knows person:carol)
(person:bob foaf:knows person:mike)
}
}
GROUP BY ?one
ORDER BY ?one
' sets='[{"dataSetName": "Renown", "category": "one", "value": "renown"}]'
styles='[{
"provider": "chartjs",
"style": {
"options": {
"scales": {
"yAxes": [{
"ticks": {
"beginAtZero": false,
"reverse": true
}
}]
},
"elements": {
"line": {"tension": 0}
}
},
"data": {
"datasets": [{
"pointRadius": 10,
"pointHoverRadius": 12,
"pointHitRadius": 12,
"borderColor": "black"
}]
}
}
}]'>
</semantic-chart>
</mp-code-example>
</div>
</div>
<h3>Toggleable Chart Type</h3>
<div class="documentation__example">
<div class="documentation__example__description"></div>
<div class="documentation__example__demo">
<mp-code-example>
<semantic-chart data-type = 'pie' data-provider='chartjs'
data-types='["line", "bar", "radar", "pie", "donut"]'
data-query='
PREFIX semanticPerson: <http://data.semanticweb.org/person/>
SELECT * WHERE {
VALUES (?person ?foafName ?articleCount)
{
(semanticPerson:abraham-bernstein "Abraham Bernstein" 22)
(semanticPerson:bijan-parsia "Bijan Parsia" 35)
(semanticPerson:enrico-motta "Enrico Motta" 22)
(semanticPerson:ian-horrocks "Ian Horrocks" 27)
(semanticPerson:stefan-decker "Stefan Decker" 23)
}
} ORDER BY DESC(?articleCount)'
data-sets='[{"dataSetName": "Articles per person", "category": "person", "value": "articleCount"}]'>
</semantic-chart>
</mp-code-example>
</div>
</div>
</div>