eleventy-plugin-uncharted 1.0.0-rc.1 → 1.0.0
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/css/uncharted.css
CHANGED
|
@@ -387,7 +387,6 @@
|
|
|
387
387
|
.chart-stacked-column .column-labels {
|
|
388
388
|
grid-row: 2;
|
|
389
389
|
display: flex;
|
|
390
|
-
flex-wrap: wrap;
|
|
391
390
|
gap: clamp(0.375rem, 1.5cqi, 1rem);
|
|
392
391
|
padding: 0.25rem 0.5rem 0;
|
|
393
392
|
}
|
|
@@ -411,6 +410,7 @@
|
|
|
411
410
|
transform: rotate(180deg);
|
|
412
411
|
display: flex;
|
|
413
412
|
align-items: center;
|
|
413
|
+
white-space: nowrap;
|
|
414
414
|
overflow: visible;
|
|
415
415
|
text-overflow: clip;
|
|
416
416
|
}
|
|
@@ -642,7 +642,6 @@
|
|
|
642
642
|
:is(.chart-dot, .chart-line) .dot-labels {
|
|
643
643
|
grid-row: 2;
|
|
644
644
|
display: flex;
|
|
645
|
-
flex-wrap: wrap;
|
|
646
645
|
gap: 6px;
|
|
647
646
|
padding: 0 0.5rem;
|
|
648
647
|
margin-top: 0.5rem;
|
|
@@ -664,17 +663,19 @@
|
|
|
664
663
|
transform: rotate(180deg);
|
|
665
664
|
display: flex;
|
|
666
665
|
align-items: center;
|
|
666
|
+
white-space: nowrap;
|
|
667
667
|
overflow: visible;
|
|
668
668
|
text-overflow: clip;
|
|
669
669
|
}
|
|
670
670
|
|
|
671
|
-
:is(.chart-dot, .chart-line) .
|
|
672
|
-
|
|
671
|
+
:is(.chart-dot, .chart-line, .chart-stacked-column) .chart-body > .axis-title {
|
|
672
|
+
grid-column: 2;
|
|
673
673
|
text-align: center;
|
|
674
674
|
font-size: 0.7rem;
|
|
675
675
|
opacity: 0.6;
|
|
676
676
|
white-space: nowrap;
|
|
677
677
|
margin-top: 0.5rem;
|
|
678
|
+
display: block;
|
|
678
679
|
}
|
|
679
680
|
|
|
680
681
|
/* ==========================================================================
|
|
@@ -783,7 +784,6 @@
|
|
|
783
784
|
.chart-bubble .dot-labels {
|
|
784
785
|
grid-row: 2;
|
|
785
786
|
display: flex;
|
|
786
|
-
flex-wrap: wrap;
|
|
787
787
|
gap: 6px;
|
|
788
788
|
padding: 0 0.5rem;
|
|
789
789
|
margin-top: 0.5rem;
|
|
@@ -808,17 +808,18 @@
|
|
|
808
808
|
transform: rotate(180deg);
|
|
809
809
|
display: flex;
|
|
810
810
|
align-items: center;
|
|
811
|
+
white-space: nowrap;
|
|
811
812
|
overflow: visible;
|
|
812
813
|
text-overflow: clip;
|
|
813
814
|
}
|
|
814
815
|
|
|
815
|
-
.chart-bubble .
|
|
816
|
-
flex-basis: 100%;
|
|
816
|
+
.chart-bubble .chart-body > .axis-title {
|
|
817
817
|
text-align: center;
|
|
818
818
|
font-size: 0.7rem;
|
|
819
819
|
opacity: 0.6;
|
|
820
820
|
white-space: nowrap;
|
|
821
821
|
margin-top: 0.5rem;
|
|
822
|
+
display: block;
|
|
822
823
|
}
|
|
823
824
|
|
|
824
825
|
/* Bubble chart legend uses circular markers */
|
|
@@ -1373,10 +1374,11 @@
|
|
|
1373
1374
|
}
|
|
1374
1375
|
}
|
|
1375
1376
|
|
|
1376
|
-
/* Line chart: animate
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1377
|
+
/* Line chart: animate dot-field only (so x-axis labels and background don't animate) */
|
|
1378
|
+
/* Negative insets allow dots to overflow the field bounds */
|
|
1379
|
+
.chart-animate.chart-line .dot-field {
|
|
1380
|
+
clip-path: inset(-1rem 100% -1rem 0);
|
|
1381
|
+
animation: timeseries-reveal 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
|
|
1380
1382
|
}
|
|
1381
1383
|
|
|
1382
1384
|
/* Timeseries: animate dot-field only (so x-axis labels and background don't animate) */
|
|
@@ -1391,11 +1393,6 @@
|
|
|
1391
1393
|
to { clip-path: inset(-1rem); }
|
|
1392
1394
|
}
|
|
1393
1395
|
|
|
1394
|
-
@keyframes container-reveal {
|
|
1395
|
-
from { clip-path: inset(0 100% 0 0); }
|
|
1396
|
-
to { clip-path: inset(0); }
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
1396
|
/* Donut chart: clockwise reveal using animated mask */
|
|
1400
1397
|
@property --donut-reveal {
|
|
1401
1398
|
syntax: '<angle>';
|
package/package.json
CHANGED
package/src/renderers/bubble.js
CHANGED
|
@@ -134,7 +134,7 @@ export function renderBubble(config) {
|
|
|
134
134
|
const yAxisStyle = hasNegativeY ? ` style="--zero-position: ${zeroPctY.toFixed(2)}%"` : '';
|
|
135
135
|
html += `<div class="chart-y-axis"${yAxisStyle}>`;
|
|
136
136
|
html += `<span class="axis-label">${formatNumber(calcMaxY, fmtY) || calcMaxY}</span>`;
|
|
137
|
-
const midLabelY = hasNegativeY ? 0 :
|
|
137
|
+
const midLabelY = hasNegativeY ? 0 : (calcMaxY + calcMinY) / 2;
|
|
138
138
|
html += `<span class="axis-label">${formatNumber(midLabelY, fmtY) || midLabelY}</span>`;
|
|
139
139
|
html += `<span class="axis-label">${formatNumber(calcMinY, fmtY) || calcMinY}</span>`;
|
|
140
140
|
if (yAxisTitle) {
|
|
@@ -213,12 +213,12 @@ export function renderBubble(config) {
|
|
|
213
213
|
categories.forEach(category => {
|
|
214
214
|
html += `<span class="dot-label">${escapeHtml(category)}</span>`;
|
|
215
215
|
});
|
|
216
|
-
if (xAxisTitle) {
|
|
217
|
-
html += `<span class="axis-title">${escapeHtml(xAxisTitle)}</span>`;
|
|
218
|
-
}
|
|
219
216
|
html += `</div>`;
|
|
220
217
|
|
|
221
218
|
html += `</div>`; // close chart-scroll
|
|
219
|
+
if (xAxisTitle) {
|
|
220
|
+
html += `<span class="axis-title">${escapeHtml(xAxisTitle)}</span>`;
|
|
221
|
+
}
|
|
222
222
|
html += `</div>`; // close chart-body
|
|
223
223
|
|
|
224
224
|
// Legend (if multiple series or legendTitle specified)
|
package/src/renderers/line.js
CHANGED
|
@@ -90,7 +90,7 @@ export function renderLine(config) {
|
|
|
90
90
|
const yAxisStyle = hasNegativeY ? ` style="--zero-position: ${zeroPct.toFixed(2)}%"` : '';
|
|
91
91
|
html += `<div class="chart-y-axis"${yAxisStyle}>`;
|
|
92
92
|
html += `<span class="axis-label">${formatNumber(maxValue, yFormat) || maxValue}</span>`;
|
|
93
|
-
const midLabelY = hasNegativeY ? 0 :
|
|
93
|
+
const midLabelY = hasNegativeY ? 0 : (maxValue + minValue) / 2;
|
|
94
94
|
html += `<span class="axis-label">${formatNumber(midLabelY, yFormat) || midLabelY}</span>`;
|
|
95
95
|
html += `<span class="axis-label">${formatNumber(minValue, yFormat) || minValue}</span>`;
|
|
96
96
|
if (yAxisTitle) {
|
|
@@ -181,12 +181,12 @@ export function renderLine(config) {
|
|
|
181
181
|
const label = row[labelKey] ?? '';
|
|
182
182
|
html += `<span class="dot-label">${escapeHtml(label)}</span>`;
|
|
183
183
|
});
|
|
184
|
-
if (xAxisTitle) {
|
|
185
|
-
html += `<span class="axis-title">${escapeHtml(xAxisTitle)}</span>`;
|
|
186
|
-
}
|
|
187
184
|
html += `</div>`;
|
|
188
185
|
|
|
189
186
|
html += `</div>`; // close chart-scroll
|
|
187
|
+
if (xAxisTitle) {
|
|
188
|
+
html += `<span class="axis-title">${escapeHtml(xAxisTitle)}</span>`;
|
|
189
|
+
}
|
|
190
190
|
html += `</div>`; // close chart-body
|
|
191
191
|
|
|
192
192
|
// Legend (show if legend !== false and we have series keys or legendTitle)
|
package/src/renderers/scatter.js
CHANGED
|
@@ -141,7 +141,7 @@ export function renderScatter(config) {
|
|
|
141
141
|
const yAxisStyle = hasNegativeY ? ` style="--zero-position-y: ${zeroPctY.toFixed(2)}%"` : '';
|
|
142
142
|
html += `<div class="chart-y-axis"${yAxisStyle}>`;
|
|
143
143
|
html += `<span class="axis-label">${formatNumber(calcMaxY, fmtY) || calcMaxY}</span>`;
|
|
144
|
-
const midLabelY = hasNegativeY ? 0 :
|
|
144
|
+
const midLabelY = hasNegativeY ? 0 : (calcMaxY + calcMinY) / 2;
|
|
145
145
|
html += `<span class="axis-label">${formatNumber(midLabelY, fmtY) || midLabelY}</span>`;
|
|
146
146
|
html += `<span class="axis-label">${formatNumber(calcMinY, fmtY) || calcMinY}</span>`;
|
|
147
147
|
html += `<span class="axis-title">${escapeHtml(yAxisTitle)}</span>`;
|
|
@@ -209,7 +209,7 @@ export function renderScatter(config) {
|
|
|
209
209
|
const xAxisStyle = hasNegativeX ? ` style="--zero-position-x: ${zeroPctX.toFixed(2)}%"` : '';
|
|
210
210
|
html += `<div class="chart-x-axis"${xAxisStyle}>`;
|
|
211
211
|
html += `<span class="axis-label">${formatNumber(calcMinX, fmtX) || calcMinX}</span>`;
|
|
212
|
-
const midLabelX = hasNegativeX ? 0 :
|
|
212
|
+
const midLabelX = hasNegativeX ? 0 : (calcMaxX + calcMinX) / 2;
|
|
213
213
|
html += `<span class="axis-label">${formatNumber(midLabelX, fmtX) || midLabelX}</span>`;
|
|
214
214
|
html += `<span class="axis-label">${formatNumber(calcMaxX, fmtX) || calcMaxX}</span>`;
|
|
215
215
|
html += `<span class="axis-title">${escapeHtml(xAxisTitle)}</span>`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { slugify, getLabelKey, getSeriesNames, escapeHtml, renderDownloadLinks } from '../utils.js';
|
|
2
2
|
import { formatNumber } from '../formatters.js';
|
|
3
|
-
import { getAxisMax, getAxisMin, getAxisFormat, getRotateLabels } from '../config.js';
|
|
3
|
+
import { getAxisMax, getAxisMin, getAxisFormat, getAxisTitle, getRotateLabels } from '../config.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Render a stacked column chart (vertical)
|
|
@@ -35,8 +35,10 @@ export function renderStackedColumn(config) {
|
|
|
35
35
|
const animateClass = animate ? ' chart-animate' : '';
|
|
36
36
|
const rotateLabels = getRotateLabels(config);
|
|
37
37
|
|
|
38
|
-
// Get Y-axis format
|
|
38
|
+
// Get Y-axis format and axis titles
|
|
39
39
|
const yFormat = getAxisFormat(config, 'y');
|
|
40
|
+
const xAxisTitle = getAxisTitle(config, 'x', '');
|
|
41
|
+
const yAxisTitle = getAxisTitle(config, 'y', '');
|
|
40
42
|
|
|
41
43
|
// Calculate stacked totals for positive and negative values separately
|
|
42
44
|
// Positives stack up from zero, negatives stack down from zero
|
|
@@ -91,6 +93,9 @@ export function renderStackedColumn(config) {
|
|
|
91
93
|
html += `<span class="axis-label">${formatNumber(midLabelY, yFormat) || midLabelY}</span>`;
|
|
92
94
|
const minLabelY = hasNegativeY ? minValue : 0;
|
|
93
95
|
html += `<span class="axis-label">${formatNumber(minLabelY, yFormat) || minLabelY}</span>`;
|
|
96
|
+
if (yAxisTitle) {
|
|
97
|
+
html += `<span class="axis-title">${escapeHtml(yAxisTitle)}</span>`;
|
|
98
|
+
}
|
|
94
99
|
html += `</div>`;
|
|
95
100
|
|
|
96
101
|
// Scroll wrapper for columns + labels
|
|
@@ -193,6 +198,9 @@ export function renderStackedColumn(config) {
|
|
|
193
198
|
html += `</div>`;
|
|
194
199
|
|
|
195
200
|
html += `</div>`; // close chart-scroll
|
|
201
|
+
if (xAxisTitle) {
|
|
202
|
+
html += `<span class="axis-title">${escapeHtml(xAxisTitle)}</span>`;
|
|
203
|
+
}
|
|
196
204
|
html += `</div>`; // close chart-body
|
|
197
205
|
|
|
198
206
|
// Legend (show if legend !== false and we have series keys)
|
|
@@ -380,7 +380,7 @@ export function renderTimeseries(config) {
|
|
|
380
380
|
const yAxisStyle = hasNegativeY ? ` style="--zero-position: ${zeroPctY.toFixed(2)}%"` : '';
|
|
381
381
|
html += `<div class="chart-y-axis"${yAxisStyle}>`;
|
|
382
382
|
html += `<span class="axis-label">${formatNumber(maxValue, yFormat) || maxValue}</span>`;
|
|
383
|
-
const midLabelY = hasNegativeY ? 0 :
|
|
383
|
+
const midLabelY = hasNegativeY ? 0 : (maxValue + minValue) / 2;
|
|
384
384
|
html += `<span class="axis-label">${formatNumber(midLabelY, yFormat) || midLabelY}</span>`;
|
|
385
385
|
html += `<span class="axis-label">${formatNumber(minValue, yFormat) || minValue}</span>`;
|
|
386
386
|
if (yAxisTitle) {
|