visualifyjs 2.5.3-2.dev → 3.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/.claude/mem/TIMELINE.md +36 -0
- package/.claude/mem/notes/2026-02-11-3d-visualization-docs-fix-external-script-solution.md +24 -0
- package/.claude/mem/notes/2026-02-11-3d-visualization-docs-fix-session-summary.md +43 -0
- package/.claude/mem/notes/2026-02-11-cli-fix-editor-command-alias.md +26 -0
- package/.claude/mem/notes/2026-02-11-phase-3-developer-experience-completed.md +51 -0
- package/.claude/mem/notes/2026-02-11-phase-4-web-workers-implementation-complete.md +59 -0
- package/.claude/mem/notes/2026-02-11-visualify-phase-2-3d-visualization-complete.md +50 -0
- package/.claude/mem/notes/2026-02-11-visualify-phase-2-committed-ready-for-phase-3.md +33 -0
- package/.claude/mem/notes/2026-02-11-visualify-phase-3-complete-developer-experience.md +52 -0
- package/.claude/mem/notes/2026-02-11-visualify-repository-cleanup-complete.md +28 -0
- package/.claude/mem/notes/2026-02-18-codebase-cleanup-docsify-plugin-documentation.md +37 -0
- package/.claude/mem/notes/2026-02-19-css-grid-layout-fix-displaycontents-on-vcontroller.md +18 -0
- package/.claude/mem/notes/2026-02-19-docsify-plugin-fixes-latex-and-visualify-code-bloc.md +26 -0
- package/.claude/mem/notes/2026-02-19-page-mode-docs-update-decisions.md +23 -0
- package/.claude/mem/notes/2026-02-19-react-context-infinite-re-render-loop-fix-pattern.md +31 -0
- package/.claude/mem/notes/2026-02-19-version-300-bump-and-build-fixes.md +32 -0
- package/.claude/mem/notes/2026-02-19-visualify-build-deployment-architecture-bug-fixes.md +25 -0
- package/.claude/mem/notes/2026-02-19-visualify-dist-iife-self-contained-build-config.md +30 -0
- package/.claude/mem/notes/2026-02-19-visualify-infinite-loop-i18n-fixes.md +31 -0
- package/.claude/mem/notes/2026-02-19-visualify-v3-bundle-splitting-docs-restructuring.md +32 -0
- package/.claude/mem/notes/2026-02-20-bundle-externalization-final-architecture.md +29 -0
- package/.claude/mem/notes/2026-02-20-chromium-page-fix-unstable-keys-and-double-event-b.md +27 -0
- package/.claude/mem/notes/2026-02-20-console-cleanup-bundle-optimization-commit.md +20 -0
- package/.claude/mem/notes/2026-02-20-dotbio-dot-plot-fix-useeffect-dependency.md +21 -0
- package/.claude/mem/notes/2026-02-20-public-folder-cleanup-and-readme-rewrite.md +25 -0
- package/.claude/mem/notes/2026-02-20-v300-release-and-beta-channel-strategy.md +29 -0
- package/.claude/mem/notes/2026-02-20-visium-background-image-unknown-legend-fix.md +19 -0
- package/.claude/mem/notes/2026-02-20-visualify-cdn-loader-bundle-externalization.md +34 -0
- package/.claude/mem/sessions/session-2026-02-20-031524.md +54 -0
- package/.claude/settings.local.json +21 -0
- package/.github/workflows/static.yml.bak +51 -51
- package/.sisyphus/boulder.json +65 -0
- package/.sisyphus/plans/phase-4-advanced-optimizations.md +217 -0
- package/LICENSE +674 -674
- package/README.md +94 -59
- package/config-overrides.js +31 -31
- package/dist/stats.html +4949 -0
- package/dist/visualify-3d.esm.js +1 -0
- package/dist/visualify-3d.js +1 -0
- package/dist/visualify-core.esm.js +1 -0
- package/dist/visualify-core.js +1 -0
- package/dist/visualify-docs.esm.js +1 -0
- package/dist/visualify-docs.js +1 -0
- package/dist/visualify-loader.js +1 -0
- package/dist/visualify-pages.esm.js +1 -0
- package/dist/visualify-pages.js +1 -0
- package/dist/visualify-portal.esm.js +1 -0
- package/dist/visualify-portal.js +1 -0
- package/dist/visualify-shared.js +26571 -0
- package/dist/visualify.js +1 -188
- package/docs/CHANGELOG.md +148 -0
- package/docs/cli/commands.md +513 -0
- package/docs/configuration/visualify-json.md +474 -0
- package/docs/docs/3d-visualization.md +374 -0
- package/docs/docs/CLI.md +303 -34
- package/docs/docs/README.md +65 -65
- package/docs/docs/Rechart/bar.md +190 -190
- package/docs/docs/Rechart/funnel.md +241 -241
- package/docs/docs/Rechart/line.md +355 -355
- package/docs/docs/Rechart/pie.md +225 -225
- package/docs/docs/Rechart/radar.md +253 -253
- package/docs/docs/Rechart/scatter.md +298 -298
- package/docs/docs/_404.md +51 -51
- package/docs/docs/_coverpage.md +11 -11
- package/docs/docs/_sidebar.md +54 -44
- package/docs/docs/components/dotBio.md +87 -34
- package/docs/docs/components/echart.md +171 -82
- package/docs/docs/components/html.md +61 -34
- package/docs/docs/components/macaron.md +156 -145
- package/docs/docs/components/markdown.md +42 -0
- package/docs/docs/components/more.md +183 -142
- package/docs/docs/components/plotly.md +132 -62
- package/docs/docs/components/scatterL.md +171 -70
- package/docs/docs/components/visium.md +112 -57
- package/docs/docs/configuration.md +121 -121
- package/docs/docs/deploy.md +31 -31
- package/docs/docs/docsify-plugin.md +655 -0
- package/docs/docs/hmr.md +165 -0
- package/docs/docs/i18n.md +332 -0
- package/docs/docs/log.md +30 -9
- package/docs/docs/more-pages.md +23 -23
- package/docs/docs/quickstart.md +148 -124
- package/docs/docs/rechart-attributes.md +74 -74
- package/docs/docs/rechart-basic-usage.md +160 -162
- package/docs/docs/theme.md +5 -5
- package/docs/docs/typescript.md +306 -0
- package/docs/docs/visual-editor.md +359 -0
- package/docs/index.html +85 -71
- package/docs/manifest.json +23 -23
- package/docs/migration/v3-migration.md +392 -0
- package/docs/static/css/fluff-stuff.css +169 -169
- package/docs/static/css/font-awesome.min.css +4 -4
- package/docs/static/css/visualify.css +6 -25
- package/docs/static/js/3d-viz-examples.js +181 -0
- package/docs/static/js/configuration.js +630 -448
- package/docs/static/js/visualify.js +1 -188
- package/package.json +106 -84
- package/rollup.config.mjs +766 -76
- package/src/_css/404.css +115 -115
- package/src/_css/App.css +37 -37
- package/src/_css/autoSuggestion.css +26 -26
- package/src/_css/circular-progress.css +32 -32
- package/src/_css/index.css +36 -36
- package/src/_css/modern.css +350 -25
- package/src/_media/corner.svg +8 -8
- package/src/_media/download.svg +3 -3
- package/src/_media/logo.svg +14 -14
- package/src/_test/App.test.js +15 -15
- package/src/_utils/reportWebVitals.js +13 -13
- package/src/a11y/README.md +177 -0
- package/src/a11y/aria-labels.js +339 -0
- package/src/a11y/color-contrast.js +535 -0
- package/src/a11y/index.js +197 -0
- package/src/a11y/keyboard-nav.js +523 -0
- package/src/a11y/styles.css +165 -0
- package/src/cli/commands/dev.js +214 -0
- package/src/cli/commands/docs.js +521 -0
- package/src/cli/commands/edit.js +379 -0
- package/src/cli/commands/init.js +213 -0
- package/src/cli/commands/portal.js +236 -0
- package/src/cli/dev-server.js +530 -0
- package/src/cli/hmr.js +456 -0
- package/src/cli/index.js +180 -0
- package/src/cli/utils/config.js +207 -0
- package/src/cli/utils/logger.js +241 -0
- package/src/config/defaults.ts +122 -0
- package/src/config/index.ts +72 -0
- package/src/config/loader.ts +478 -0
- package/src/config/schema.ts +227 -0
- package/src/config/validator.ts +337 -0
- package/src/core/appContext.js +34 -27
- package/src/core/components/Bar.js +383 -0
- package/src/core/components/Bar3D.js +473 -0
- package/src/core/components/LargeDatasetChart.js +296 -0
- package/src/core/components/Line3D.js +310 -0
- package/src/core/components/Scatter.js +392 -188
- package/src/core/components/Scatter3D.js +455 -0
- package/src/core/components/ScatterBio.js +601 -572
- package/src/core/components/Surface3D.js +326 -0
- package/src/core/components/ThreeCustom.js +648 -0
- package/src/core/components/ThreeScene.js +459 -0
- package/src/core/components/VisiumPlot.js +191 -165
- package/src/core/components/browser.js +42 -42
- package/src/core/components/dotplot.js +413 -413
- package/src/core/components/html.js +29 -29
- package/src/core/components/list.js +178 -178
- package/src/core/components/macaron.js +206 -201
- package/src/core/components/markdown.js +56 -56
- package/src/core/components/parser.scatterBio.js +582 -587
- package/src/core/components/ratio.js +82 -80
- package/src/core/components/scatterL.js +206 -173
- package/src/core/components/searchbar.js +156 -131
- package/src/core/components/selection.js +310 -193
- package/src/core/components/timeline.js +236 -281
- package/src/core/components/visium.js +114 -97
- package/src/core/data-processor.js +413 -0
- package/src/core/fetch/condfetch.js +82 -82
- package/src/core/fetch/fetch.js +92 -92
- package/src/core/fetch/json.js +29 -29
- package/src/core/fetch/vfetch.js +42 -42
- package/src/core/hmr-client.js +724 -0
- package/src/core/liveEditor.js +44 -44
- package/src/core/modules/codeEditorWithPreview.js +104 -104
- package/src/core/modules/echarts/common.js +20 -20
- package/src/core/modules/echarts/gl.js +228 -0
- package/src/core/modules/echarts/presetHandler.js +41 -41
- package/src/core/modules/echarts/presets/esodev.chromium.js +172 -172
- package/src/core/modules/echarts/presets/esodev.codex.js +130 -130
- package/src/core/modules/echarts/presets/esodev.visium.js +123 -123
- package/src/core/modules/echarts/presets/mmtrbc.js +186 -186
- package/src/core/modules/echarts.js +70 -71
- package/src/core/modules/echartsUtils.js +43 -43
- package/src/core/modules/echartswitcher.js +227 -152
- package/src/core/modules/replotly/presetHandler.js +24 -24
- package/src/core/modules/replotly/presets/minimum.js +18 -18
- package/src/core/modules/replotly/presets/mmtrbc.dot.js +114 -114
- package/src/core/modules/replotly/presets/mmtrbc.violin.js +100 -100
- package/src/core/modules/replotly.js +74 -71
- package/src/core/modules/threejs/Camera.js +373 -0
- package/src/core/modules/threejs/Lighting.js +459 -0
- package/src/core/modules/threejs/Renderer.js +364 -0
- package/src/core/modules/threejs/Scene.js +266 -0
- package/src/core/modules/threejs/index.js +155 -0
- package/src/core/pages/404.js +50 -50
- package/src/core/pages/error.js +27 -27
- package/src/core/pages/jsonPage.js +62 -62
- package/src/core/pages/loading.js +44 -44
- package/src/core/parser/echart.data.js +204 -183
- package/src/core/parser/echart.features.js +125 -125
- package/src/core/parser/echart.general.js +147 -147
- package/src/core/parser/echart.hilbert.js +57 -57
- package/src/core/parser/echart.parser.js +210 -210
- package/src/core/parser/echart.series.js +67 -67
- package/src/core/parser/echart.types.js +76 -76
- package/src/core/parser/plotly.config.js +10 -10
- package/src/core/parser/plotly.data.js +132 -132
- package/src/core/parser/plotly.layout.js +9 -9
- package/src/core/parser/plotly.violin.js +18 -18
- package/src/core/recharts.js +361 -62
- package/src/core/router/alias.js +49 -49
- package/src/core/router/jsonRouter.js +31 -31
- package/src/core/themes/modern.js +32 -32
- package/src/core/themes/themeSelector.js +33 -33
- package/src/core/visualify.js +213 -47
- package/src/core/widgets/circularProgress.js +23 -23
- package/src/core/widgets/controller.js +116 -83
- package/src/core/widgets/errorBoundary.js +36 -36
- package/src/core/widgets/footer.js +185 -177
- package/src/core/widgets/header.js +238 -234
- package/src/core/widgets/layout/Grid.js +31 -31
- package/src/core/widgets/layout.js +36 -36
- package/src/core/widgets/mapping.js +56 -42
- package/src/core/workers/data-worker.js +349 -0
- package/src/core/workers/worker-pool.js +396 -0
- package/src/docsify/bundle.js +215 -0
- package/src/docsify/markdown.js +271 -0
- package/src/docsify/plugin.js +268 -0
- package/src/editor/README.md +172 -0
- package/src/editor/components/ChartBuilder.jsx +341 -0
- package/src/editor/components/ChartTypeSidebar.jsx +91 -0
- package/src/editor/components/Editor.jsx +367 -0
- package/src/editor/components/Preview.jsx +446 -0
- package/src/editor/components/PropertyPanel.jsx +468 -0
- package/src/editor/components/StatusBar.jsx +85 -0
- package/src/editor/context/EditorContext.js +248 -0
- package/src/editor/hooks/useDebounce.js +32 -0
- package/src/editor/index.js +315 -0
- package/src/editor/styles/editor.css +637 -0
- package/src/editor/utils/chartValidator.js +263 -0
- package/src/entries/charts3d.js +70 -0
- package/src/entries/core.js +78 -0
- package/src/entries/docs.js +154 -0
- package/src/entries/pages.js +93 -0
- package/src/entries/portal.js +204 -0
- package/src/entries/shared.js +50 -0
- package/src/i18n/formatters.js +455 -0
- package/src/i18n/index.js +169 -0
- package/src/i18n/locales/ar.json +137 -0
- package/src/i18n/locales/de.json +137 -0
- package/src/i18n/locales/en.json +137 -0
- package/src/i18n/locales/es.json +137 -0
- package/src/i18n/locales/he.json +137 -0
- package/src/i18n/locales/zh.json +137 -0
- package/src/i18n/rtl.css +183 -0
- package/src/index.js +82 -62
- package/src/loader.js +103 -0
- package/src/setupTests.js +5 -5
- package/tsconfig.json +51 -0
- package/types/charts.d.ts +569 -0
- package/types/components.d.ts +441 -0
- package/types/config.d.ts +199 -0
- package/types/index.d.ts +353 -0
package/docs/docs/hmr.md
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Hot Module Replacement (HMR)
|
|
2
|
+
|
|
3
|
+
Visualify.js includes a built-in HMR system for development that enables instant chart updates without page reloads.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
HMR allows you to:
|
|
8
|
+
- See chart changes instantly when editing configuration files
|
|
9
|
+
- Preserve chart state during updates
|
|
10
|
+
- Get visual feedback for configuration errors
|
|
11
|
+
- Work efficiently with iterative chart design
|
|
12
|
+
|
|
13
|
+
## How It Works
|
|
14
|
+
|
|
15
|
+
The HMR system consists of:
|
|
16
|
+
|
|
17
|
+
1. **File Watcher** - Monitors your visualization JSON files for changes
|
|
18
|
+
2. **WebSocket Server** - Pushes updates to the browser
|
|
19
|
+
3. **Client Handler** - Receives and applies updates while preserving state
|
|
20
|
+
4. **Error Overlay** - Displays configuration errors without breaking the app
|
|
21
|
+
|
|
22
|
+
## Enabling HMR
|
|
23
|
+
|
|
24
|
+
### In Development Mode
|
|
25
|
+
|
|
26
|
+
HMR is automatically enabled when using the Visualify CLI development server:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
visualify dev
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or with a specific configuration:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
visualify dev --config ./my-visualization.json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Programmatic API
|
|
39
|
+
|
|
40
|
+
Enable HMR when initializing Visualify:
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
import { initHMR } from 'visualify';
|
|
44
|
+
|
|
45
|
+
// Initialize HMR with custom options
|
|
46
|
+
const hmr = initHMR({
|
|
47
|
+
wsUrl: 'ws://localhost:3000/__hmr',
|
|
48
|
+
reconnectDelay: 1000,
|
|
49
|
+
maxReconnectAttempts: 10,
|
|
50
|
+
debug: false
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### React Hook
|
|
55
|
+
|
|
56
|
+
Use the `useHMR` hook in custom components:
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
import { useHMR } from 'visualify';
|
|
60
|
+
|
|
61
|
+
function MyChartComponent() {
|
|
62
|
+
useHMR({
|
|
63
|
+
onUpdate: (newConfig) => {
|
|
64
|
+
console.log('Configuration updated:', newConfig);
|
|
65
|
+
},
|
|
66
|
+
onError: (error) => {
|
|
67
|
+
console.error('HMR Error:', error);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
return <div>{/* Chart content */}</div>;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Configuration Options
|
|
76
|
+
|
|
77
|
+
| Option | Type | Default | Description |
|
|
78
|
+
|--------|------|---------|-------------|
|
|
79
|
+
| `wsUrl` | String | `'ws://localhost:3000/__hmr'` | WebSocket server URL |
|
|
80
|
+
| `reconnectDelay` | Number | `1000` | Delay between reconnection attempts (ms) |
|
|
81
|
+
| `maxReconnectAttempts` | Number | `10` | Maximum reconnection attempts |
|
|
82
|
+
| `heartbeatInterval` | Number | `30000` | WebSocket heartbeat interval (ms) |
|
|
83
|
+
| `debug` | Boolean | `false` | Enable debug logging |
|
|
84
|
+
|
|
85
|
+
## State Preservation
|
|
86
|
+
|
|
87
|
+
HMR preserves the following chart state during updates:
|
|
88
|
+
|
|
89
|
+
- Current zoom level and pan position
|
|
90
|
+
- Selected/highlighted data points
|
|
91
|
+
- Tooltip visibility
|
|
92
|
+
- Legend toggle states
|
|
93
|
+
- User interactions
|
|
94
|
+
|
|
95
|
+
To customize state preservation:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
import { preserveState } from 'visualify';
|
|
99
|
+
|
|
100
|
+
preserveState('myChart', {
|
|
101
|
+
save: () => ({
|
|
102
|
+
zoom: chart.getZoom(),
|
|
103
|
+
selection: chart.getSelection()
|
|
104
|
+
}),
|
|
105
|
+
restore: (state) => {
|
|
106
|
+
chart.setZoom(state.zoom);
|
|
107
|
+
chart.setSelection(state.selection);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Error Handling
|
|
113
|
+
|
|
114
|
+
HMR includes a visual error overlay that displays configuration errors:
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
import { setErrorOverlay } from 'visualify';
|
|
118
|
+
|
|
119
|
+
// Customize error overlay appearance
|
|
120
|
+
setErrorOverlay({
|
|
121
|
+
position: 'top-right',
|
|
122
|
+
timeout: 5000,
|
|
123
|
+
theme: 'dark'
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Disabling HMR
|
|
128
|
+
|
|
129
|
+
To disable HMR (e.g., for production builds):
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
// Set global flag before loading Visualify
|
|
133
|
+
window.__VISUALIFY_HMR__ = { enabled: false };
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Or via CLI:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
visualify build --no-hmr
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Best Practices
|
|
143
|
+
|
|
144
|
+
1. **Use HMR in development only** - Disable for production builds
|
|
145
|
+
2. **Handle state compatibility** - Ensure restored state is compatible with new config
|
|
146
|
+
3. **Test error scenarios** - Verify error overlays work with invalid configurations
|
|
147
|
+
4. **Monitor WebSocket connection** - Check console for reconnection warnings
|
|
148
|
+
|
|
149
|
+
## Troubleshooting
|
|
150
|
+
|
|
151
|
+
### HMR Not Connecting
|
|
152
|
+
|
|
153
|
+
- Verify the WebSocket URL matches your dev server
|
|
154
|
+
- Check firewall settings for WebSocket connections
|
|
155
|
+
- Ensure `window.__VISUALIFY_HMR__.enabled` is not set to `false`
|
|
156
|
+
|
|
157
|
+
### State Not Preserved
|
|
158
|
+
|
|
159
|
+
- Implement custom `preserveState` handlers for complex charts
|
|
160
|
+
- Check that state keys match between save and restore
|
|
161
|
+
|
|
162
|
+
### Performance Issues
|
|
163
|
+
|
|
164
|
+
- Increase `reconnectDelay` if experiencing frequent reconnections
|
|
165
|
+
- Disable HMR for charts with heavy data processing
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# Internationalization (i18n)
|
|
2
|
+
|
|
3
|
+
Visualify.js provides built-in internationalization support for multi-language chart applications.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The i18n system supports:
|
|
8
|
+
- Multiple language packs
|
|
9
|
+
- Runtime language switching
|
|
10
|
+
- Custom translation keys
|
|
11
|
+
- Number and date formatting
|
|
12
|
+
- RTL (Right-to-Left) language support
|
|
13
|
+
|
|
14
|
+
## Supported Languages
|
|
15
|
+
|
|
16
|
+
Built-in language packs:
|
|
17
|
+
|
|
18
|
+
| Language | Code | Status |
|
|
19
|
+
|----------|------|--------|
|
|
20
|
+
| English | `en` | ✓ Complete |
|
|
21
|
+
| Chinese (Simplified) | `zh-CN` | ✓ Complete |
|
|
22
|
+
| Chinese (Traditional) | `zh-TW` | ✓ Complete |
|
|
23
|
+
| Japanese | `ja` | ✓ Complete |
|
|
24
|
+
| Korean | `ko` | ✓ Complete |
|
|
25
|
+
| Spanish | `es` | ✓ Complete |
|
|
26
|
+
| French | `fr` | ✓ Complete |
|
|
27
|
+
| German | `de` | ✓ Complete |
|
|
28
|
+
| Russian | `ru` | ✓ Complete |
|
|
29
|
+
| Arabic | `ar` | ✓ RTL Support |
|
|
30
|
+
|
|
31
|
+
## Basic Usage
|
|
32
|
+
|
|
33
|
+
### Setting the Language
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { setLanguage, getLanguage } from 'visualify';
|
|
37
|
+
|
|
38
|
+
// Set language
|
|
39
|
+
setLanguage('zh-CN');
|
|
40
|
+
|
|
41
|
+
// Get current language
|
|
42
|
+
const currentLang = getLanguage(); // 'zh-CN'
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### In Configuration
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"type": "line",
|
|
50
|
+
"title": "Sales Data",
|
|
51
|
+
"i18n": {
|
|
52
|
+
"locale": "zh-CN",
|
|
53
|
+
"fallback": "en"
|
|
54
|
+
},
|
|
55
|
+
"data": { ... }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Translation Keys
|
|
60
|
+
|
|
61
|
+
### Default Keys
|
|
62
|
+
|
|
63
|
+
Visualify automatically translates these keys:
|
|
64
|
+
|
|
65
|
+
| Key | English | 中文 |
|
|
66
|
+
|-----|---------|------|
|
|
67
|
+
| `chart.title` | Chart Title | 图表标题 |
|
|
68
|
+
| `chart.noData` | No data available | 暂无数据 |
|
|
69
|
+
| `chart.loading` | Loading... | 加载中... |
|
|
70
|
+
| `tooltip.clickForDetails` | Click for details | 点击查看详情 |
|
|
71
|
+
| `legend.show` | Show | 显示 |
|
|
72
|
+
| `legend.hide` | Hide | 隐藏 |
|
|
73
|
+
| `axis.x` | X Axis | X轴 |
|
|
74
|
+
| `axis.y` | Y Axis | Y轴 |
|
|
75
|
+
| `data.value` | Value | 数值 |
|
|
76
|
+
| `data.category` | Category | 类别 |
|
|
77
|
+
|
|
78
|
+
### Custom Translations
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
import { addTranslations } from 'visualify';
|
|
82
|
+
|
|
83
|
+
// Add custom translations
|
|
84
|
+
addTranslations('en', {
|
|
85
|
+
'custom.revenue': 'Revenue',
|
|
86
|
+
'custom.profit': 'Profit Margin',
|
|
87
|
+
'custom.customers': 'Active Customers'
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
addTranslations('zh-CN', {
|
|
91
|
+
'custom.revenue': '收入',
|
|
92
|
+
'custom.profit': '利润率',
|
|
93
|
+
'custom.customers': '活跃客户'
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Using Translations
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"type": "bar",
|
|
102
|
+
"title": {
|
|
103
|
+
"text": "@custom.revenue"
|
|
104
|
+
},
|
|
105
|
+
"series": [{
|
|
106
|
+
"name": "@custom.profit",
|
|
107
|
+
"data": [25, 30, 35]
|
|
108
|
+
}]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Number Formatting
|
|
113
|
+
|
|
114
|
+
### Locale-Aware Formatting
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
import { formatNumber, formatCurrency } from 'visualify';
|
|
118
|
+
|
|
119
|
+
// Format number based on locale
|
|
120
|
+
formatNumber(1234567.89, 'de'); // "1.234.567,89"
|
|
121
|
+
formatNumber(1234567.89, 'en'); // "1,234,567.89"
|
|
122
|
+
|
|
123
|
+
// Currency formatting
|
|
124
|
+
formatCurrency(1234.50, 'USD', 'en'); // "$1,234.50"
|
|
125
|
+
formatCurrency(1234.50, 'EUR', 'de'); // "1.234,50 €"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### In Configuration
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"type": "line",
|
|
133
|
+
"yAxis": {
|
|
134
|
+
"type": "value",
|
|
135
|
+
"formatter": {
|
|
136
|
+
"type": "currency",
|
|
137
|
+
"currency": "USD",
|
|
138
|
+
"locale": "en"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Date Formatting
|
|
145
|
+
|
|
146
|
+
### Locale-Aware Dates
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
import { formatDate, parseDate } from 'visualify';
|
|
150
|
+
|
|
151
|
+
// Format dates
|
|
152
|
+
formatDate(new Date(), 'zh-CN', { dateStyle: 'long' });
|
|
153
|
+
// "2024年1月15日"
|
|
154
|
+
|
|
155
|
+
formatDate(new Date(), 'en', { dateStyle: 'medium' });
|
|
156
|
+
// "Jan 15, 2024"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Time Series Charts
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"type": "line",
|
|
164
|
+
"xAxis": {
|
|
165
|
+
"type": "time",
|
|
166
|
+
"timeFormat": {
|
|
167
|
+
"locale": "ja",
|
|
168
|
+
"pattern": "yyyy年MM月"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## RTL Support
|
|
175
|
+
|
|
176
|
+
### Enabling RTL
|
|
177
|
+
|
|
178
|
+
```javascript
|
|
179
|
+
import { setRTL } from 'visualify';
|
|
180
|
+
|
|
181
|
+
// Enable RTL layout
|
|
182
|
+
setRTL(true);
|
|
183
|
+
|
|
184
|
+
// Or in configuration
|
|
185
|
+
{
|
|
186
|
+
"i18n": {
|
|
187
|
+
"locale": "ar",
|
|
188
|
+
"rtl": true
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### RTL-Aware Components
|
|
194
|
+
|
|
195
|
+
When RTL is enabled:
|
|
196
|
+
- Charts flip horizontally
|
|
197
|
+
- Legends align to the right
|
|
198
|
+
- Tooltips adjust position
|
|
199
|
+
- Axis labels reverse order
|
|
200
|
+
|
|
201
|
+
## Loading Language Packs
|
|
202
|
+
|
|
203
|
+
### Dynamic Loading
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
import { loadLanguage } from 'visualify';
|
|
207
|
+
|
|
208
|
+
// Load language pack on demand
|
|
209
|
+
async function switchLanguage(lang) {
|
|
210
|
+
await loadLanguage(lang);
|
|
211
|
+
setLanguage(lang);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Usage
|
|
215
|
+
switchLanguage('es'); // Loads Spanish pack
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Bundling Languages
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
// Import specific language packs
|
|
222
|
+
import 'visualify/locales/zh-CN';
|
|
223
|
+
import 'visualify/locales/ja';
|
|
224
|
+
|
|
225
|
+
// Now available
|
|
226
|
+
setLanguage('zh-CN');
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## React Integration
|
|
230
|
+
|
|
231
|
+
### useTranslation Hook
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
import { useTranslation } from 'visualify';
|
|
235
|
+
|
|
236
|
+
function MyChart() {
|
|
237
|
+
const { t, locale, setLocale } = useTranslation();
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<div>
|
|
241
|
+
<h1>{t('chart.title')}</h1>
|
|
242
|
+
<select
|
|
243
|
+
value={locale}
|
|
244
|
+
onChange={(e) => setLocale(e.target.value)}
|
|
245
|
+
>
|
|
246
|
+
<option value="en">English</option>
|
|
247
|
+
<option value="zh-CN">中文</option>
|
|
248
|
+
</select>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Language Switcher Component
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
import { LanguageSwitcher } from 'visualify';
|
|
258
|
+
|
|
259
|
+
function App() {
|
|
260
|
+
return (
|
|
261
|
+
<LanguageSwitcher
|
|
262
|
+
languages={['en', 'zh-CN', 'ja', 'es']}
|
|
263
|
+
onChange={(lang) => console.log('Switched to:', lang)}
|
|
264
|
+
/>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Pluralization
|
|
270
|
+
|
|
271
|
+
### Handling Plurals
|
|
272
|
+
|
|
273
|
+
```javascript
|
|
274
|
+
import { pluralize } from 'visualify';
|
|
275
|
+
|
|
276
|
+
// Define plural forms
|
|
277
|
+
addTranslations('en', {
|
|
278
|
+
'items.zero': 'No items',
|
|
279
|
+
'items.one': 'One item',
|
|
280
|
+
'items.other': '{{count}} items'
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// Usage
|
|
284
|
+
pluralize('items', 0); // "No items"
|
|
285
|
+
pluralize('items', 1); // "One item"
|
|
286
|
+
pluralize('items', 5); // "5 items"
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Best Practices
|
|
290
|
+
|
|
291
|
+
1. **Use translation keys** - Avoid hardcoded strings
|
|
292
|
+
2. **Provide fallbacks** - Always have English as fallback
|
|
293
|
+
3. **Test RTL layouts** - Verify Arabic/Hebrew rendering
|
|
294
|
+
4. **Format numbers/dates** - Use locale-aware formatting
|
|
295
|
+
5. **Lazy load languages** - Load only needed language packs
|
|
296
|
+
|
|
297
|
+
## Creating Custom Language Packs
|
|
298
|
+
|
|
299
|
+
### Structure
|
|
300
|
+
|
|
301
|
+
```javascript
|
|
302
|
+
// locales/custom-lang.js
|
|
303
|
+
export default {
|
|
304
|
+
code: 'custom',
|
|
305
|
+
name: 'Custom Language',
|
|
306
|
+
rtl: false,
|
|
307
|
+
translations: {
|
|
308
|
+
'chart.title': 'Custom Title',
|
|
309
|
+
'chart.noData': 'No data',
|
|
310
|
+
// ... more keys
|
|
311
|
+
},
|
|
312
|
+
numberFormat: {
|
|
313
|
+
decimal: ',',
|
|
314
|
+
thousands: '.',
|
|
315
|
+
grouping: [3]
|
|
316
|
+
},
|
|
317
|
+
dateFormat: {
|
|
318
|
+
short: 'dd/MM/yyyy',
|
|
319
|
+
medium: 'dd MMM yyyy',
|
|
320
|
+
long: 'dd MMMM yyyy'
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Registration
|
|
326
|
+
|
|
327
|
+
```javascript
|
|
328
|
+
import { registerLanguage } from 'visualify';
|
|
329
|
+
import customLang from './locales/custom-lang';
|
|
330
|
+
|
|
331
|
+
registerLanguage(customLang);
|
|
332
|
+
```
|
package/docs/docs/log.md
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
|
-
# log
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
1.
|
|
7
|
-
2.
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
# log
|
|
2
|
+
|
|
3
|
+
## 3.0.0 (2026-02-19)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
1. Bundle splitting: separate core, 3D, and pages chunks for on-demand loading.
|
|
7
|
+
2. CDN loader (`visualify-loader.js`): auto-loads echarts/plotly/three.js from CDN — single `<script>` tag usage.
|
|
8
|
+
3. 3D visualization support: Scatter3D, Bar3D, Surface3D, Line3D via ECharts GL and Three.js.
|
|
9
|
+
4. Internationalization (i18n): 6 languages with RTL support.
|
|
10
|
+
5. Accessibility (a11y): keyboard navigation, ARIA labels, screen reader support.
|
|
11
|
+
6. Live code editor with real-time chart preview.
|
|
12
|
+
7. TypeScript configuration support with validation.
|
|
13
|
+
|
|
14
|
+
### Optimizations
|
|
15
|
+
1. Legacy IIFE bundle reduced from 9.6 MB to 1.8 MB by externalizing echarts, plotly, and three.js.
|
|
16
|
+
2. Removed debug `console.log` statements from production code.
|
|
17
|
+
3. Suppressed i18next default logger warnings.
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
1. Fixed infinite re-render loop caused by unstable useEffect dependencies.
|
|
21
|
+
2. Fixed Visium background image and visualMap coloring.
|
|
22
|
+
3. Stabilized React component keys to prevent double event binding.
|
|
23
|
+
|
|
24
|
+
## 2.5.3-1(2024-02-24)
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
1. Scatter examples added.
|
|
28
|
+
2. xAxis and yAxis now support Object type data.
|
|
29
|
+
|
|
30
|
+
|
package/docs/docs/more-pages.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# More pages
|
|
2
|
-
|
|
3
|
-
If you need more pages, you can simply create more `json` configuration files in
|
|
4
|
-
your visualify directory. If you create a file named `scatter`, then it is
|
|
5
|
-
accessible via `/scatter`.
|
|
6
|
-
|
|
7
|
-
For example, the directory structure is as follows:
|
|
8
|
-
|
|
9
|
-
```text
|
|
10
|
-
.
|
|
11
|
-
└── docs
|
|
12
|
-
├── index.html
|
|
13
|
-
├── scatter.json
|
|
14
|
-
└── honme.json
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Matching routes
|
|
18
|
-
|
|
19
|
-
```text
|
|
20
|
-
docs/home.json => http://domain.com
|
|
21
|
-
=> http://domain.com/home
|
|
22
|
-
docs/scatter.json => http://domain.com/scatter
|
|
23
|
-
```
|
|
1
|
+
# More pages
|
|
2
|
+
|
|
3
|
+
If you need more pages, you can simply create more `json` configuration files in
|
|
4
|
+
your visualify directory. If you create a file named `scatter`, then it is
|
|
5
|
+
accessible via `/scatter`.
|
|
6
|
+
|
|
7
|
+
For example, the directory structure is as follows:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
.
|
|
11
|
+
└── docs
|
|
12
|
+
├── index.html
|
|
13
|
+
├── scatter.json
|
|
14
|
+
└── honme.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Matching routes
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
docs/home.json => http://domain.com
|
|
21
|
+
=> http://domain.com/home
|
|
22
|
+
docs/scatter.json => http://domain.com/scatter
|
|
23
|
+
```
|