diff --git a/src/components/dots.js b/src/components/dots.js
index 94acdf2..6af7a83 100644
--- a/src/components/dots.js
+++ b/src/components/dots.js
@@ -1,10 +1,10 @@
// calculate tiles
-export function dots(m, n, max) {
- const ps = [];
+export function make_dots(m, n, cell, max) {
if( m - n === 0 ) {
- return ps;
+ return [];
}
+ const ps = [];
const imin = -max;
const imax = max / m;
for( let i = imin; i <= imax; i++ ) {
diff --git a/src/index.md b/src/index.md
index bf3b72b..a3a984e 100644
--- a/src/index.md
+++ b/src/index.md
@@ -2,70 +2,82 @@
toc: false
---
-
-
${
- resize((width) => Plot.plot({
- title: "Your awesomeness over time 🚀",
- subtitle: "Up and to the right!",
- width,
- y: {grid: true, label: "Awesomeness"},
- marks: [
- Plot.ruleY([0]),
- Plot.lineY(aapl, {x: "Date", y: "Close", tip: true})
- ]
- }))
- }
-
${
- resize((width) => Plot.plot({
- title: "How big are penguins, anyway? 🐧",
- width,
- grid: true,
- x: {label: "Body mass (g)"},
- y: {label: "Flipper length (mm)"},
- color: {legend: true},
- marks: [
- Plot.linearRegressionY(penguins, {x: "body_mass_g", y: "flipper_length_mm", stroke: "species"}),
- Plot.dot(penguins, {x: "body_mass_g", y: "flipper_length_mm", stroke: "species", tip: true})
- ]
- }))
- }
-
+```js
----
+import {make_dots} from './components/dots.js'
-## Next steps
+const CELL = 10;
+const WIDTH = 20;
+const HEIGHT = 20;
-Here are some ideas of things you could try…
+const bg = view(Inputs.color({label: "background", value: d3.color("yellow").formatHex()}))
+const fg1 = view(Inputs.color({label: "fg1", value: d3.color("red").formatHex()}))
+const m1 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"m1"}));
+const n1 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n1"}));
+
+
+const fg2 = view(Inputs.color({label: "fg2", value: d3.color("blue").formatHex()}))
+
+const m2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"m2"}));
+const n2 = view(Inputs.range([1, 5], {value: 2, step: 1, label:"n2"}));
+
+
+```
+
+```js
+
+const dots1 = make_dots(1 / m1, n1, CELL, WIDTH)
+const dots2 = make_dots(1 / m2, n2, CELL, WIDTH)
+
+```
+
+```js
+
+
+const svg = d3.create("svg")
+ .attr("width", WIDTH * CELL * 2)
+ .attr("height", HEIGHT * CELL * 2)
+ .attr("viewBox", [ 0, 0, WIDTH, HEIGHT ])
+ .attr("style", "max-width: 100%; height: auto;");
+
+const background = svg.append("rect")
+ .attr("x", 0)
+ .attr("y", 0)
+ .attr("width", WIDTH * 20)
+ .attr("height", WIDTH * 20)
+ .attr("fill", bg);
+
+const dots_g1 = svg.append("g")
+ .attr("id", "dots1");
+
+dots_g1.selectAll("circle")
+ .data(dots1)
+ .join("circle")
+ .attr("r", 0.2)
+ .attr("fill", fg1)
+ .attr("cx", (d) => d.x)
+ .attr("cy", (d) => d.y);
+
+const dots_g2 = svg.append("g")
+ .attr("id", "dots2");
+
+dots_g2.selectAll("circle")
+ .data(dots2)
+ .join("circle")
+ .attr("r", 0.2)
+ .attr("fill", fg2)
+ .attr("cx", (d) => d.x)
+ .attr("cy", (d) => d.y);
+
+
+
+display(svg.node());
+
+
+```
-
-
-
- Create a
new page by adding a Markdown file (
whatever.md
) to the
src
folder.
-
-
- Add a drop-down menu using
Inputs.select
and use it to filter the data shown in a chart.
-
-
- Write a
data loader that queries a local database or API, generating a data snapshot on build.
-
-
-
-
-