vizmatic 0.1.39 → 0.1.40

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/dist/cli.js CHANGED
@@ -5781,6 +5781,11 @@ function LineChart({
5781
5781
 
5782
5782
  // src/primitives/plots.ts
5783
5783
  import React9 from "react";
5784
+ function xTickLabelAlign(index, count) {
5785
+ if (index === 0) return "left";
5786
+ if (index === count - 1) return "right";
5787
+ return "center";
5788
+ }
5784
5789
  function ScatterPlot({
5785
5790
  points,
5786
5791
  c,
@@ -5867,9 +5872,12 @@ function ScatterPlot({
5867
5872
  })
5868
5873
  )
5869
5874
  ),
5870
- ...xTicks.map((tick) => {
5875
+ ...xTicks.map((tick, index) => {
5871
5876
  const x = xInPlot(tick, xDomain, plot);
5872
- return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 44 });
5877
+ return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
5878
+ align: xTickLabelAlign(index, xTicks.length),
5879
+ width: 44
5880
+ });
5873
5881
  }),
5874
5882
  ...yTicks.map((tick) => {
5875
5883
  const y = yInPlot(tick, yDomain, plot);
@@ -6078,9 +6086,12 @@ function ParetoChart({
6078
6086
  strokeWidth: isFrontier ? 3 : 2
6079
6087
  }))
6080
6088
  ),
6081
- ...xTicks.map((tick) => {
6089
+ ...xTicks.map((tick, index) => {
6082
6090
  const x = pointFor(tick, yDomain.min).x;
6083
- return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 52 });
6091
+ return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6092
+ align: xTickLabelAlign(index, xTicks.length),
6093
+ width: 52
6094
+ });
6084
6095
  }),
6085
6096
  ...yTicks.map((tick) => {
6086
6097
  const y = yInPlot(tick, yDomain, plot);
@@ -6303,9 +6314,12 @@ function QuadrantChart({
6303
6314
  })] : []
6304
6315
  ];
6305
6316
  }),
6306
- ...(showTicks ? xTicks : []).map((tick) => {
6317
+ ...(showTicks ? xTicks : []).map((tick, index) => {
6307
6318
  const x = xInPlot(tick, xDomain, plot);
6308
- return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 54 });
6319
+ return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6320
+ align: xTickLabelAlign(index, xTicks.length),
6321
+ width: 54
6322
+ });
6309
6323
  }),
6310
6324
  ...(showTicks ? yTicks : []).map((tick) => {
6311
6325
  const y = yInPlot(tick, yDomain, plot);
@@ -6399,9 +6413,12 @@ function IntervalPlot({
6399
6413
  React9.createElement("circle", { key: `${item.label}-mid-${index}`, cx: midX, cy: y, r: 10, fill: c.bgCard, stroke: color, strokeWidth: 4 })
6400
6414
  ])
6401
6415
  ),
6402
- ...ticks.map((tick) => {
6416
+ ...ticks.map((tick, index) => {
6403
6417
  const x = scaleX(tick);
6404
- return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, { width: 48 });
6418
+ return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, {
6419
+ align: xTickLabelAlign(index, ticks.length),
6420
+ width: 48
6421
+ });
6405
6422
  }),
6406
6423
  axisLabel && chartLabel("interval-axis-label", axisLabel, plot.x + plot.innerWidth / 2, height - 8, c, {
6407
6424
  width: plot.innerWidth,
package/dist/index.cjs CHANGED
@@ -5794,6 +5794,11 @@ function LineChart({
5794
5794
 
5795
5795
  // src/primitives/plots.ts
5796
5796
  var import_react9 = __toESM(require("react"), 1);
5797
+ function xTickLabelAlign(index, count) {
5798
+ if (index === 0) return "left";
5799
+ if (index === count - 1) return "right";
5800
+ return "center";
5801
+ }
5797
5802
  function ScatterPlot({
5798
5803
  points,
5799
5804
  c,
@@ -5880,9 +5885,12 @@ function ScatterPlot({
5880
5885
  })
5881
5886
  )
5882
5887
  ),
5883
- ...xTicks.map((tick) => {
5888
+ ...xTicks.map((tick, index) => {
5884
5889
  const x = xInPlot(tick, xDomain, plot);
5885
- return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 44 });
5890
+ return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
5891
+ align: xTickLabelAlign(index, xTicks.length),
5892
+ width: 44
5893
+ });
5886
5894
  }),
5887
5895
  ...yTicks.map((tick) => {
5888
5896
  const y = yInPlot(tick, yDomain, plot);
@@ -6091,9 +6099,12 @@ function ParetoChart({
6091
6099
  strokeWidth: isFrontier ? 3 : 2
6092
6100
  }))
6093
6101
  ),
6094
- ...xTicks.map((tick) => {
6102
+ ...xTicks.map((tick, index) => {
6095
6103
  const x = pointFor(tick, yDomain.min).x;
6096
- return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 52 });
6104
+ return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6105
+ align: xTickLabelAlign(index, xTicks.length),
6106
+ width: 52
6107
+ });
6097
6108
  }),
6098
6109
  ...yTicks.map((tick) => {
6099
6110
  const y = yInPlot(tick, yDomain, plot);
@@ -6316,9 +6327,12 @@ function QuadrantChart({
6316
6327
  })] : []
6317
6328
  ];
6318
6329
  }),
6319
- ...(showTicks ? xTicks : []).map((tick) => {
6330
+ ...(showTicks ? xTicks : []).map((tick, index) => {
6320
6331
  const x = xInPlot(tick, xDomain, plot);
6321
- return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 54 });
6332
+ return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6333
+ align: xTickLabelAlign(index, xTicks.length),
6334
+ width: 54
6335
+ });
6322
6336
  }),
6323
6337
  ...(showTicks ? yTicks : []).map((tick) => {
6324
6338
  const y = yInPlot(tick, yDomain, plot);
@@ -6412,9 +6426,12 @@ function IntervalPlot({
6412
6426
  import_react9.default.createElement("circle", { key: `${item.label}-mid-${index}`, cx: midX, cy: y, r: 10, fill: c.bgCard, stroke: color, strokeWidth: 4 })
6413
6427
  ])
6414
6428
  ),
6415
- ...ticks.map((tick) => {
6429
+ ...ticks.map((tick, index) => {
6416
6430
  const x = scaleX(tick);
6417
- return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, { width: 48 });
6431
+ return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, {
6432
+ align: xTickLabelAlign(index, ticks.length),
6433
+ width: 48
6434
+ });
6418
6435
  }),
6419
6436
  axisLabel && chartLabel("interval-axis-label", axisLabel, plot.x + plot.innerWidth / 2, height - 8, c, {
6420
6437
  width: plot.innerWidth,
package/dist/index.js CHANGED
@@ -5645,6 +5645,11 @@ function LineChart({
5645
5645
 
5646
5646
  // src/primitives/plots.ts
5647
5647
  import React9 from "react";
5648
+ function xTickLabelAlign(index, count) {
5649
+ if (index === 0) return "left";
5650
+ if (index === count - 1) return "right";
5651
+ return "center";
5652
+ }
5648
5653
  function ScatterPlot({
5649
5654
  points,
5650
5655
  c,
@@ -5731,9 +5736,12 @@ function ScatterPlot({
5731
5736
  })
5732
5737
  )
5733
5738
  ),
5734
- ...xTicks.map((tick) => {
5739
+ ...xTicks.map((tick, index) => {
5735
5740
  const x = xInPlot(tick, xDomain, plot);
5736
- return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 44 });
5741
+ return chartLabel(`x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
5742
+ align: xTickLabelAlign(index, xTicks.length),
5743
+ width: 44
5744
+ });
5737
5745
  }),
5738
5746
  ...yTicks.map((tick) => {
5739
5747
  const y = yInPlot(tick, yDomain, plot);
@@ -5942,9 +5950,12 @@ function ParetoChart({
5942
5950
  strokeWidth: isFrontier ? 3 : 2
5943
5951
  }))
5944
5952
  ),
5945
- ...xTicks.map((tick) => {
5953
+ ...xTicks.map((tick, index) => {
5946
5954
  const x = pointFor(tick, yDomain.min).x;
5947
- return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 52 });
5955
+ return chartLabel(`pareto-x-tick-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
5956
+ align: xTickLabelAlign(index, xTicks.length),
5957
+ width: 52
5958
+ });
5948
5959
  }),
5949
5960
  ...yTicks.map((tick) => {
5950
5961
  const y = yInPlot(tick, yDomain, plot);
@@ -6167,9 +6178,12 @@ function QuadrantChart({
6167
6178
  })] : []
6168
6179
  ];
6169
6180
  }),
6170
- ...(showTicks ? xTicks : []).map((tick) => {
6181
+ ...(showTicks ? xTicks : []).map((tick, index) => {
6171
6182
  const x = xInPlot(tick, xDomain, plot);
6172
- return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, { width: 54 });
6183
+ return chartLabel(`quadrant-x-tick-label-${tick}`, formatChartValue(tick, formatX), x, plot.bottom + 18, c, {
6184
+ align: xTickLabelAlign(index, xTicks.length),
6185
+ width: 54
6186
+ });
6173
6187
  }),
6174
6188
  ...(showTicks ? yTicks : []).map((tick) => {
6175
6189
  const y = yInPlot(tick, yDomain, plot);
@@ -6263,9 +6277,12 @@ function IntervalPlot({
6263
6277
  React9.createElement("circle", { key: `${item.label}-mid-${index}`, cx: midX, cy: y, r: 10, fill: c.bgCard, stroke: color, strokeWidth: 4 })
6264
6278
  ])
6265
6279
  ),
6266
- ...ticks.map((tick) => {
6280
+ ...ticks.map((tick, index) => {
6267
6281
  const x = scaleX(tick);
6268
- return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, { width: 48 });
6282
+ return chartLabel(`interval-tick-label-${tick}`, formatChartValue(tick, format), x, height - margin.bottom + 17, c, {
6283
+ align: xTickLabelAlign(index, ticks.length),
6284
+ width: 48
6285
+ });
6269
6286
  }),
6270
6287
  axisLabel && chartLabel("interval-axis-label", axisLabel, plot.x + plot.innerWidth / 2, height - 8, c, {
6271
6288
  width: plot.innerWidth,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vizmatic",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "Theme-aware visual primitives and a headless renderer for diagrams, figures, and presentation frames.",
5
5
  "type": "module",
6
6
  "license": "MIT",