eleventy-plugin-uncharted 1.0.0-rc.2 → 1.0.1
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/README.md +0 -2
- package/package.json +1 -1
- package/src/renderers/bubble.js +4 -5
- package/src/renderers/line.js +1 -1
- package/src/renderers/scatter.js +5 -6
- package/src/renderers/timeseries.js +1 -1
package/README.md
CHANGED
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) {
|
|
@@ -161,7 +161,7 @@ export function renderBubble(config) {
|
|
|
161
161
|
dotsByCategory.get(dot.x).push({ ...dot, originalIndex: i });
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
const fmtSize = _columns?.sizeFormat || {};
|
|
164
|
+
const fmtSize = _columns?.sizeFormat || format || {};
|
|
165
165
|
|
|
166
166
|
// Render dots by category column
|
|
167
167
|
categories.forEach((category, colIndex) => {
|
|
@@ -249,9 +249,8 @@ export function renderBubble(config) {
|
|
|
249
249
|
const sizeValues = dots.map(d => d.rawSize).filter(v => v > 0);
|
|
250
250
|
const minSizeVal = sizeValues.length ? Math.min(...sizeValues) : 0;
|
|
251
251
|
const maxSizeVal = sizeValues.length ? Math.max(...sizeValues) : 0;
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
const maxFormatted = formatNumber(maxSizeVal, fmtSizeLegend) || maxSizeVal;
|
|
252
|
+
const minFormatted = formatNumber(minSizeVal, fmtSize) || minSizeVal;
|
|
253
|
+
const maxFormatted = formatNumber(maxSizeVal, fmtSize) || maxSizeVal;
|
|
255
254
|
|
|
256
255
|
html += `<div class="chart-size-legend">`;
|
|
257
256
|
html += `<span class="chart-legend-title">${escapeHtml(sizeTitle)}</span>`;
|
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) {
|
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>`;
|
|
@@ -157,7 +157,7 @@ export function renderScatter(config) {
|
|
|
157
157
|
html += `<div class="dot-area"${dotAreaStyle}>`;
|
|
158
158
|
html += `<div class="dot-field">`;
|
|
159
159
|
|
|
160
|
-
const fmtSize = _columns?.sizeFormat || {};
|
|
160
|
+
const fmtSize = _columns?.sizeFormat || format || {};
|
|
161
161
|
dots.forEach((dot, i) => {
|
|
162
162
|
const xPct = rangeX > 0 ? ((dot.x - calcMinX) / rangeX) * 100 : 0;
|
|
163
163
|
const yPct = rangeY > 0 ? ((dot.y - calcMinY) / rangeY) * 100 : 0;
|
|
@@ -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>`;
|
|
@@ -246,9 +246,8 @@ export function renderScatter(config) {
|
|
|
246
246
|
const sizeValues = dots.map(d => d.rawSize).filter(v => v > 0);
|
|
247
247
|
const minSizeVal = sizeValues.length ? Math.min(...sizeValues) : 0;
|
|
248
248
|
const maxSizeVal = sizeValues.length ? Math.max(...sizeValues) : 0;
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
const maxFormatted = formatNumber(maxSizeVal, fmtSizeLegend) || maxSizeVal;
|
|
249
|
+
const minFormatted = formatNumber(minSizeVal, fmtSize) || minSizeVal;
|
|
250
|
+
const maxFormatted = formatNumber(maxSizeVal, fmtSize) || maxSizeVal;
|
|
252
251
|
|
|
253
252
|
html += `<div class="chart-size-legend">`;
|
|
254
253
|
html += `<span class="chart-legend-title">${escapeHtml(sizeTitle)}</span>`;
|
|
@@ -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) {
|