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 > # < 👋 Hello World >
<link rel="me" href="https://mastodon.squarecows.com/@Ric"> <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 ## test chart
<canvas id="myChart" style="width:100%;max-width:700px"></canvas> <div id="vis"></div>
<script> <script type="text/javascript">
const xValues = ["Italy", "France", "Spain", "USA", "Argentina"]; var yourVlSpec = {
const yValues = [55, 49, 44, 24, 15]; $schema: 'https://vega.github.io/schema/vega-lite/v5.json',
const barColors = ["red", "green","blue","orange","brown"]; description: 'A simple bar chart with embedded data.',
new Chart("myChart", {
type: "bar",
data: { data: {
labels: xValues, values: [
datasets: [{ {a: 'A', b: 28},
backgroundColor: barColors, {a: 'B', b: 55},
data: yValues {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> </script>
## Contact ## Contact