svelte-plots-basic 2.2.2 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svelte-plots-basic",
3
3
  "description": "Svelte components for creating simple plots",
4
- "version": "2.2.2",
4
+ "version": "2.2.4",
5
5
  "author": "Sergey Kucheryavskiy",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -293,8 +293,8 @@
293
293
  left = xLabel && xLabel !== '' ? m : 0;
294
294
  bottom = yLabel && yLabel !== '' ? m : 0;
295
295
  top = title && title !== '' ? m : 0;
296
- width = pcr.width - left;
297
- height = pcr.height - bottom - top;
296
+ width = pcr.width > left ? pcr.width - left : 0;
297
+ height = pcr.height > (bottom + top) ? pcr.height - bottom - top : 0;
298
298
  }
299
299
  });
300
300
 
@@ -320,15 +320,15 @@
320
320
  <g style={lblStyleStr}>
321
321
  <!-- y-axis label -->
322
322
  {#if yLabel && yLabel !== ''}
323
- <text x={0} y={(height + top) /2} dx={0} dy={0} transform={`rotate(-90, 10, ${height/2})`} style="font-size:1.1em;">{@html yLabel}</text>
323
+ <text x={0} y={(height + top) /2} dx={0} dy={0} dominant-baseline="top" transform={`rotate(-90, 10, ${height/2})`} style="font-size:1.1em;">{@html yLabel}</text>
324
324
  {/if}
325
325
  <!-- x-axis label -->
326
326
  {#if xLabel && xLabel !== ''}
327
- <text x={left + width/2 } y={height + top} dx={0} dy={5} alignment-baseline="hanging" style="font-size:1.1em;">{@html xLabel}</text>
327
+ <text x={left + width/2 } y={height + top} dx={0} dy={5} dominant-baseline="middle" style="font-size:1.1em;">{@html xLabel}</text>
328
328
  {/if}
329
329
  <!-- plot title -->
330
330
  {#if title && title !== ''}
331
- <text x={left + width/2 } y={0} dx={0} dy={10} alignment-baseline="hanging" style="font-size:1.2em;">{@html title}</text>
331
+ <text x={left + width/2 } y={0} dx={0} dy={10} dominant-baseline="hanging" style="font-size:1.2em;">{@html title}</text>
332
332
  {/if}
333
333
  </g>
334
334