docs: improve demo

This commit is contained in:
Justineo
2024-06-29 00:20:14 +08:00
committed by GU Yiling
parent fc53aee8a7
commit 861674352b
12 changed files with 54 additions and 69 deletions

View File

@ -111,9 +111,7 @@ watch(codeOpen, open => {
</aside> </aside>
<aside class="codegen"> <aside class="codegen">
<button @click="openCodegen"> <button @click="openCodegen"> <code>import</code> Codegen</button>
<code>import</code> Codegen <span class="badge">beta</span>
</button>
</aside> </aside>
<code-gen v-model:open="codeOpen" :renderer="initOptions.renderer" /> <code-gen v-model:open="codeOpen" :renderer="initOptions.renderer" />
@ -447,15 +445,6 @@ select {
align-items: center; align-items: center;
padding: 0 4px; padding: 0 4px;
gap: 4px; gap: 4px;
.badge {
display: block;
padding: 2px 3px;
font-size: 10px;
background: #36485e54;
color: #fff;
border-radius: 4px;
}
} }
} }

View File

@ -15,15 +15,16 @@ const c1 = {
fontWeight: 300 fontWeight: 300
}, },
legend: { legend: {
top: 20, top: "3%",
data: ["scatter"] data: ["scatter"]
}, },
tooltip: { tooltip: {
formatter: "{c}" formatter: "{c}"
}, },
grid: { grid: {
top: "26%", top: "30%",
bottom: "26%" right: "18%",
bottom: "20%"
}, },
xAxis: { xAxis: {
type: "value", type: "value",
@ -40,7 +41,8 @@ const c1 = {
visualMap: [ visualMap: [
{ {
realtime: false, realtime: false,
left: "right", right: "2%",
bottom: "3%",
selectedMode: "multiple", selectedMode: "multiple",
dimension: 2, dimension: 2,
selected: [], selected: [],
@ -67,15 +69,16 @@ const c2 = {
fontWeight: 300 fontWeight: 300
}, },
legend: { legend: {
top: 20, top: "3%",
data: ["scatter"] data: ["scatter"]
}, },
tooltip: { tooltip: {
formatter: "{c}" formatter: "{c}"
}, },
grid: { grid: {
top: "26%", top: "30%",
bottom: "26%" right: "18%",
bottom: "20%"
}, },
xAxis: { xAxis: {
type: "value", type: "value",
@ -91,7 +94,8 @@ const c2 = {
}, },
visualMap: [ visualMap: [
{ {
left: "right", right: "2%",
bottom: "3%",
selectedMode: "multiple", selectedMode: "multiple",
dimension: 2, dimension: 2,
selected: [], selected: [],

View File

@ -408,6 +408,7 @@ export default function getData() {
text: "Air quality of major cities in China", text: "Air quality of major cities in China",
subtext: "data from PM25.in", subtext: "data from PM25.in",
sublink: "http://www.pm25.in", sublink: "http://www.pm25.in",
top: "5%",
left: "center", left: "center",
textStyle: { textStyle: {
color: "#fff" color: "#fff"
@ -418,9 +419,9 @@ export default function getData() {
}, },
legend: { legend: {
orient: "vertical", orient: "vertical",
y: "bottom", right: "5%",
x: "right", bottom: "5%",
data: ["pm2.5"], data: ["PM2.5"],
textStyle: { textStyle: {
color: "#fff" color: "#fff"
} }
@ -438,11 +439,13 @@ export default function getData() {
itemStyle: { itemStyle: {
areaColor: "#323c48", areaColor: "#323c48",
borderColor: "#111" borderColor: "#111"
} },
top: "20%",
bottom: "7%"
}, },
series: [ series: [
{ {
name: "pm2.5", name: "PM2.5",
type: "scatter", type: "scatter",
coordinateSystem: "geo", coordinateSystem: "geo",
data: convertData(data), data: convertData(data),

View File

@ -6,6 +6,7 @@ export default function getData() {
}, },
title: { title: {
text: "Traffic Sources", text: "Traffic Sources",
top: "5%",
left: "center" left: "center"
}, },
tooltip: { tooltip: {
@ -14,7 +15,8 @@ export default function getData() {
}, },
legend: { legend: {
orient: "vertical", orient: "vertical",
left: "left", top: "5%",
left: "5%",
data: ["Direct", "Email", "Ad Networks", "Video Ads", "Search Engines"] data: ["Direct", "Email", "Ad Networks", "Video Ads", "Search Engines"]
}, },
series: [ series: [

View File

@ -13,13 +13,17 @@ export default function getData() {
fontWeight: 300 fontWeight: 300
}, },
title: { title: {
text: "Dual Numeric Axis" text: "Dual Numeric Axis",
top: "5%",
left: "5%"
}, },
legend: { legend: {
data: ["line"] data: ["line"],
top: "6%"
}, },
polar: { polar: {
center: ["50%", "54%"] radius: "65%",
center: ["50%", "56%"]
}, },
tooltip: { tooltip: {
trigger: "axis", trigger: "axis",

View File

@ -15,37 +15,17 @@ export const useScoreStore = defineStore("store", () => {
return scores.value.map(({ name }) => name); return scores.value.map(({ name }) => name);
}); });
const scoreRadar = computed(() => { function getRadarData(activeIndex: number) {
return { return {
title: { title: {
text: "Player Ability" text: "Player Ability",
top: "5%",
left: "5%"
}, },
textStyle: { textStyle: {
fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif', fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif',
fontWeight: 300 fontWeight: 300
}, },
radar: {
indicator: scores.value.map(({ name, max }) => {
return { name, max };
})
},
series: [
{
name: "Value",
type: "radar",
data: [{ value: scores.value.map(({ value }) => value) }]
}
]
};
});
function getRadarData(activeIndex: number) {
return {
animation: false,
title: {
text: "Player Ability"
},
tooltip: {},
radar: { radar: {
indicator: scores.value.map(({ name, max }, index) => { indicator: scores.value.map(({ name, max }, index) => {
if (index === activeIndex) { if (index === activeIndex) {
@ -81,7 +61,6 @@ export const useScoreStore = defineStore("store", () => {
return { return {
scores, scores,
metrics, metrics,
scoreRadar,
getRadarData, getRadarData,
increase, increase,
isMax, isMax,

View File

@ -47,15 +47,21 @@ const data = [
export default function getData() { export default function getData() {
return { return {
grid: {
top: "25%"
},
textStyle: { textStyle: {
fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif', fontFamily: 'Inter, "Helvetica Neue", Arial, sans-serif',
fontWeight: 300 fontWeight: 300
}, },
title: { title: {
text: "Life Expectancy vs. GDP by country" text: "Life Expectancy vs. GDP by country",
top: "5%",
left: "5%"
}, },
legend: { legend: {
right: 10, top: "6%",
right: "5%",
data: ["1990", "2015"] data: ["1990", "2015"]
}, },
xAxis: { xAxis: {

View File

@ -46,10 +46,8 @@ watch(
</template> </template>
<template #extra> <template #extra>
<p class="actions"> <p class="actions">
<label> <input id="connected-check" type="checkbox" v-model="connected" />
<input type="checkbox" v-model="connected" /> <label for="connected-check">Connected</label>
Connected
</label>
</p> </p>
</template> </template>
</v-example> </v-example>

View File

@ -49,7 +49,6 @@ defineProps({
width: calc(60vw + 4em); width: calc(60vw + 4em);
height: 360px; height: 360px;
max-width: 720px; max-width: 720px;
padding: 1.5em 2em;
border: 1px solid rgba(0, 0, 0, 0.1); border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 8px; border-radius: 8px;
box-shadow: 0 0 45px rgba(0, 0, 0, 0.2); box-shadow: 0 0 45px rgba(0, 0, 0, 0.2);
@ -75,7 +74,6 @@ defineProps({
width: 100%; width: 100%;
min-width: 0; min-width: 0;
height: 60vw; height: 60vw;
padding: 1em 0;
border: none; border: none;
border-radius: 0; border-radius: 0;
box-shadow: none; box-shadow: none;
@ -88,7 +86,6 @@ defineProps({
.echarts { .echarts {
width: 28vw; width: 28vw;
min-width: 240px; min-width: 240px;
padding: 1em 1.5em;
height: 180px; height: 180px;
} }

View File

@ -50,6 +50,8 @@ onMounted(() => {
} }
}, },
visualMap: { visualMap: {
bottom: "3%",
left: "3%",
max: 40, max: 40,
calculable: true, calculable: true,
realtime: false, realtime: false,

View File

@ -46,6 +46,7 @@ function load() {
}, },
title: { title: {
text: "World Flights", text: "World Flights",
top: "5%",
left: "center", left: "center",
textStyle: { textStyle: {
color: "#eee" color: "#eee"
@ -62,8 +63,10 @@ function load() {
}, },
geo: { geo: {
map: "world", map: "world",
left: 0, top: "15%",
right: 0, right: "5%",
bottom: "5%",
left: "5%",
silent: true, silent: true,
itemStyle: { itemStyle: {
borderColor: "#003", borderColor: "#003",

View File

@ -58,10 +58,8 @@ const style = computed(() => {
<option :value="null">Default</option> <option :value="null">Default</option>
<option value="dark">Dark</option> <option value="dark">Dark</option>
</select> </select>
<label> <input id="loading-check" type="checkbox" v-model="loading" />
<input type="checkbox" v-model="loading" /> <label for="loading-check">Loading</label>
Loading
</label>
</p> </p>
</template> </template>
</v-example> </v-example>