@opendata-ai/openchart-vanilla 2.3.2 → 2.3.5
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/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/graph/canvas-renderer.ts +5 -2
- package/src/table-renderer.ts +9 -2
package/dist/index.js
CHANGED
|
@@ -119,6 +119,7 @@ var GLOW_ALPHA = 0.15;
|
|
|
119
119
|
var CULL_MARGIN = 50;
|
|
120
120
|
var TWO_PI = Math.PI * 2;
|
|
121
121
|
var MIN_SCREEN_RADIUS = 2.5;
|
|
122
|
+
var BRAND_MIN_WIDTH = 120;
|
|
122
123
|
function labelThreshold(zoom) {
|
|
123
124
|
const t = Math.max(0, Math.min(1, (zoom - 0.2) / 1.8));
|
|
124
125
|
return 1 - t;
|
|
@@ -246,7 +247,7 @@ var GraphCanvasRenderer = class {
|
|
|
246
247
|
// Brand rendering
|
|
247
248
|
// -------------------------------------------------------------------------
|
|
248
249
|
drawBrand(ctx, w, h, theme) {
|
|
249
|
-
if (w <
|
|
250
|
+
if (w < BRAND_MIN_WIDTH) return;
|
|
250
251
|
const { dpr } = this;
|
|
251
252
|
ctx.save();
|
|
252
253
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
@@ -255,7 +256,7 @@ var GraphCanvasRenderer = class {
|
|
|
255
256
|
const y = h - padding;
|
|
256
257
|
ctx.font = `600 20px ${theme.fonts.family}`;
|
|
257
258
|
ctx.fillStyle = theme.colors.axis;
|
|
258
|
-
ctx.globalAlpha = 0.
|
|
259
|
+
ctx.globalAlpha = 0.55;
|
|
259
260
|
ctx.textAlign = "right";
|
|
260
261
|
ctx.textBaseline = "alphabetic";
|
|
261
262
|
ctx.fillText("OpenData", x, y);
|
|
@@ -2740,7 +2741,7 @@ function renderLegend(parent, legend) {
|
|
|
2740
2741
|
parent.appendChild(g);
|
|
2741
2742
|
}
|
|
2742
2743
|
var BRAND_FONT_SIZE = 20;
|
|
2743
|
-
var
|
|
2744
|
+
var BRAND_MIN_WIDTH2 = 120;
|
|
2744
2745
|
var BRAND_URL = "https://tryopendata.ai";
|
|
2745
2746
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
2746
2747
|
function brandPosition(layout) {
|
|
@@ -2759,7 +2760,7 @@ function brandPosition(layout) {
|
|
|
2759
2760
|
return { openX, dataX, y, fill: layout.theme.colors.axis };
|
|
2760
2761
|
}
|
|
2761
2762
|
function renderBrandOpen(parent, layout) {
|
|
2762
|
-
if (layout.dimensions.width <
|
|
2763
|
+
if (layout.dimensions.width < BRAND_MIN_WIDTH2) return;
|
|
2763
2764
|
const { openX, y, fill } = brandPosition(layout);
|
|
2764
2765
|
const a = createSVGElement("a");
|
|
2765
2766
|
a.setAttribute("href", BRAND_URL);
|
|
@@ -2783,7 +2784,7 @@ function renderBrandOpen(parent, layout) {
|
|
|
2783
2784
|
parent.appendChild(a);
|
|
2784
2785
|
}
|
|
2785
2786
|
function renderBrandData(parent, layout) {
|
|
2786
|
-
if (layout.dimensions.width <
|
|
2787
|
+
if (layout.dimensions.width < BRAND_MIN_WIDTH2) return;
|
|
2787
2788
|
const { dataX, y, fill } = brandPosition(layout);
|
|
2788
2789
|
const a = createSVGElement("a");
|
|
2789
2790
|
a.setAttribute("href", BRAND_URL);
|
|
@@ -4447,6 +4448,8 @@ import { getBreakpoint } from "@opendata-ai/openchart-core";
|
|
|
4447
4448
|
import { compileTable } from "@opendata-ai/openchart-engine";
|
|
4448
4449
|
|
|
4449
4450
|
// src/table-renderer.ts
|
|
4451
|
+
var BRAND_URL2 = "https://tryopendata.ai";
|
|
4452
|
+
var BRAND_FONT_SIZE2 = 20;
|
|
4450
4453
|
function renderChromeBlock(layout, position) {
|
|
4451
4454
|
const chrome = layout.chrome;
|
|
4452
4455
|
if (position === "header") {
|
|
@@ -4672,10 +4675,10 @@ function renderTable(layout, container) {
|
|
|
4672
4675
|
brand.className = "viz-table-ref";
|
|
4673
4676
|
brand.style.cssText = "text-align: right; padding: 4px 8px;";
|
|
4674
4677
|
const brandLink = document.createElement("a");
|
|
4675
|
-
brandLink.href =
|
|
4678
|
+
brandLink.href = BRAND_URL2;
|
|
4676
4679
|
brandLink.target = "_blank";
|
|
4677
4680
|
brandLink.rel = "noopener";
|
|
4678
|
-
brandLink.style.cssText = `font-size:
|
|
4681
|
+
brandLink.style.cssText = `font-size: ${BRAND_FONT_SIZE2}px; font-weight: 600; color: ${brandColor}; opacity: 0.55; text-decoration: none; font-family: ${theme ? theme.fonts.family : "sans-serif"};`;
|
|
4679
4682
|
brandLink.textContent = "OpenData";
|
|
4680
4683
|
brand.appendChild(brandLink);
|
|
4681
4684
|
wrapper.appendChild(brand);
|