vizmatic 0.1.19 → 0.1.20
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
|
@@ -4153,10 +4153,13 @@ function LineChart({
|
|
|
4153
4153
|
const allValues = series.flatMap((item) => item.points);
|
|
4154
4154
|
const domain = chartDomain(allValues, min, max);
|
|
4155
4155
|
const maxPoints = Math.max(...series.map((item) => item.points.length), 1);
|
|
4156
|
-
const
|
|
4156
|
+
const xInset = maxPoints <= 1 ? 0 : Math.min(26, Math.max(14, plot.innerWidth * 0.06));
|
|
4157
|
+
const xStart = maxPoints <= 1 ? plot.x + plot.innerWidth / 2 : plot.x + xInset;
|
|
4158
|
+
const xSpan = maxPoints <= 1 ? 0 : Math.max(1, plot.innerWidth - xInset * 2);
|
|
4159
|
+
const xStep = maxPoints <= 1 ? 0 : xSpan / (maxPoints - 1);
|
|
4157
4160
|
const ticks = chartTicks(domain.min, domain.max, 4);
|
|
4158
4161
|
const pointFor = (value, index) => {
|
|
4159
|
-
const x =
|
|
4162
|
+
const x = xStart + index * xStep;
|
|
4160
4163
|
const y = yInPlot(value, domain, plot);
|
|
4161
4164
|
return { x, y };
|
|
4162
4165
|
};
|
|
@@ -4199,7 +4202,12 @@ function LineChart({
|
|
|
4199
4202
|
if (item.points.length === 0) return [];
|
|
4200
4203
|
const color = chartColor(item.color, c, seriesIndex);
|
|
4201
4204
|
const linePath = pathFor(item.points);
|
|
4202
|
-
|
|
4205
|
+
let areaPath = "";
|
|
4206
|
+
if (item.area && item.points.length > 1) {
|
|
4207
|
+
const firstPoint = pointFor(item.points[0], 0);
|
|
4208
|
+
const lastPoint = pointFor(item.points[item.points.length - 1], item.points.length - 1);
|
|
4209
|
+
areaPath = `${linePath} L ${lastPoint.x} ${plot.bottom} L ${firstPoint.x} ${plot.bottom} Z`;
|
|
4210
|
+
}
|
|
4203
4211
|
const elements = [];
|
|
4204
4212
|
if (areaPath) {
|
|
4205
4213
|
elements.push(React.createElement("path", { key: `${item.name}-area`, d: areaPath, fill: color, opacity: 0.12 }));
|
|
@@ -4240,10 +4248,9 @@ function LineChart({
|
|
|
4240
4248
|
fontWeight: 700,
|
|
4241
4249
|
transform: "translate(-50%, -50%) rotate(-90deg)"
|
|
4242
4250
|
}),
|
|
4243
|
-
...(labels ?? []).map((label, index
|
|
4244
|
-
const x =
|
|
4245
|
-
|
|
4246
|
-
return chartLabel(`line-x-${label}`, label, x, height - 14, c, { align, width: 72 });
|
|
4251
|
+
...(labels ?? []).map((label, index) => {
|
|
4252
|
+
const x = xStart + index * xStep;
|
|
4253
|
+
return chartLabel(`line-x-${label}`, label, x, height - 14, c, { width: 72 });
|
|
4247
4254
|
})
|
|
4248
4255
|
)
|
|
4249
4256
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -4167,10 +4167,13 @@ function LineChart({
|
|
|
4167
4167
|
const allValues = series.flatMap((item) => item.points);
|
|
4168
4168
|
const domain = chartDomain(allValues, min, max);
|
|
4169
4169
|
const maxPoints = Math.max(...series.map((item) => item.points.length), 1);
|
|
4170
|
-
const
|
|
4170
|
+
const xInset = maxPoints <= 1 ? 0 : Math.min(26, Math.max(14, plot.innerWidth * 0.06));
|
|
4171
|
+
const xStart = maxPoints <= 1 ? plot.x + plot.innerWidth / 2 : plot.x + xInset;
|
|
4172
|
+
const xSpan = maxPoints <= 1 ? 0 : Math.max(1, plot.innerWidth - xInset * 2);
|
|
4173
|
+
const xStep = maxPoints <= 1 ? 0 : xSpan / (maxPoints - 1);
|
|
4171
4174
|
const ticks = chartTicks(domain.min, domain.max, 4);
|
|
4172
4175
|
const pointFor = (value, index) => {
|
|
4173
|
-
const x =
|
|
4176
|
+
const x = xStart + index * xStep;
|
|
4174
4177
|
const y = yInPlot(value, domain, plot);
|
|
4175
4178
|
return { x, y };
|
|
4176
4179
|
};
|
|
@@ -4213,7 +4216,12 @@ function LineChart({
|
|
|
4213
4216
|
if (item.points.length === 0) return [];
|
|
4214
4217
|
const color = chartColor(item.color, c, seriesIndex);
|
|
4215
4218
|
const linePath = pathFor(item.points);
|
|
4216
|
-
|
|
4219
|
+
let areaPath = "";
|
|
4220
|
+
if (item.area && item.points.length > 1) {
|
|
4221
|
+
const firstPoint = pointFor(item.points[0], 0);
|
|
4222
|
+
const lastPoint = pointFor(item.points[item.points.length - 1], item.points.length - 1);
|
|
4223
|
+
areaPath = `${linePath} L ${lastPoint.x} ${plot.bottom} L ${firstPoint.x} ${plot.bottom} Z`;
|
|
4224
|
+
}
|
|
4217
4225
|
const elements = [];
|
|
4218
4226
|
if (areaPath) {
|
|
4219
4227
|
elements.push(import_react.default.createElement("path", { key: `${item.name}-area`, d: areaPath, fill: color, opacity: 0.12 }));
|
|
@@ -4254,10 +4262,9 @@ function LineChart({
|
|
|
4254
4262
|
fontWeight: 700,
|
|
4255
4263
|
transform: "translate(-50%, -50%) rotate(-90deg)"
|
|
4256
4264
|
}),
|
|
4257
|
-
...(labels ?? []).map((label, index
|
|
4258
|
-
const x =
|
|
4259
|
-
|
|
4260
|
-
return chartLabel(`line-x-${label}`, label, x, height - 14, c, { align, width: 72 });
|
|
4265
|
+
...(labels ?? []).map((label, index) => {
|
|
4266
|
+
const x = xStart + index * xStep;
|
|
4267
|
+
return chartLabel(`line-x-${label}`, label, x, height - 14, c, { width: 72 });
|
|
4261
4268
|
})
|
|
4262
4269
|
)
|
|
4263
4270
|
});
|
package/dist/index.js
CHANGED
|
@@ -4040,10 +4040,13 @@ function LineChart({
|
|
|
4040
4040
|
const allValues = series.flatMap((item) => item.points);
|
|
4041
4041
|
const domain = chartDomain(allValues, min, max);
|
|
4042
4042
|
const maxPoints = Math.max(...series.map((item) => item.points.length), 1);
|
|
4043
|
-
const
|
|
4043
|
+
const xInset = maxPoints <= 1 ? 0 : Math.min(26, Math.max(14, plot.innerWidth * 0.06));
|
|
4044
|
+
const xStart = maxPoints <= 1 ? plot.x + plot.innerWidth / 2 : plot.x + xInset;
|
|
4045
|
+
const xSpan = maxPoints <= 1 ? 0 : Math.max(1, plot.innerWidth - xInset * 2);
|
|
4046
|
+
const xStep = maxPoints <= 1 ? 0 : xSpan / (maxPoints - 1);
|
|
4044
4047
|
const ticks = chartTicks(domain.min, domain.max, 4);
|
|
4045
4048
|
const pointFor = (value, index) => {
|
|
4046
|
-
const x =
|
|
4049
|
+
const x = xStart + index * xStep;
|
|
4047
4050
|
const y = yInPlot(value, domain, plot);
|
|
4048
4051
|
return { x, y };
|
|
4049
4052
|
};
|
|
@@ -4086,7 +4089,12 @@ function LineChart({
|
|
|
4086
4089
|
if (item.points.length === 0) return [];
|
|
4087
4090
|
const color = chartColor(item.color, c, seriesIndex);
|
|
4088
4091
|
const linePath = pathFor(item.points);
|
|
4089
|
-
|
|
4092
|
+
let areaPath = "";
|
|
4093
|
+
if (item.area && item.points.length > 1) {
|
|
4094
|
+
const firstPoint = pointFor(item.points[0], 0);
|
|
4095
|
+
const lastPoint = pointFor(item.points[item.points.length - 1], item.points.length - 1);
|
|
4096
|
+
areaPath = `${linePath} L ${lastPoint.x} ${plot.bottom} L ${firstPoint.x} ${plot.bottom} Z`;
|
|
4097
|
+
}
|
|
4090
4098
|
const elements = [];
|
|
4091
4099
|
if (areaPath) {
|
|
4092
4100
|
elements.push(React.createElement("path", { key: `${item.name}-area`, d: areaPath, fill: color, opacity: 0.12 }));
|
|
@@ -4127,10 +4135,9 @@ function LineChart({
|
|
|
4127
4135
|
fontWeight: 700,
|
|
4128
4136
|
transform: "translate(-50%, -50%) rotate(-90deg)"
|
|
4129
4137
|
}),
|
|
4130
|
-
...(labels ?? []).map((label, index
|
|
4131
|
-
const x =
|
|
4132
|
-
|
|
4133
|
-
return chartLabel(`line-x-${label}`, label, x, height - 14, c, { align, width: 72 });
|
|
4138
|
+
...(labels ?? []).map((label, index) => {
|
|
4139
|
+
const x = xStart + index * xStep;
|
|
4140
|
+
return chartLabel(`line-x-${label}`, label, x, height - 14, c, { width: 72 });
|
|
4134
4141
|
})
|
|
4135
4142
|
)
|
|
4136
4143
|
});
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED