thibaud frere commited on
Commit
e063015
·
1 Parent(s): 4facc12

fix charts, update html embed and responsive image description background, fix pdf generation

Browse files
app/package.json CHANGED
Binary files a/app/package.json and b/app/package.json differ
 
app/src/components/HtmlEmbed.astro CHANGED
@@ -75,7 +75,13 @@ const mountId = `frag-${Math.random().toString(36).slice(2)}`;
75
  font-weight: 600;
76
  font-size: 0.95rem;
77
  color: var(--text-color);
78
- margin: 0 0 6px 0;
 
 
 
 
 
 
79
  }
80
  .html-embed__card {
81
  background: var(--code-bg);
@@ -92,7 +98,13 @@ const mountId = `frag-${Math.random().toString(36).slice(2)}`;
92
  text-align: left;
93
  font-size: 0.9rem;
94
  color: var(--muted-color);
95
- margin: 6px 0 0 0;
 
 
 
 
 
 
96
  }
97
  /* Plotly – fragments & controls */
98
  .html-embed__card svg text { fill: var(--text-color) !important; }
 
75
  font-weight: 600;
76
  font-size: 0.95rem;
77
  color: var(--text-color);
78
+ margin: 0;
79
+ padding: var(--spacing-1);
80
+ background: var(--page-bg);
81
+ position: relative;
82
+ z-index: var(--z-elevated);
83
+ display: block;
84
+ width: 100%;
85
  }
86
  .html-embed__card {
87
  background: var(--code-bg);
 
98
  text-align: left;
99
  font-size: 0.9rem;
100
  color: var(--muted-color);
101
+ margin: 0;
102
+ padding: var(--spacing-1);
103
+ background: var(--page-bg);
104
+ position: relative;
105
+ z-index: var(--z-elevated);
106
+ display: block;
107
+ width: 100%;
108
  }
109
  /* Plotly – fragments & controls */
110
  .html-embed__card svg text { fill: var(--text-color) !important; }
app/src/components/ResponsiveImage.astro CHANGED
@@ -169,6 +169,7 @@ const dataDownloadable = (downloadable === true || (imgProps as any)['data-downl
169
 
170
  figure { margin: var(--block-spacing-y) 0; }
171
  figcaption { text-align: left; font-size: 0.9rem; color: var(--muted-color); margin-top: 6px; }
 
172
  .image-credit { display: block; margin-top: 4px; font-size: 12px; color: var(--muted-color); }
173
  .image-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
174
 
 
169
 
170
  figure { margin: var(--block-spacing-y) 0; }
171
  figcaption { text-align: left; font-size: 0.9rem; color: var(--muted-color); margin-top: 6px; }
172
+ figcaption { background: var(--page-bg); position: relative; z-index: var(--z-elevated); display: block; width: 100%; }
173
  .image-credit { display: block; margin-top: 4px; font-size: 12px; color: var(--muted-color); }
174
  .image-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
175
 
app/src/content/embeds/against-baselines-deduplicated.html CHANGED
@@ -171,6 +171,10 @@
171
 
172
  // Add marker definitions for different shapes
173
  const defs = svg.append('defs');
 
 
 
 
174
 
175
  // Academic marker shapes
176
  const markerShapes = ['circle', 'square', 'triangle', 'diamond', 'inverted-triangle'];
@@ -183,6 +187,10 @@
183
  const gAreas = gRoot.append('g').attr('class', 'areas');
184
  const gLines = gRoot.append('g').attr('class', 'lines');
185
  const gPoints = gRoot.append('g').attr('class', 'points');
 
 
 
 
186
  const gHover = gRoot.append('g').attr('class', 'hover');
187
  const gLegend = gRoot.append('foreignObject').attr('class', 'legend');
188
 
@@ -310,6 +318,9 @@
310
  const innerHeight = height - margin.top - margin.bottom;
311
  gRoot.attr('transform', `translate(${margin.left},${margin.top})`);
312
 
 
 
 
313
  xScale.range([0, innerWidth]);
314
  yScale.range([innerHeight, 0]);
315
 
 
171
 
172
  // Add marker definitions for different shapes
173
  const defs = svg.append('defs');
174
+ // Clip-path to constrain drawing to chart area
175
+ const clipId = `clip-${Math.random().toString(36).slice(2)}`;
176
+ const clipPath = defs.append('clipPath').attr('id', clipId);
177
+ const clipRect = clipPath.append('rect').attr('x', 0).attr('y', 0).attr('width', 0).attr('height', 0);
178
 
179
  // Academic marker shapes
180
  const markerShapes = ['circle', 'square', 'triangle', 'diamond', 'inverted-triangle'];
 
187
  const gAreas = gRoot.append('g').attr('class', 'areas');
188
  const gLines = gRoot.append('g').attr('class', 'lines');
189
  const gPoints = gRoot.append('g').attr('class', 'points');
190
+ // Apply clipping to plotted elements (areas, lines, points)
191
+ gAreas.attr('clip-path', `url(#${clipId})`);
192
+ gLines.attr('clip-path', `url(#${clipId})`);
193
+ gPoints.attr('clip-path', `url(#${clipId})`);
194
  const gHover = gRoot.append('g').attr('class', 'hover');
195
  const gLegend = gRoot.append('foreignObject').attr('class', 'legend');
196
 
 
318
  const innerHeight = height - margin.top - margin.bottom;
319
  gRoot.attr('transform', `translate(${margin.left},${margin.top})`);
320
 
321
+ // Update clip rect to match inner plotting area
322
+ clipRect.attr('width', innerWidth).attr('height', innerHeight);
323
+
324
  xScale.range([0, innerWidth]);
325
  yScale.range([innerHeight, 0]);
326