Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions examples/01-basic.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../dist/index.js" type="text/javascript"></script>
<style type="text/css">
body, html { width: 100%; height: 100%; margin: 0; }
#chart { width: 100%; height: 100%; }
#chart { width: 50%; height: 50%; position: absolute; left: 25%; top: 25%; border: 1px solid green; }
</style>
</head>
<body>
<div id="chart"></div>
<script type="text/javascript">
new ChartwerkGaugePod(
new GaugeChartwerkPod(
document.getElementById('chart'),
[{
target: 'basic',
// as far as gauge can render only one value,
// we decide to take "current" value, which is the last
datapoints: [[0, 5], [1, 10], [2, 15], [3, 20], [4, 25]]
datapoints: [[25, 4]]
}],
{
stat: 'current'
valueFormatter: n => n + " %",
curvature: 0.9
}
).render();
</script>
Expand Down
24 changes: 17 additions & 7 deletions examples/02-thresholds.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@
<html>
<head>
<script src="../dist/index.js" type="text/javascript"></script>
<style type="text/css">
body, html { width: 100%; height: 100%; margin: 0; }
#chart { width: 50%; height: 50%; position: absolute; left: 25%; top: 25%; border: 1px solid green; }
</style>
</head>
<body>
<div id="chart" style="width: 500px; height: 500px;"></div>
<div id="chart"></div>
<script type="text/javascript">
var pod = new ChartwerkGaugePod(
var pod = new GaugeChartwerkPod(
document.getElementById('chart'),
[{ target: 'basic', datapoints: [[5, 5], [0, 10], [30, 15], [50, 20], [30, 25]] }],
[
{
target: 'basic', // TODO: remove this
datapoints: [[45, 4]]
}
],
{
thresholds: [
{ value: 0, color: 'green', },
{ value: 30, color: 'yellow' }
]
// TODO: make default palette
thresholds: {
values: [30, 50],
colors: ['green', 'yellow', 'red']
}
}
);
pod.render();
Expand Down
32 changes: 32 additions & 0 deletions examples/03-undefined-value.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="../dist/index.js" type="text/javascript"></script>
<style type="text/css">
body, html { width: 100%; height: 100%; margin: 0; }
#chart { width: 50%; height: 50%; position: absolute; left: 25%; top: 25%; border: 1px solid green; }
</style>
</head>
<body>
<div id="chart"></div>
<script type="text/javascript">
new GaugeChartwerkPod(
document.getElementById('chart'),
[{
target: 'basic',
datapoints: []
}],
{
valueFormatter: (n) => {
if(n === undefined) {
return "Not defined"
}
return n;
},
curvature: 1.0
}
).render();
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "CorpGlory",
"license": "Apache-2.0",
"license": "GPL-3.0-or-later",
"dependencies": {
"@chartwerk/core": "github:chartwerk/core#dist"
"@chartwerk/core": "git+ssh://git@gitlab.corpglory.com:443/chartwerk/core.git#d089b8b27c0d1137de9d7fbeddaabe3e605aba6c"
},
"devDependencies": {
"@types/d3": "^5.7.2",
Expand Down
Loading