Skip to content

Commit

Permalink
fix marker points too
Browse files Browse the repository at this point in the history
  • Loading branch information
sterlingwes committed Jan 29, 2024
1 parent 3cb803c commit 8788d3a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
44 changes: 22 additions & 22 deletions site/src/lib/server/__snapshots__/timeline.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,8 @@ exports[`timeline datamodel integration 1`] = `
436,
],
"markerPoint": [
10.280012348794722,
228.45156922019999,
10.86481987187927,
229.20674638231648,
],
"markerTooltip": "October 9th 2023",
"postTime": 1696831740000,
Expand All @@ -738,8 +738,8 @@ exports[`timeline datamodel integration 1`] = `
"distanceBefore": 9.714285715592453,
"killedCounts": [],
"markerPoint": [
10.521266610022343,
228.2519248781075,
11.11546909495079,
229.01794405508028,
],
"markerTooltip": "October 9th 2023",
"postTime": 1696836600000,
Expand All @@ -758,8 +758,8 @@ exports[`timeline datamodel integration 1`] = `
765,
],
"markerPoint": [
15.927934376493553,
224.98591547475183,
16.303088968360747,
225.3061116532412,
],
"markerTooltip": "October 10th 2023",
"postTime": 1696935434000,
Expand All @@ -780,8 +780,8 @@ exports[`timeline datamodel integration 1`] = `
1203,
],
"markerPoint": [
22.912860684430314,
217.5453029834417,
25.12475742248997,
220.18339294764647,
],
"markerTooltip": "October 12th 2023",
"postTime": 1697097120000,
Expand All @@ -800,8 +800,8 @@ exports[`timeline datamodel integration 1`] = `
1709,
],
"markerPoint": [
27.126907894039554,
213.9368230442184,
28.820640796673512,
215.90171638451963,
],
"markerTooltip": "October 13th 2023",
"postTime": 1697184720000,
Expand Down Expand Up @@ -836,8 +836,8 @@ exports[`timeline datamodel integration 1`] = `
4651,
],
"markerPoint": [
62.97501855083281,
177.5525941442425,
70.35648091519003,
185.03369796669548,
],
"markerTooltip": "October 22nd 2023",
"postTime": 1697994240000,
Expand Down Expand Up @@ -874,8 +874,8 @@ exports[`timeline datamodel integration 1`] = `
8805,
],
"markerPoint": [
105.6632984895152,
146.53557344575486,
106.32519408831709,
146.83290455908633,
],
"markerTooltip": "November 1st 2023",
"postTime": 1698819405000,
Expand All @@ -898,8 +898,8 @@ exports[`timeline datamodel integration 1`] = `
9488,
],
"markerPoint": [
121.5793210856571,
136.9869378796796,
122.54718699503644,
137.30848681598366,
],
"markerTooltip": "November 4th 2023",
"postTime": 1699111108000,
Expand All @@ -914,8 +914,8 @@ exports[`timeline datamodel integration 1`] = `
"distanceBefore": 132.35986012003764,
"killedCounts": [],
"markerPoint": [
121.83444977154596,
136.95421017224908,
122.7823506438893,
137.20295793230434,
],
"markerTooltip": "November 4th 2023",
"postTime": 1699115100000,
Expand All @@ -940,8 +940,8 @@ exports[`timeline datamodel integration 1`] = `
10569,
],
"markerPoint": [
141.02032101551592,
129.132222097083,
141.9598629138591,
126.81744444458798,
],
"markerTooltip": "November 8th 2023",
"postTime": 1699453500000,
Expand Down Expand Up @@ -1036,8 +1036,8 @@ exports[`timeline datamodel integration 1`] = `
19235,
],
"markerPoint": [
325.3320740188269,
31.97865096096632,
325.2340696631509,
32.299674011957876,
],
"markerTooltip": "December 17th 2023",
"postTime": 1702817520000,
Expand Down
6 changes: 4 additions & 2 deletions site/src/lib/server/svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import pathPoint from "point-at-length";
import generatedData from "../../generated/data.json";

export const getSvgDomain = () => {
const { pathData, svgViewbox } = generatedData;
const getData = () => generatedData;

export const getSvgDomain = (dataFetcher = getData) => {
const { pathData, svgViewbox } = dataFetcher();
const aspectRatio = svgViewbox.width / svgViewbox.height;

const pathPoints = pathPoint(pathData);
Expand Down
2 changes: 1 addition & 1 deletion site/src/lib/server/timeline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test("timeline datamodel integration", () => {
const posts = getEnhancedPosts(
require("../../content/enabler/talbroda.json").posts
);
const svgDomain = getSvgDomain();
const svgDomain = getSvgDomain(() => dataFixture);
const timeline = getTimeline({
svgDomain,
posts,
Expand Down

0 comments on commit 8788d3a

Please sign in to comment.