Skip to content

Commit b896541

Browse files
authored
Merge pull request #921 from nteract/clicktesting-fixes
Various fixes from click-testing
2 parents 4296f1d + af99700 commit b896541

29 files changed

Lines changed: 1244 additions & 587 deletions

docs/public/llms.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272

7373
## Optional
7474

75-
- [Cookbook — Candlestick](/cookbook/candlestick-chart): Financial OHLC charts
7675
- [Cookbook — Radar](/cookbook/radar-plot): Radar/spider charts
7776
- [Cookbook — Timeline](/cookbook/timeline): Timeline visualizations
7877
- [Cookbook — Marginal Graphics](/cookbook/marginal-graphics): Distribution plots in scatter margins

docs/src/App.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ import PushApiPage from "./pages/features/PushApiPage"
9393
import CustomChartsPage from "./pages/features/CustomChartsPage"
9494

9595
// New cookbook pages
96-
import CandlestickCookbookPage from "./pages/cookbook/CandlestickChartPage"
9796
import HomerunMapPage from "./pages/cookbook/HomerunMapPage"
9897
import CanvasInteractionPage from "./pages/cookbook/CanvasInteractionPage"
9998
import UncertaintyVisualizationPage from "./pages/cookbook/UncertaintyVisualizationPage"
@@ -312,7 +311,6 @@ export default function DocsApp() {
312311
</>
313312
}
314313
/>
315-
<Route path="candlestick-chart" element={<CandlestickCookbookPage />} />
316314
<Route path="homerun-map" element={<HomerunMapPage />} />
317315
<Route path="canvas-interaction" element={<CanvasInteractionPage />} />
318316
<Route path="uncertainty-visualization" element={<UncertaintyVisualizationPage />} />

docs/src/IndexPages.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,6 @@ export function ExamplesIndex() {
158158
<div className="subpages">
159159
<div className="sub-header">StreamXYFrame</div>
160160

161-
<PageLink
162-
href="/cookbook/candlestick-chart"
163-
title="Candlestick Chart"
164-
thumbnail={new URL("../public/assets/img/candlestick.png", import.meta.url)}
165-
/>
166161
<PageLink
167162
href="/cookbook/homerun-map"
168163
title="Homerun Map"

docs/src/components/navData.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ const navData = [
136136
title: "Cookbook",
137137
path: "/cookbook",
138138
children: [
139-
{ title: "Candlestick Chart", path: "/cookbook/candlestick-chart" },
140139
{ title: "Homerun Map", path: "/cookbook/homerun-map" },
141140
{ title: "Canvas Interaction", path: "/cookbook/canvas-interaction" },
142141
{ title: "Uncertainty Visualization", path: "/cookbook/uncertainty-visualization" },

docs/src/examples/CandlestickChart.js

Lines changed: 0 additions & 178 deletions
This file was deleted.

docs/src/examples/StreamingMarginalGraphics.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,35 @@ const StreamingMarginalGraphics = () => {
2828
const [containerRef, containerWidth] = useContainerWidth()
2929

3030
useEffect(() => {
31+
// Box-Muller transform: pulls a sample from a standard normal so the
32+
// cloud has a natural Gaussian shape (dense in the middle, thinner
33+
// tails) instead of the boxy uniform-noise look the previous data
34+
// generator produced.
35+
const gauss = () => {
36+
const u = 1 - Math.random()
37+
const v = Math.random()
38+
return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v)
39+
}
3140
const id = setInterval(() => {
32-
if (chartRef.current) {
33-
const i = indexRef.current++
34-
// Simulate a bivariate stream: x drifts with noise, y is correlated + noise
35-
const x = 50 + Math.sin(i * 0.03) * 30 + (Math.random() - 0.5) * 20
36-
const y = x * 0.8 + (Math.random() - 0.5) * 25 + 20
37-
chartRef.current.push({ time: i, x, y })
41+
if (!chartRef.current) return
42+
// Push three samples per tick — at the configured `windowSize` of
43+
// 250 the chart keeps ~80 ticks of history (≈ 4s at the 50ms
44+
// cadence below), enough motion to see the cluster slide while
45+
// still looking like a populated cloud rather than a sparse
46+
// trail.
47+
const i = indexRef.current++
48+
// Cluster mean drifts on a slow sine so the user can see the
49+
// distribution moving while the marginals reshape in lockstep.
50+
const cx = 50 + Math.sin(i * 0.04) * 25
51+
const cy = 50 + Math.sin(i * 0.04 + Math.PI / 3) * 25
52+
for (let k = 0; k < 3; k++) {
53+
const x = cx + gauss() * 8
54+
// Strong positive correlation between x and y, with a small
55+
// independent residual so the cloud has visible spread.
56+
const y = cy + (x - cx) * 0.7 + gauss() * 6
57+
chartRef.current.push({ time: i * 3 + k, x, y })
3858
}
39-
}, 80)
59+
}, 50)
4060
return () => clearInterval(id)
4161
}, [])
4262

@@ -67,7 +87,7 @@ The key is combining \`runtimeMode="streaming"\` with \`marginalGraphics\` on a
6787
size={[containerWidth, 400]}
6888
xAccessor="x"
6989
yAccessor="y"
70-
windowSize={200}
90+
windowSize={250}
7191
pointStyle={() => ({
7292
fill: theme[1],
7393
fillOpacity: 0.7,

0 commit comments

Comments
 (0)