Update README.md

This commit is contained in:
Ric Harvey 2024-11-13 22:33:35 +00:00
parent d011c77dfd
commit 554e54fc3c

View file

@ -1,4 +1,8 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vega@5.30.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5.21.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6.26.0"></script>
# < 👋 Hello World >
<link rel="me" href="https://mastodon.squarecows.com/@Ric">
@ -6,27 +10,34 @@ Hi everyone and welcome to my profile, I'm Richard Harvey (or you can call me Ri
## test chart
<canvas id="myChart" style="width:100%;max-width:700px"></canvas>
<div id="vis"></div>
<script>
const xValues = ["Italy", "France", "Spain", "USA", "Argentina"];
const yValues = [55, 49, 44, 24, 15];
const barColors = ["red", "green","blue","orange","brown"];
new Chart("myChart", {
type: "bar",
<script type="text/javascript">
var yourVlSpec = {
$schema: 'https://vega.github.io/schema/vega-lite/v5.json',
description: 'A simple bar chart with embedded data.',
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
values: [
{a: 'A', b: 28},
{a: 'B', b: 55},
{a: 'C', b: 43},
{a: 'D', b: 91},
{a: 'E', b: 81},
{a: 'F', b: 53},
{a: 'G', b: 19},
{a: 'H', b: 87},
{a: 'I', b: 52}
]
},
options: {...}
});
mark: 'bar',
encoding: {
x: {field: 'a', type: 'ordinal'},
y: {field: 'b', type: 'quantitative'}
}
};
vegaEmbed('#vis', yourVlSpec);
</script>
## Contact