lightview 1.8.2 → 2.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/.codacy/cli.sh +149 -0
- package/.codacy/codacy.yaml +15 -0
- package/.github/instructions/codacy.instructions.md +72 -0
- package/.wranglerignore +21 -0
- package/README.md +1330 -19
- package/_headers +4 -0
- package/build.js +70 -0
- package/components/actions/button.js +151 -0
- package/components/actions/dropdown.js +120 -0
- package/components/actions/modal.js +146 -0
- package/components/actions/swap.js +118 -0
- package/components/daisyui.js +288 -0
- package/components/data-display/accordion.js +128 -0
- package/components/data-display/alert.js +112 -0
- package/components/data-display/avatar.js +170 -0
- package/components/data-display/badge.js +82 -0
- package/components/data-display/card.js +151 -0
- package/components/data-display/carousel.js +94 -0
- package/components/data-display/chart.js +220 -0
- package/components/data-display/chat.js +128 -0
- package/components/data-display/collapse.js +103 -0
- package/components/data-display/countdown.js +69 -0
- package/components/data-display/diff.js +111 -0
- package/components/data-display/kbd.js +65 -0
- package/components/data-display/loading.js +75 -0
- package/components/data-display/progress.js +79 -0
- package/components/data-display/radial-progress.js +88 -0
- package/components/data-display/skeleton.js +66 -0
- package/components/data-display/stats.js +159 -0
- package/components/data-display/table.js +146 -0
- package/components/data-display/timeline.js +146 -0
- package/components/data-display/toast.js +72 -0
- package/components/data-display/tooltip.js +74 -0
- package/components/data-input/checkbox.js +253 -0
- package/components/data-input/file-input.js +224 -0
- package/components/data-input/input.js +264 -0
- package/components/data-input/radio.js +338 -0
- package/components/data-input/range.js +204 -0
- package/components/data-input/rating.js +219 -0
- package/components/data-input/select.js +287 -0
- package/components/data-input/textarea.js +287 -0
- package/components/data-input/toggle.js +201 -0
- package/components/index.js +137 -0
- package/components/layout/divider.js +72 -0
- package/components/layout/drawer.js +142 -0
- package/components/layout/footer.js +100 -0
- package/components/layout/hero.js +109 -0
- package/components/layout/indicator.js +90 -0
- package/components/layout/join.js +78 -0
- package/components/layout/navbar.js +110 -0
- package/components/navigation/breadcrumbs.js +91 -0
- package/components/navigation/dock.js +103 -0
- package/components/navigation/menu.js +126 -0
- package/components/navigation/pagination.js +105 -0
- package/components/navigation/steps.js +89 -0
- package/components/navigation/tabs.css +177 -0
- package/components/navigation/tabs.js +123 -0
- package/components/theme/theme-switch.css +65 -0
- package/components/theme/theme-switch.js +177 -0
- package/docs/about.html +164 -0
- package/docs/api/computed.html +184 -0
- package/docs/api/effects.html +173 -0
- package/docs/api/elements.html +180 -0
- package/docs/api/enhance.html +225 -0
- package/docs/api/hypermedia.html +165 -0
- package/docs/api/index.html +178 -0
- package/docs/api/nav.html +18 -0
- package/docs/api/signals.html +136 -0
- package/docs/api/state.html +217 -0
- package/docs/assets/images/logo-favicon.svg +42 -0
- package/docs/assets/images/logo-static.svg +40 -0
- package/docs/assets/images/logo.svg +66 -0
- package/docs/assets/js/examplify.js +395 -0
- package/docs/assets/styles/site.css +1102 -0
- package/docs/assets/styles/themes.css +236 -0
- package/docs/components/accordion.html +439 -0
- package/docs/components/alert.html +528 -0
- package/docs/components/avatar.html +586 -0
- package/docs/components/badge.html +531 -0
- package/docs/components/breadcrumbs.html +278 -0
- package/docs/components/button.html +579 -0
- package/docs/components/card.html +561 -0
- package/docs/components/carousel.html +286 -0
- package/docs/components/chart-area.html +702 -0
- package/docs/components/chart-bar.html +782 -0
- package/docs/components/chart-column.html +735 -0
- package/docs/components/chart-line.html +794 -0
- package/docs/components/chart-pie.html +823 -0
- package/docs/components/chart.html +610 -15
- package/docs/components/chat.html +547 -0
- package/docs/components/checkbox.html +641 -0
- package/docs/components/collapse.html +536 -0
- package/docs/components/component-nav.html +53 -0
- package/docs/components/countdown.html +470 -0
- package/docs/components/diff.html +245 -0
- package/docs/components/divider.html +240 -0
- package/docs/components/dock.html +277 -0
- package/docs/components/drawer.html +515 -0
- package/docs/components/dropdown.html +479 -0
- package/docs/components/file-input.html +591 -0
- package/docs/components/footer.html +301 -0
- package/docs/components/gallery.html +504 -0
- package/docs/components/hero.html +264 -0
- package/docs/components/index.css +840 -0
- package/docs/components/index.html +735 -0
- package/docs/components/indicator.html +342 -0
- package/docs/components/input.html +644 -0
- package/docs/components/join.html +285 -0
- package/docs/components/kbd.html +322 -0
- package/docs/components/loading.html +521 -0
- package/docs/components/menu.html +461 -0
- package/docs/components/modal.html +639 -0
- package/docs/components/navbar.html +321 -0
- package/docs/components/pagination.html +279 -0
- package/docs/components/progress.html +514 -0
- package/docs/components/radial-progress.html +434 -0
- package/docs/components/radio.html +655 -0
- package/docs/components/range.html +611 -0
- package/docs/components/rating.html +642 -0
- package/docs/components/select.html +696 -0
- package/docs/components/sidebar-setup.js +93 -0
- package/docs/components/skeleton.html +447 -0
- package/docs/components/spinner.html +68 -0
- package/docs/components/stats.html +486 -0
- package/docs/components/steps.html +356 -0
- package/docs/components/swap.html +517 -0
- package/docs/components/switch.html +68 -0
- package/docs/components/table.html +668 -0
- package/docs/components/tabs.html +506 -0
- package/docs/components/text-input.html +68 -0
- package/docs/components/textarea.html +603 -0
- package/docs/components/timeline.html +485 -42
- package/docs/components/toast.html +474 -0
- package/docs/components/toggle.html +564 -0
- package/docs/components/tooltip.html +423 -0
- package/docs/examples/getting-started-example.html +40 -0
- package/docs/examples/index.html +93 -0
- package/docs/getting-started/index.html +739 -0
- package/docs/getting-started/reviews.html +23 -0
- package/docs/getting-started/reviews.odom +108 -0
- package/docs/getting-started/reviews.vdom +84 -0
- package/docs/index.html +132 -42
- package/docs/playground.html +416 -0
- package/docs/router.html +285 -0
- package/docs/styles/index.html +190 -0
- package/functions/_middleware.js +32 -0
- package/index.html +309 -0
- package/lightview-router.js +364 -0
- package/lightview-x.js +1577 -0
- package/lightview.js +659 -1200
- package/middleware/locale.js +25 -0
- package/middleware/markdown.js +44 -0
- package/middleware/notFound.js +37 -0
- package/package.json +27 -41
- package/watch.js +92 -0
- package/wrangler.toml +12 -0
- package/.idea/lightview.iml +0 -12
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/LICENSE +0 -21
- package/codepen-no-tabs-embed.css +0 -2
- package/docs/CNAME +0 -1
- package/docs/api.html +0 -674
- package/docs/blank.html +0 -10
- package/docs/comparedto.html +0 -89
- package/docs/components/chart-repl.html +0 -69
- package/docs/components/components.js +0 -113
- package/docs/components/contents.html +0 -17
- package/docs/components/gantt-repl.html +0 -61
- package/docs/components/gantt.html +0 -42
- package/docs/components/gauge-repl.html +0 -66
- package/docs/components/gauge.html +0 -20
- package/docs/components/orgchart-repl.html +0 -64
- package/docs/components/orgchart.html +0 -41
- package/docs/components/repl-as-src.html +0 -17
- package/docs/components/repl-repl.html +0 -95
- package/docs/components/repl.html +0 -527
- package/docs/components/timeline-repl.html +0 -72
- package/docs/components.html +0 -14
- package/docs/css/highlightjs.min.css +0 -9
- package/docs/css/tutorial.css +0 -35
- package/docs/examples/anchor.html +0 -11
- package/docs/examples/chart.html +0 -34
- package/docs/examples/counter.html +0 -26
- package/docs/examples/counter.test.mjs +0 -47
- package/docs/examples/counter2.html +0 -26
- package/docs/examples/directives.html +0 -79
- package/docs/examples/foreign.html +0 -50
- package/docs/examples/forgeinform.html +0 -98
- package/docs/examples/form.html +0 -61
- package/docs/examples/gauge.html +0 -18
- package/docs/examples/invalid-template-literals.html +0 -44
- package/docs/examples/medium/remote.html +0 -60
- package/docs/examples/message.html +0 -18
- package/docs/examples/nested.html +0 -11
- package/docs/examples/object-bound-form.html +0 -34
- package/docs/examples/remote-server.js +0 -51
- package/docs/examples/remote.html +0 -34
- package/docs/examples/remote.json +0 -1
- package/docs/examples/scratch.html +0 -69
- package/docs/examples/sensors/index.html +0 -44
- package/docs/examples/sensors/sensor-server.js +0 -30
- package/docs/examples/shared.html +0 -41
- package/docs/examples/template.html +0 -33
- package/docs/examples/timeline.html +0 -21
- package/docs/examples/todo.html +0 -40
- package/docs/examples/top.html +0 -10
- package/docs/examples/types.html +0 -94
- package/docs/examples/xor.html +0 -62
- package/docs/examples.html +0 -25
- package/docs/javascript/codejar.min.js +0 -8
- package/docs/javascript/highlightjs.min.js +0 -1173
- package/docs/javascript/isomorphic-git.js +0 -9
- package/docs/javascript/json5.min.js +0 -1
- package/docs/javascript/lightning-fs.js +0 -1
- package/docs/javascript/lightview.js +0 -1285
- package/docs/javascript/marked.min.js +0 -6
- package/docs/javascript/peerjs.min.js +0 -70
- package/docs/javascript/turndown.js +0 -973
- package/docs/javascript/types.js +0 -606
- package/docs/javascript/utils.js +0 -45
- package/docs/lightview.html +0 -63
- package/docs/old_index.html +0 -965
- package/docs/old_index.md +0 -1132
- package/docs/slidein.html +0 -51
- package/docs/tutorial/0-getting-started.html +0 -67
- package/docs/tutorial/1-intro-to-variables.html +0 -103
- package/docs/tutorial/10-template-components.html +0 -80
- package/docs/tutorial/11-linked-components.html +0 -76
- package/docs/tutorial/12-imported-components.html +0 -67
- package/docs/tutorial/13-input-binding.html +0 -94
- package/docs/tutorial/14-automatic-variable-creation.html +0 -74
- package/docs/tutorial/15-form-binding.html +0 -110
- package/docs/tutorial/16-if-directive.html +0 -60
- package/docs/tutorial/17-loop-directives.html +0 -83
- package/docs/tutorial/18-sanitizing-and-escaping-input.html +0 -79
- package/docs/tutorial/2-imported-and-exported-variables.html +0 -80
- package/docs/tutorial/3-data-types.html +0 -89
- package/docs/tutorial/4-extended-data-types.html +0 -83
- package/docs/tutorial/5-extended-functional-types.html +0 -96
- package/docs/tutorial/5.1-extended-functional-types.html +0 -79
- package/docs/tutorial/5.2-extended-functional-types.html +0 -70
- package/docs/tutorial/6-conventional-javascript.html +0 -75
- package/docs/tutorial/7-monitoring-with-observers.html +0 -107
- package/docs/tutorial/8-event-listeners.html +0 -65
- package/docs/tutorial/9-intro-to-components.html +0 -91
- package/docs/tutorial/contents.html +0 -32
- package/docs/tutorial/my-component.html +0 -29
- package/docs/tutorial/remote-value.json +0 -4
- package/docs/websiterepl.html +0 -46
- package/jest-puppeteer.config.js +0 -5
- package/jest.config.json +0 -12
- package/lightview.min.js +0 -1
- package/lightview_good.js +0 -1267
- package/lightview_optimized.js +0 -1274
- package/repl_hold.html +0 -320
- package/test/basic.html +0 -104
- package/test/basic.test.mjs +0 -315
- package/test/extended.html +0 -29
- package/test/extended.test.mjs +0 -448
- package/types.js +0 -607
- package/unsplash.key +0 -1
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
<!-- SEO-friendly SPA Shim -->
|
|
2
|
+
<script src="/lightview-router.js"></script>
|
|
3
|
+
<script>
|
|
4
|
+
if (window.LightviewRouter) {
|
|
5
|
+
LightviewRouter.base('/index.html');
|
|
6
|
+
}
|
|
7
|
+
</script>
|
|
8
|
+
<script type="module" src="../../components/data-display/chart.js"></script>
|
|
9
|
+
|
|
10
|
+
<!-- Load the page-specific stylesheet -->
|
|
11
|
+
<link rel="stylesheet" href="./index.css">
|
|
12
|
+
|
|
13
|
+
<!-- Gallery Structure -->
|
|
14
|
+
<div class="gallery-page">
|
|
15
|
+
<div class="gallery-layout">
|
|
16
|
+
<!-- Sidebar Overlay -->
|
|
17
|
+
<div id="sidebar-overlay" class="sidebar-overlay"></div>
|
|
18
|
+
|
|
19
|
+
<!-- Sidebar -->
|
|
20
|
+
<div id="gallery-sidebar" class="gallery-sidebar" style="visibility: hidden" src="./component-nav.html"></div>
|
|
21
|
+
|
|
22
|
+
<!-- Main Content -->
|
|
23
|
+
<div id="gallery-main" class="gallery-main">
|
|
24
|
+
<!-- Header Container -->
|
|
25
|
+
<div
|
|
26
|
+
style="position: sticky; top: 0; z-index: 30; background: var(--gallery-surface); border-bottom: 1px solid var(--gallery-border); backdrop-filter: blur(8px);">
|
|
27
|
+
<!-- Breadcrumbs Row -->
|
|
28
|
+
<div style="padding: 0.75rem 1.5rem 0;">
|
|
29
|
+
<script>
|
|
30
|
+
(() => {
|
|
31
|
+
const { Breadcrumbs } = Lightview.tags;
|
|
32
|
+
const breadcrumbs = Breadcrumbs({
|
|
33
|
+
id: 'page-breadcrumbs',
|
|
34
|
+
items: [
|
|
35
|
+
{ label: 'Components', href: '/docs/components' },
|
|
36
|
+
{ label: 'Chart Area' }
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
document.currentScript.replaceWith(breadcrumbs.domEl);
|
|
40
|
+
})();
|
|
41
|
+
</script>
|
|
42
|
+
</div>
|
|
43
|
+
<!-- Title Row -->
|
|
44
|
+
<div class="gallery-header"
|
|
45
|
+
style="border-bottom: none; height: auto; padding-top: 0.5rem; padding-bottom: 0.75rem;">
|
|
46
|
+
<button id="toggle-btn" class="toggle-btn" aria-label="Toggle Sidebar">
|
|
47
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="toggle-icon"
|
|
48
|
+
style="stroke: currentColor; stroke-width: 2;">
|
|
49
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
|
|
50
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M11 19l-7-7 7-7" />
|
|
51
|
+
</svg>
|
|
52
|
+
</button>
|
|
53
|
+
<h1 class="gallery-title">Chart Area</h1>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<!-- Content -->
|
|
58
|
+
<div class="gallery-content">
|
|
59
|
+
<div class="section-content" style="max-width: 1000px;">
|
|
60
|
+
<p class="text-lg" style="opacity: 0.7; margin-bottom: 1.5rem;">
|
|
61
|
+
Area charts are similar to line charts but with the area below the line filled in,
|
|
62
|
+
making them ideal for showing volume or cumulative data.
|
|
63
|
+
</p>
|
|
64
|
+
|
|
65
|
+
<!-- Basic Usage -->
|
|
66
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
67
|
+
<div class="card-body">
|
|
68
|
+
<h2 class="card-title">Basic Usage</h2>
|
|
69
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">
|
|
70
|
+
To visualize data with an area chart, use <code>type: 'area'</code>. Like line charts,
|
|
71
|
+
area charts require both <code>start</code> and <code>value</code>.
|
|
72
|
+
</p>
|
|
73
|
+
|
|
74
|
+
<!-- Tabs -->
|
|
75
|
+
<script>
|
|
76
|
+
window.switchBasicAreaTab = (tabId) => {
|
|
77
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
78
|
+
tabs.forEach(t => {
|
|
79
|
+
const tabEl = document.getElementById(`basic-area-tab-btn-${t}`);
|
|
80
|
+
const contentEl = document.getElementById(`basic-area-syntax-${t}`);
|
|
81
|
+
if (t === tabId) {
|
|
82
|
+
tabEl.classList.add('syntax-tab-active');
|
|
83
|
+
contentEl.style.display = 'block';
|
|
84
|
+
} else {
|
|
85
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
86
|
+
contentEl.style.display = 'none';
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
</script>
|
|
91
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
92
|
+
<button id="basic-area-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
93
|
+
onclick="switchBasicAreaTab('tagged')">Tagged</button>
|
|
94
|
+
<button id="basic-area-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
95
|
+
onclick="switchBasicAreaTab('vdom')">vDOM</button>
|
|
96
|
+
<button id="basic-area-tab-btn-object" role="tab" class="syntax-tab"
|
|
97
|
+
onclick="switchBasicAreaTab('object')">Object DOM</button>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<!-- Tagged Syntax -->
|
|
101
|
+
<div id="basic-area-syntax-tagged">
|
|
102
|
+
<pre><script>
|
|
103
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
104
|
+
at: document.currentScript.parentElement,
|
|
105
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
106
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
107
|
+
type: 'module',
|
|
108
|
+
minHeight: 250,
|
|
109
|
+
autoRun: true
|
|
110
|
+
});
|
|
111
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
112
|
+
const { tags, $ } = Lightview;
|
|
113
|
+
const { Chart } = tags;
|
|
114
|
+
|
|
115
|
+
const chart = Chart({
|
|
116
|
+
type: 'area',
|
|
117
|
+
labels: true,
|
|
118
|
+
primaryAxis: true,
|
|
119
|
+
style: 'width: 100%; max-width: 600px; height: 250px; margin: 0 auto;'
|
|
120
|
+
},
|
|
121
|
+
Chart.Body({},
|
|
122
|
+
Chart.Row({}, Chart.Label({}, 'Jan'), Chart.Data({ start: 0.2, value: 0.4 })),
|
|
123
|
+
Chart.Row({}, Chart.Label({}, 'Feb'), Chart.Data({ start: 0.4, value: 0.6 })),
|
|
124
|
+
Chart.Row({}, Chart.Label({}, 'Mar'), Chart.Data({ start: 0.6, value: 0.5 })),
|
|
125
|
+
Chart.Row({}, Chart.Label({}, 'Apr'), Chart.Data({ start: 0.5, value: 0.8 })),
|
|
126
|
+
Chart.Row({}, Chart.Label({}, 'May'), Chart.Data({ start: 0.8, value: 0.7 }))
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
$('#example').content(chart);</code></pre>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<!-- vDOM Syntax -->
|
|
134
|
+
<div id="basic-area-syntax-vdom" style="display: none;">
|
|
135
|
+
<pre><script>
|
|
136
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
137
|
+
at: document.currentScript.parentElement,
|
|
138
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
139
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
140
|
+
type: 'module',
|
|
141
|
+
minHeight: 250
|
|
142
|
+
});
|
|
143
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
144
|
+
const { tags, $ } = Lightview;
|
|
145
|
+
const { Chart } = tags;
|
|
146
|
+
|
|
147
|
+
const months = [
|
|
148
|
+
{ label: 'Jan', start: 0.2, value: 0.4 },
|
|
149
|
+
{ label: 'Feb', start: 0.4, value: 0.6 },
|
|
150
|
+
{ label: 'Mar', start: 0.6, value: 0.5 },
|
|
151
|
+
{ label: 'Apr', start: 0.5, value: 0.8 },
|
|
152
|
+
{ label: 'May', start: 0.8, value: 0.7 }
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const chart = {
|
|
156
|
+
tag: Chart,
|
|
157
|
+
attributes: {
|
|
158
|
+
type: 'area',
|
|
159
|
+
labels: true,
|
|
160
|
+
primaryAxis: true,
|
|
161
|
+
style: 'width: 100%; max-width: 600px; height: 250px; margin: 0 auto;'
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
{
|
|
165
|
+
tag: Chart.Body,
|
|
166
|
+
children: months.map(m => ({
|
|
167
|
+
tag: Chart.Row,
|
|
168
|
+
children: [
|
|
169
|
+
{ tag: Chart.Label, children: [m.label] },
|
|
170
|
+
{ tag: Chart.Data, attributes: { start: m.start, value: m.value } }
|
|
171
|
+
]
|
|
172
|
+
}))
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
$('#example').content(chart);</code></pre>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<!-- Object DOM Syntax -->
|
|
181
|
+
<div id="basic-area-syntax-object" style="display: none;">
|
|
182
|
+
<pre><script>
|
|
183
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
184
|
+
at: document.currentScript.parentElement,
|
|
185
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
186
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
187
|
+
type: 'module',
|
|
188
|
+
minHeight: 250
|
|
189
|
+
});
|
|
190
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
191
|
+
const { $ } = Lightview;
|
|
192
|
+
|
|
193
|
+
const chart = {
|
|
194
|
+
Chart: {
|
|
195
|
+
type: 'area',
|
|
196
|
+
labels: true,
|
|
197
|
+
primaryAxis: true,
|
|
198
|
+
style: 'width: 100%; max-width: 600px; height: 250px; margin: 0 auto;',
|
|
199
|
+
children: [
|
|
200
|
+
{
|
|
201
|
+
'Chart.Body': {
|
|
202
|
+
children: [
|
|
203
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Jan'] } }, { 'Chart.Data': { start: 0.2, value: 0.4 } }] } },
|
|
204
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Feb'] } }, { 'Chart.Data': { start: 0.4, value: 0.6 } }] } },
|
|
205
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Mar'] } }, { 'Chart.Data': { start: 0.6, value: 0.5 } }] } },
|
|
206
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Apr'] } }, { 'Chart.Data': { start: 0.5, value: 0.8 } }] } },
|
|
207
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['May'] } }, { 'Chart.Data': { start: 0.8, value: 0.7 } }] } }
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
$('#example').content(chart);</code></pre>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<!-- Multiple Datasets -->
|
|
221
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
222
|
+
<div class="card-body">
|
|
223
|
+
<h2 class="card-title">Multiple Datasets</h2>
|
|
224
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">
|
|
225
|
+
Create layered areas with multiple datasets.
|
|
226
|
+
</p>
|
|
227
|
+
|
|
228
|
+
<!-- Tabs -->
|
|
229
|
+
<script>
|
|
230
|
+
window.switchMultipleAreaTab = (tabId) => {
|
|
231
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
232
|
+
tabs.forEach(t => {
|
|
233
|
+
const tabEl = document.getElementById(`multiple-area-tab-btn-${t}`);
|
|
234
|
+
const contentEl = document.getElementById(`multiple-area-syntax-${t}`);
|
|
235
|
+
if (t === tabId) {
|
|
236
|
+
tabEl.classList.add('syntax-tab-active');
|
|
237
|
+
contentEl.style.display = 'block';
|
|
238
|
+
} else {
|
|
239
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
240
|
+
contentEl.style.display = 'none';
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
</script>
|
|
245
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
246
|
+
<button id="multiple-area-tab-btn-tagged" role="tab"
|
|
247
|
+
class="syntax-tab syntax-tab-active"
|
|
248
|
+
onclick="switchMultipleAreaTab('tagged')">Tagged</button>
|
|
249
|
+
<button id="multiple-area-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
250
|
+
onclick="switchMultipleAreaTab('vdom')">vDOM</button>
|
|
251
|
+
<button id="multiple-area-tab-btn-object" role="tab" class="syntax-tab"
|
|
252
|
+
onclick="switchMultipleAreaTab('object')">Object DOM</button>
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
<!-- Tagged Syntax -->
|
|
256
|
+
<div id="multiple-area-syntax-tagged">
|
|
257
|
+
<pre><script>
|
|
258
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
259
|
+
at: document.currentScript.parentElement,
|
|
260
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
261
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
262
|
+
type: 'module',
|
|
263
|
+
minHeight: 280,
|
|
264
|
+
autoRun: true
|
|
265
|
+
});
|
|
266
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
267
|
+
const { tags, $ } = Lightview;
|
|
268
|
+
const { Chart } = tags;
|
|
269
|
+
|
|
270
|
+
const chart = Chart({
|
|
271
|
+
type: 'area',
|
|
272
|
+
multiple: true,
|
|
273
|
+
labels: true,
|
|
274
|
+
primaryAxis: true,
|
|
275
|
+
style: 'width: 100%; max-width: 600px; height: 280px; margin: 0 auto; --color-1: rgba(76, 175, 80, 0.5); --color-2: rgba(33, 150, 243, 0.5); --color-3: rgba(255, 152, 0, 0.5);'
|
|
276
|
+
},
|
|
277
|
+
Chart.Body({},
|
|
278
|
+
Chart.Row({},
|
|
279
|
+
Chart.Label({}, 'Q1'),
|
|
280
|
+
Chart.Data({ start: 0.1, value: 0.3 }),
|
|
281
|
+
Chart.Data({ start: 0.2, value: 0.4 }),
|
|
282
|
+
Chart.Data({ start: 0.15, value: 0.35 })
|
|
283
|
+
),
|
|
284
|
+
Chart.Row({},
|
|
285
|
+
Chart.Label({}, 'Q2'),
|
|
286
|
+
Chart.Data({ start: 0.3, value: 0.5 }),
|
|
287
|
+
Chart.Data({ start: 0.4, value: 0.6 }),
|
|
288
|
+
Chart.Data({ start: 0.35, value: 0.5 })
|
|
289
|
+
),
|
|
290
|
+
Chart.Row({},
|
|
291
|
+
Chart.Label({}, 'Q3'),
|
|
292
|
+
Chart.Data({ start: 0.5, value: 0.4 }),
|
|
293
|
+
Chart.Data({ start: 0.6, value: 0.5 }),
|
|
294
|
+
Chart.Data({ start: 0.5, value: 0.6 })
|
|
295
|
+
),
|
|
296
|
+
Chart.Row({},
|
|
297
|
+
Chart.Label({}, 'Q4'),
|
|
298
|
+
Chart.Data({ start: 0.4, value: 0.7 }),
|
|
299
|
+
Chart.Data({ start: 0.5, value: 0.8 }),
|
|
300
|
+
Chart.Data({ start: 0.6, value: 0.75 })
|
|
301
|
+
)
|
|
302
|
+
)
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
$('#example').content(chart);</code></pre>
|
|
306
|
+
</div>
|
|
307
|
+
|
|
308
|
+
<!-- vDOM Syntax -->
|
|
309
|
+
<div id="multiple-area-syntax-vdom" style="display: none;">
|
|
310
|
+
<pre><script>
|
|
311
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
312
|
+
at: document.currentScript.parentElement,
|
|
313
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
314
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
315
|
+
type: 'module',
|
|
316
|
+
minHeight: 280
|
|
317
|
+
});
|
|
318
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
319
|
+
const { tags, $ } = Lightview;
|
|
320
|
+
const { Chart } = tags;
|
|
321
|
+
|
|
322
|
+
const quarters = [
|
|
323
|
+
{ label: 'Q1', data: [[0.1, 0.3], [0.2, 0.4], [0.15, 0.35]] },
|
|
324
|
+
{ label: 'Q2', data: [[0.3, 0.5], [0.4, 0.6], [0.35, 0.5]] },
|
|
325
|
+
{ label: 'Q3', data: [[0.5, 0.4], [0.6, 0.5], [0.5, 0.6]] },
|
|
326
|
+
{ label: 'Q4', data: [[0.4, 0.7], [0.5, 0.8], [0.6, 0.75]] }
|
|
327
|
+
];
|
|
328
|
+
|
|
329
|
+
const chart = {
|
|
330
|
+
tag: Chart,
|
|
331
|
+
attributes: {
|
|
332
|
+
type: 'area',
|
|
333
|
+
multiple: true,
|
|
334
|
+
labels: true,
|
|
335
|
+
primaryAxis: true,
|
|
336
|
+
style: 'width: 100%; max-width: 600px; height: 280px; margin: 0 auto; --color-1: rgba(76, 175, 80, 0.5); --color-2: rgba(33, 150, 243, 0.5); --color-3: rgba(255, 152, 0, 0.5);'
|
|
337
|
+
},
|
|
338
|
+
children: [
|
|
339
|
+
{
|
|
340
|
+
tag: Chart.Body,
|
|
341
|
+
children: quarters.map(q => ({
|
|
342
|
+
tag: Chart.Row,
|
|
343
|
+
children: [
|
|
344
|
+
{ tag: Chart.Label, children: [q.label] },
|
|
345
|
+
...q.data.map(([start, value]) => ({
|
|
346
|
+
tag: Chart.Data,
|
|
347
|
+
attributes: { start, value }
|
|
348
|
+
}))
|
|
349
|
+
]
|
|
350
|
+
}))
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
$('#example').content(chart);</code></pre>
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
<!-- Object DOM Syntax -->
|
|
359
|
+
<div id="multiple-area-syntax-object" style="display: none;">
|
|
360
|
+
<pre><script>
|
|
361
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
362
|
+
at: document.currentScript.parentElement,
|
|
363
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
364
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
365
|
+
type: 'module',
|
|
366
|
+
minHeight: 280
|
|
367
|
+
});
|
|
368
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
369
|
+
const { $ } = Lightview;
|
|
370
|
+
|
|
371
|
+
const chart = {
|
|
372
|
+
Chart: {
|
|
373
|
+
type: 'area',
|
|
374
|
+
multiple: true,
|
|
375
|
+
labels: true,
|
|
376
|
+
primaryAxis: true,
|
|
377
|
+
style: 'width: 100%; max-width: 600px; height: 280px; margin: 0 auto; --color-1: rgba(76, 175, 80, 0.5); --color-2: rgba(33, 150, 243, 0.5); --color-3: rgba(255, 152, 0, 0.5);',
|
|
378
|
+
children: [
|
|
379
|
+
{
|
|
380
|
+
'Chart.Body': {
|
|
381
|
+
children: [
|
|
382
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Q1'] } }, { 'Chart.Data': { start: 0.1, value: 0.3 } }, { 'Chart.Data': { start: 0.2, value: 0.4 } }, { 'Chart.Data': { start: 0.15, value: 0.35 } }] } },
|
|
383
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Q2'] } }, { 'Chart.Data': { start: 0.3, value: 0.5 } }, { 'Chart.Data': { start: 0.4, value: 0.6 } }, { 'Chart.Data': { start: 0.35, value: 0.5 } }] } },
|
|
384
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Q3'] } }, { 'Chart.Data': { start: 0.5, value: 0.4 } }, { 'Chart.Data': { start: 0.6, value: 0.5 } }, { 'Chart.Data': { start: 0.5, value: 0.6 } }] } },
|
|
385
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Q4'] } }, { 'Chart.Data': { start: 0.4, value: 0.7 } }, { 'Chart.Data': { start: 0.5, value: 0.8 } }, { 'Chart.Data': { start: 0.6, value: 0.75 } }] } }
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
$('#example').content(chart);</code></pre>
|
|
394
|
+
</div>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<!-- Axes and Grid -->
|
|
399
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
400
|
+
<div class="card-body">
|
|
401
|
+
<h2 class="card-title">Axes and Grid</h2>
|
|
402
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">
|
|
403
|
+
Add grid lines with <code>primaryAxis</code> and <code>secondaryAxis</code>.
|
|
404
|
+
</p>
|
|
405
|
+
|
|
406
|
+
<!-- Tabs -->
|
|
407
|
+
<script>
|
|
408
|
+
window.switchAxesAreaTab = (tabId) => {
|
|
409
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
410
|
+
tabs.forEach(t => {
|
|
411
|
+
const tabEl = document.getElementById(`axes-area-tab-btn-${t}`);
|
|
412
|
+
const contentEl = document.getElementById(`axes-area-syntax-${t}`);
|
|
413
|
+
if (t === tabId) {
|
|
414
|
+
tabEl.classList.add('syntax-tab-active');
|
|
415
|
+
contentEl.style.display = 'block';
|
|
416
|
+
} else {
|
|
417
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
418
|
+
contentEl.style.display = 'none';
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
};
|
|
422
|
+
</script>
|
|
423
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
424
|
+
<button id="axes-area-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
425
|
+
onclick="switchAxesAreaTab('tagged')">Tagged</button>
|
|
426
|
+
<button id="axes-area-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
427
|
+
onclick="switchAxesAreaTab('vdom')">vDOM</button>
|
|
428
|
+
<button id="axes-area-tab-btn-object" role="tab" class="syntax-tab"
|
|
429
|
+
onclick="switchAxesAreaTab('object')">Object DOM</button>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<!-- Tagged Syntax -->
|
|
433
|
+
<div id="axes-area-syntax-tagged">
|
|
434
|
+
<pre><script>
|
|
435
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
436
|
+
at: document.currentScript.parentElement,
|
|
437
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
438
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
439
|
+
type: 'module',
|
|
440
|
+
minHeight: 280,
|
|
441
|
+
autoRun: true
|
|
442
|
+
});
|
|
443
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
444
|
+
const { tags, $ } = Lightview;
|
|
445
|
+
const { Chart } = tags;
|
|
446
|
+
|
|
447
|
+
const chart = Chart({
|
|
448
|
+
type: 'area',
|
|
449
|
+
labels: true,
|
|
450
|
+
primaryAxis: true,
|
|
451
|
+
secondaryAxis: 'show-4-secondary-axes',
|
|
452
|
+
style: 'width: 100%; max-width: 600px; height: 280px; margin: 0 auto;'
|
|
453
|
+
},
|
|
454
|
+
Chart.Body({},
|
|
455
|
+
Chart.Row({}, Chart.Label({}, '1'), Chart.Data({ start: 0.0, value: 0.25 })),
|
|
456
|
+
Chart.Row({}, Chart.Label({}, '2'), Chart.Data({ start: 0.25, value: 0.5 })),
|
|
457
|
+
Chart.Row({}, Chart.Label({}, '3'), Chart.Data({ start: 0.5, value: 0.75 })),
|
|
458
|
+
Chart.Row({}, Chart.Label({}, '4'), Chart.Data({ start: 0.75, value: 0.5 })),
|
|
459
|
+
Chart.Row({}, Chart.Label({}, '5'), Chart.Data({ start: 0.5, value: 1.0 }))
|
|
460
|
+
)
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
$('#example').content(chart);</code></pre>
|
|
464
|
+
</div>
|
|
465
|
+
|
|
466
|
+
<!-- vDOM Syntax -->
|
|
467
|
+
<div id="axes-area-syntax-vdom" style="display: none;">
|
|
468
|
+
<pre><script>
|
|
469
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
470
|
+
at: document.currentScript.parentElement,
|
|
471
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
472
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
473
|
+
type: 'module',
|
|
474
|
+
minHeight: 280
|
|
475
|
+
});
|
|
476
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
477
|
+
const { tags, $ } = Lightview;
|
|
478
|
+
const { Chart } = tags;
|
|
479
|
+
|
|
480
|
+
const data = [
|
|
481
|
+
[0.0, 0.25], [0.25, 0.5], [0.5, 0.75],
|
|
482
|
+
[0.75, 0.5], [0.5, 1.0]
|
|
483
|
+
];
|
|
484
|
+
|
|
485
|
+
const chart = {
|
|
486
|
+
tag: Chart,
|
|
487
|
+
attributes: {
|
|
488
|
+
type: 'area',
|
|
489
|
+
labels: true,
|
|
490
|
+
primaryAxis: true,
|
|
491
|
+
secondaryAxis: 'show-4-secondary-axes',
|
|
492
|
+
style: 'width: 100%; max-width: 600px; height: 280px; margin: 0 auto;'
|
|
493
|
+
},
|
|
494
|
+
children: [
|
|
495
|
+
{
|
|
496
|
+
tag: Chart.Body,
|
|
497
|
+
children: data.map(([start, value], i) => ({
|
|
498
|
+
tag: Chart.Row,
|
|
499
|
+
children: [
|
|
500
|
+
{ tag: Chart.Label, children: [String(i + 1)] },
|
|
501
|
+
{ tag: Chart.Data, attributes: { start, value } }
|
|
502
|
+
]
|
|
503
|
+
}))
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
};
|
|
507
|
+
|
|
508
|
+
$('#example').content(chart);</code></pre>
|
|
509
|
+
</div>
|
|
510
|
+
|
|
511
|
+
<!-- Object DOM Syntax -->
|
|
512
|
+
<div id="axes-area-syntax-object" style="display: none;">
|
|
513
|
+
<pre><script>
|
|
514
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
515
|
+
at: document.currentScript.parentElement,
|
|
516
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
517
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
518
|
+
type: 'module',
|
|
519
|
+
minHeight: 280
|
|
520
|
+
});
|
|
521
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
522
|
+
const { $ } = Lightview;
|
|
523
|
+
|
|
524
|
+
const chart = {
|
|
525
|
+
Chart: {
|
|
526
|
+
type: 'area',
|
|
527
|
+
labels: true,
|
|
528
|
+
primaryAxis: true,
|
|
529
|
+
secondaryAxis: 'show-4-secondary-axes',
|
|
530
|
+
style: 'width: 100%; max-width: 600px; height: 280px; margin: 0 auto;',
|
|
531
|
+
children: [
|
|
532
|
+
{
|
|
533
|
+
'Chart.Body': {
|
|
534
|
+
children: [
|
|
535
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['1'] } }, { 'Chart.Data': { start: 0.0, value: 0.25 } }] } },
|
|
536
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['2'] } }, { 'Chart.Data': { start: 0.25, value: 0.5 } }] } },
|
|
537
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['3'] } }, { 'Chart.Data': { start: 0.5, value: 0.75 } }] } },
|
|
538
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['4'] } }, { 'Chart.Data': { start: 0.75, value: 0.5 } }] } },
|
|
539
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['5'] } }, { 'Chart.Data': { start: 0.5, value: 1.0 } }] } }
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
]
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
$('#example').content(chart);</code></pre>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
</div>
|
|
551
|
+
|
|
552
|
+
<!-- Area Styling -->
|
|
553
|
+
<div class="card bg-base-200" style="margin-bottom: 2rem;">
|
|
554
|
+
<div class="card-body">
|
|
555
|
+
<h2 class="card-title">Area Styling</h2>
|
|
556
|
+
<p class="text-sm" style="opacity: 0.7; margin-bottom: 1rem;">
|
|
557
|
+
Customize area appearance with CSS custom properties.
|
|
558
|
+
</p>
|
|
559
|
+
|
|
560
|
+
<!-- Tabs -->
|
|
561
|
+
<script>
|
|
562
|
+
window.switchStyledAreaTab = (tabId) => {
|
|
563
|
+
const tabs = ['tagged', 'vdom', 'object'];
|
|
564
|
+
tabs.forEach(t => {
|
|
565
|
+
const tabEl = document.getElementById(`styled-area-tab-btn-${t}`);
|
|
566
|
+
const contentEl = document.getElementById(`styled-area-syntax-${t}`);
|
|
567
|
+
if (t === tabId) {
|
|
568
|
+
tabEl.classList.add('syntax-tab-active');
|
|
569
|
+
contentEl.style.display = 'block';
|
|
570
|
+
} else {
|
|
571
|
+
tabEl.classList.remove('syntax-tab-active');
|
|
572
|
+
contentEl.style.display = 'none';
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
</script>
|
|
577
|
+
<div role="tablist" class="syntax-tabs" style="margin-bottom: 1rem;">
|
|
578
|
+
<button id="styled-area-tab-btn-tagged" role="tab" class="syntax-tab syntax-tab-active"
|
|
579
|
+
onclick="switchStyledAreaTab('tagged')">Tagged</button>
|
|
580
|
+
<button id="styled-area-tab-btn-vdom" role="tab" class="syntax-tab"
|
|
581
|
+
onclick="switchStyledAreaTab('vdom')">vDOM</button>
|
|
582
|
+
<button id="styled-area-tab-btn-object" role="tab" class="syntax-tab"
|
|
583
|
+
onclick="switchStyledAreaTab('object')">Object DOM</button>
|
|
584
|
+
</div>
|
|
585
|
+
|
|
586
|
+
<!-- Tagged Syntax -->
|
|
587
|
+
<div id="styled-area-syntax-tagged">
|
|
588
|
+
<pre><script>
|
|
589
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
590
|
+
at: document.currentScript.parentElement,
|
|
591
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
592
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
593
|
+
type: 'module',
|
|
594
|
+
minHeight: 250,
|
|
595
|
+
autoRun: true
|
|
596
|
+
});
|
|
597
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
598
|
+
const { tags, $ } = Lightview;
|
|
599
|
+
const { Chart } = tags;
|
|
600
|
+
|
|
601
|
+
const chart = Chart({
|
|
602
|
+
type: 'area',
|
|
603
|
+
labels: true,
|
|
604
|
+
style: 'width: 100%; max-width: 600px; height: 250px; margin: 0 auto; --color: rgba(116, 128, 255, 0.6);'
|
|
605
|
+
},
|
|
606
|
+
Chart.Body({},
|
|
607
|
+
Chart.Row({}, Chart.Label({}, 'Mon'), Chart.Data({ start: 0.2, value: 0.5 })),
|
|
608
|
+
Chart.Row({}, Chart.Label({}, 'Tue'), Chart.Data({ start: 0.5, value: 0.7 })),
|
|
609
|
+
Chart.Row({}, Chart.Label({}, 'Wed'), Chart.Data({ start: 0.7, value: 0.4 })),
|
|
610
|
+
Chart.Row({}, Chart.Label({}, 'Thu'), Chart.Data({ start: 0.4, value: 0.8 })),
|
|
611
|
+
Chart.Row({}, Chart.Label({}, 'Fri'), Chart.Data({ start: 0.8, value: 0.6 }))
|
|
612
|
+
)
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
$('#example').content(chart);</code></pre>
|
|
616
|
+
</div>
|
|
617
|
+
|
|
618
|
+
<!-- vDOM Syntax -->
|
|
619
|
+
<div id="styled-area-syntax-vdom" style="display: none;">
|
|
620
|
+
<pre><script>
|
|
621
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
622
|
+
at: document.currentScript.parentElement,
|
|
623
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
624
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
625
|
+
type: 'module',
|
|
626
|
+
minHeight: 250
|
|
627
|
+
});
|
|
628
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
629
|
+
const { tags, $ } = Lightview;
|
|
630
|
+
const { Chart } = tags;
|
|
631
|
+
|
|
632
|
+
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
|
|
633
|
+
const data = [[0.2, 0.5], [0.5, 0.7], [0.7, 0.4], [0.4, 0.8], [0.8, 0.6]];
|
|
634
|
+
|
|
635
|
+
const chart = {
|
|
636
|
+
tag: Chart,
|
|
637
|
+
attributes: {
|
|
638
|
+
type: 'area',
|
|
639
|
+
labels: true,
|
|
640
|
+
style: 'width: 100%; max-width: 600px; height: 250px; margin: 0 auto; --color: rgba(116, 128, 255, 0.6);'
|
|
641
|
+
},
|
|
642
|
+
children: [
|
|
643
|
+
{
|
|
644
|
+
tag: Chart.Body,
|
|
645
|
+
children: days.map((day, i) => ({
|
|
646
|
+
tag: Chart.Row,
|
|
647
|
+
children: [
|
|
648
|
+
{ tag: Chart.Label, children: [day] },
|
|
649
|
+
{ tag: Chart.Data, attributes: { start: data[i][0], value: data[i][1] } }
|
|
650
|
+
]
|
|
651
|
+
}))
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
$('#example').content(chart);</code></pre>
|
|
657
|
+
</div>
|
|
658
|
+
|
|
659
|
+
<!-- Object DOM Syntax -->
|
|
660
|
+
<div id="styled-area-syntax-object" style="display: none;">
|
|
661
|
+
<pre><script>
|
|
662
|
+
examplify(document.currentScript.nextElementSibling, {
|
|
663
|
+
at: document.currentScript.parentElement,
|
|
664
|
+
scripts: ['/lightview.js', '/lightview-x.js'],
|
|
665
|
+
styles: ['https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.min.css'],
|
|
666
|
+
type: 'module',
|
|
667
|
+
minHeight: 250
|
|
668
|
+
});
|
|
669
|
+
</script><code contenteditable="true">await import('/components/data-display/chart.js');
|
|
670
|
+
const { $ } = Lightview;
|
|
671
|
+
|
|
672
|
+
const chart = {
|
|
673
|
+
Chart: {
|
|
674
|
+
type: 'area',
|
|
675
|
+
labels: true,
|
|
676
|
+
style: 'width: 100%; max-width: 600px; height: 250px; margin: 0 auto; --color: rgba(116, 128, 255, 0.6);',
|
|
677
|
+
children: [
|
|
678
|
+
{
|
|
679
|
+
'Chart.Body': {
|
|
680
|
+
children: [
|
|
681
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Mon'] } }, { 'Chart.Data': { start: 0.2, value: 0.5 } }] } },
|
|
682
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Tue'] } }, { 'Chart.Data': { start: 0.5, value: 0.7 } }] } },
|
|
683
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Wed'] } }, { 'Chart.Data': { start: 0.7, value: 0.4 } }] } },
|
|
684
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Thu'] } }, { 'Chart.Data': { start: 0.4, value: 0.8 } }] } },
|
|
685
|
+
{ 'Chart.Row': { children: [{ 'Chart.Label': { children: ['Fri'] } }, { 'Chart.Data': { start: 0.8, value: 0.6 } }] } }
|
|
686
|
+
]
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
$('#example').content(chart);</code></pre>
|
|
694
|
+
</div>
|
|
695
|
+
</div>
|
|
696
|
+
</div>
|
|
697
|
+
|
|
698
|
+
</div>
|
|
699
|
+
</div>
|
|
700
|
+
</div>
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|