mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-11-07 05:28:06 +08:00
chore: improve demo
This commit is contained in:
@ -44,6 +44,7 @@
|
|||||||
"comment-mark": "^1.1.1",
|
"comment-mark": "^1.1.1",
|
||||||
"core-js": "^3.32.0",
|
"core-js": "^3.32.0",
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
|
"echarts-gl": "^2.0.9",
|
||||||
"echarts-liquidfill": "^3.1.0",
|
"echarts-liquidfill": "^3.1.0",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-prettier": "^3.4.1",
|
"eslint-plugin-prettier": "^3.4.1",
|
||||||
|
|||||||
17
pnpm-lock.yaml
generated
17
pnpm-lock.yaml
generated
@ -67,6 +67,9 @@ devDependencies:
|
|||||||
echarts:
|
echarts:
|
||||||
specifier: ^5.4.3
|
specifier: ^5.4.3
|
||||||
version: 5.4.3
|
version: 5.4.3
|
||||||
|
echarts-gl:
|
||||||
|
specifier: ^2.0.9
|
||||||
|
version: 2.0.9(echarts@5.4.3)
|
||||||
echarts-liquidfill:
|
echarts-liquidfill:
|
||||||
specifier: ^3.1.0
|
specifier: ^3.1.0
|
||||||
version: 3.1.0(echarts@5.4.3)
|
version: 3.1.0(echarts@5.4.3)
|
||||||
@ -3318,6 +3321,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==}
|
resolution: {integrity: sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/claygl@1.3.0:
|
||||||
|
resolution: {integrity: sha512-+gGtJjT6SSHD2l2yC3MCubW/sCV40tZuSs5opdtn79vFSGUgp/lH139RNEQ6Jy078/L0aV8odCw8RSrUcMfLaQ==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/clean-css@5.3.2:
|
/clean-css@5.3.2:
|
||||||
resolution: {integrity: sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==}
|
resolution: {integrity: sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==}
|
||||||
engines: {node: '>= 10.0'}
|
engines: {node: '>= 10.0'}
|
||||||
@ -4094,6 +4101,16 @@ packages:
|
|||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/echarts-gl@2.0.9(echarts@5.4.3):
|
||||||
|
resolution: {integrity: sha512-oKeMdkkkpJGWOzjgZUsF41DOh6cMsyrGGXimbjK2l6Xeq/dBQu4ShG2w2Dzrs/1bD27b2pLTGSaUzouY191gzA==}
|
||||||
|
peerDependencies:
|
||||||
|
echarts: ^5.1.2
|
||||||
|
dependencies:
|
||||||
|
claygl: 1.3.0
|
||||||
|
echarts: 5.4.3
|
||||||
|
zrender: 5.4.4
|
||||||
|
dev: true
|
||||||
|
|
||||||
/echarts-liquidfill@3.1.0(echarts@5.4.3):
|
/echarts-liquidfill@3.1.0(echarts@5.4.3):
|
||||||
resolution: {integrity: sha512-5Dlqs/jTsdTUAsd+K5LPLLTgrbbNORUSBQyk8PSy1Mg2zgHDWm83FmvA4s0ooNepCJojFYRITTQ4GU1UUSKYLw==}
|
resolution: {integrity: sha512-5Dlqs/jTsdTUAsd+K5LPLLTgrbbNORUSBQyk8PSy1Mg2zgHDWm83FmvA4s0ooNepCJojFYRITTQ4GU1UUSKYLw==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
<geo-chart />
|
<geo-chart />
|
||||||
<radar-chart />
|
<radar-chart />
|
||||||
<connect-chart />
|
<connect-chart />
|
||||||
|
<gl-chart />
|
||||||
<manual-chart />
|
<manual-chart />
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
@ -65,6 +66,7 @@ import ScatterChart from "./examples/ScatterChart";
|
|||||||
import GeoChart from "./examples/GeoChart";
|
import GeoChart from "./examples/GeoChart";
|
||||||
import RadarChart from "./examples/RadarChart";
|
import RadarChart from "./examples/RadarChart";
|
||||||
import ConnectChart from "./examples/ConnectChart";
|
import ConnectChart from "./examples/ConnectChart";
|
||||||
|
import GlChart from "./examples/GlChart";
|
||||||
import ManualChart from "./examples/ManualChart";
|
import ManualChart from "./examples/ManualChart";
|
||||||
|
|
||||||
use([CanvasRenderer, SVGRenderer]);
|
use([CanvasRenderer, SVGRenderer]);
|
||||||
@ -137,6 +139,7 @@ h2 {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.desc {
|
.desc {
|
||||||
margin-bottom: 3em;
|
margin-bottom: 3em;
|
||||||
color: #7f8c8d;
|
color: #7f8c8d;
|
||||||
@ -158,6 +161,7 @@ p small {
|
|||||||
p {
|
p {
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.8em;
|
padding: 0.8em;
|
||||||
@ -171,16 +175,6 @@ code {
|
|||||||
font-family: "Roboto Mono", Monaco, courier, monospace;
|
font-family: "Roboto Mono", Monaco, courier, monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre code {
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.attr {
|
|
||||||
color: #e96900;
|
|
||||||
}
|
|
||||||
.val {
|
|
||||||
color: #42b983;
|
|
||||||
}
|
|
||||||
footer {
|
footer {
|
||||||
margin: 5em 0 3em;
|
margin: 5em 0 3em;
|
||||||
font-size: 0.5em;
|
font-size: 0.5em;
|
||||||
@ -200,16 +194,16 @@ footer {
|
|||||||
border-bottom: 3px solid #42b983;
|
border-bottom: 3px solid #42b983;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
button,
|
button,
|
||||||
select {
|
select {
|
||||||
border: 1px solid #4fc08d;
|
border: 1px solid #4fc08d;
|
||||||
border-radius: 2em;
|
border-radius: 0.5em;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #42b983;
|
color: #42b983;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
padding: 0 0.5em;
|
padding: 0 0.5em;
|
||||||
transition: opacity 0.3s;
|
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
@ -228,33 +222,6 @@ select {
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.round {
|
|
||||||
width: 1.6em;
|
|
||||||
height: 1.6em;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::before,
|
|
||||||
&::after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
width: 9px;
|
|
||||||
height: 1px;
|
|
||||||
background-color: #42b983;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
width: 1px;
|
|
||||||
height: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.expand::after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
@ -276,7 +243,7 @@ button,
|
|||||||
label,
|
label,
|
||||||
select {
|
select {
|
||||||
font-size: 0.75em;
|
font-size: 0.75em;
|
||||||
height: 2.4em;
|
height: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
@ -369,9 +336,9 @@ figure {
|
|||||||
flex: 1 0;
|
flex: 1 0;
|
||||||
margin: 0 0.5em;
|
margin: 0 0.5em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
line-height: 2.4em;
|
line-height: 2em;
|
||||||
max-width: 40vw;
|
max-width: 40vw;
|
||||||
border-radius: 2px;
|
border-radius: 0.5em;
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,6 +351,7 @@ figure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
figure {
|
figure {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
margin: 1em auto;
|
margin: 1em auto;
|
||||||
@ -399,18 +367,16 @@ figure {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.renderer {
|
.renderer {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
button {
|
button {
|
||||||
float: left;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 64px;
|
width: 64px;
|
||||||
border-radius: 6px;
|
|
||||||
border-color: #36485e;
|
border-color: #36485e;
|
||||||
color: rgba(54, 72, 94, 0.8);
|
color: rgba(54, 72, 94, 0.8);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
|||||||
BIN
src/demo/assets/starfield.jpg
Normal file
BIN
src/demo/assets/starfield.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 901 KiB |
BIN
src/demo/assets/world.jpg
Normal file
BIN
src/demo/assets/world.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
@ -1,6 +1,4 @@
|
|||||||
/* eslint-disable */
|
import logo from "../assets/Vue-ECharts.svg";
|
||||||
import logo from '../assets/Vue-ECharts.svg'
|
|
||||||
/* eslint-enable */
|
|
||||||
|
|
||||||
const d = logo.match(/\bd="([^"]+)"/)[1];
|
const d = logo.match(/\bd="([^"]+)"/)[1];
|
||||||
|
|
||||||
|
|||||||
1
src/demo/data/population.json
Normal file
1
src/demo/data/population.json
Normal file
File diff suppressed because one or more lines are too long
@ -37,7 +37,7 @@ watch(
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<v-example id="connect" title="Connectable Charts" split>
|
<v-example id="connect" title="Connectable charts" split>
|
||||||
<template #start>
|
<template #start>
|
||||||
<v-chart :option="c1" group="radiance" autoresize />
|
<v-chart :option="c1" group="radiance" autoresize />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -2,20 +2,10 @@
|
|||||||
<h2 :id="id">
|
<h2 :id="id">
|
||||||
<a :href="`#${id}`">
|
<a :href="`#${id}`">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
<small v-if="desc"
|
<small v-if="desc">{{ desc }}</small>
|
||||||
><slot v-if="$slots.desc" /><template v-else>{{
|
|
||||||
desc
|
|
||||||
}}</template></small
|
|
||||||
>
|
|
||||||
</a>
|
</a>
|
||||||
<button
|
|
||||||
class="round"
|
|
||||||
:class="{ expand }"
|
|
||||||
@click="expand = !expand"
|
|
||||||
aria-label="toggle"
|
|
||||||
></button>
|
|
||||||
</h2>
|
</h2>
|
||||||
<section v-if="expand">
|
<section>
|
||||||
<figure v-if="!split">
|
<figure v-if="!split">
|
||||||
<slot />
|
<slot />
|
||||||
</figure>
|
</figure>
|
||||||
@ -31,10 +21,10 @@
|
|||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
export default {
|
import { defineProps } from "vue";
|
||||||
name: "v-example",
|
|
||||||
props: {
|
defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
@ -45,11 +35,5 @@ export default {
|
|||||||
},
|
},
|
||||||
desc: String,
|
desc: String,
|
||||||
split: Boolean
|
split: Boolean
|
||||||
},
|
});
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
expand: true
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
109
src/demo/examples/GlChart.vue
Normal file
109
src/demo/examples/GlChart.vue
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<script setup>
|
||||||
|
import { use } from "echarts/core";
|
||||||
|
import { Bar3DChart } from "echarts-gl/charts";
|
||||||
|
import { VisualMapComponent } from "echarts/components";
|
||||||
|
import { GlobeComponent } from "echarts-gl/components";
|
||||||
|
import { shallowRef, onMounted } from "vue";
|
||||||
|
import VChart from "../../ECharts";
|
||||||
|
import VExample from "./Example";
|
||||||
|
import world from "../assets/world.jpg";
|
||||||
|
import starfield from "../assets/starfield.jpg";
|
||||||
|
|
||||||
|
use([Bar3DChart, VisualMapComponent, GlobeComponent]);
|
||||||
|
|
||||||
|
const option = shallowRef();
|
||||||
|
const loading = shallowRef(true);
|
||||||
|
|
||||||
|
const initOptions = {
|
||||||
|
renderer: "canvas"
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadingOptions = {
|
||||||
|
text: "Loading...",
|
||||||
|
color: "#000",
|
||||||
|
textColor: "#fff",
|
||||||
|
maskColor: "transparent"
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
import("../data/population.json").then(({ default: data }) => {
|
||||||
|
loading.value = false;
|
||||||
|
|
||||||
|
data = data
|
||||||
|
.filter(dataItem => dataItem[2] > 0)
|
||||||
|
.map(dataItem => [dataItem[0], dataItem[1], Math.sqrt(dataItem[2])]);
|
||||||
|
|
||||||
|
option.value = {
|
||||||
|
backgroundColor: "#000",
|
||||||
|
globe: {
|
||||||
|
baseTexture: world,
|
||||||
|
heightTexture: world,
|
||||||
|
shading: "lambert",
|
||||||
|
environment: starfield,
|
||||||
|
light: {
|
||||||
|
main: {
|
||||||
|
intensity: 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
viewControl: {
|
||||||
|
autoRotate: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
visualMap: {
|
||||||
|
max: 40,
|
||||||
|
calculable: true,
|
||||||
|
realtime: false,
|
||||||
|
inRange: {
|
||||||
|
colorLightness: [0.2, 0.9]
|
||||||
|
},
|
||||||
|
textStyle: {
|
||||||
|
color: "#fff"
|
||||||
|
},
|
||||||
|
controller: {
|
||||||
|
inRange: {
|
||||||
|
color: "orange"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
outOfRange: {
|
||||||
|
colorAlpha: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
type: "bar3D",
|
||||||
|
coordinateSystem: "globe",
|
||||||
|
data: data,
|
||||||
|
barSize: 0.6,
|
||||||
|
minHeight: 0.2,
|
||||||
|
silent: true,
|
||||||
|
itemStyle: {
|
||||||
|
color: "orange"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<v-example id="gl" title="GL charts" desc="(Globe & Bar3D)">
|
||||||
|
<v-chart
|
||||||
|
:option="option"
|
||||||
|
:init-options="initOptions"
|
||||||
|
autoresize
|
||||||
|
:loading="loading"
|
||||||
|
:loading-options="loadingOptions"
|
||||||
|
style="background-color: #000"
|
||||||
|
/>
|
||||||
|
<template #extra>
|
||||||
|
<p>
|
||||||
|
You can use extension packs like
|
||||||
|
<a href="https://github.com/ecomfe/echarts-gl">ECharts-GL</a>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<small>(You can only use the canvas renderer for GL charts.)</small>
|
||||||
|
</p>
|
||||||
|
</template>
|
||||||
|
</v-example>
|
||||||
|
</template>
|
||||||
@ -98,12 +98,13 @@ function load() {
|
|||||||
:loading="loading"
|
:loading="loading"
|
||||||
:loading-options="loadingOptions"
|
:loading-options="loadingOptions"
|
||||||
style="background-color: #003"
|
style="background-color: #003"
|
||||||
|
manual-update
|
||||||
/>
|
/>
|
||||||
<template #desc
|
|
||||||
>You may use <code>manual-update</code> prop for performance critical use
|
|
||||||
cases.</template
|
|
||||||
>
|
|
||||||
<template #extra>
|
<template #extra>
|
||||||
|
<p>
|
||||||
|
You may use the <code>manual-update</code> prop for performance critical
|
||||||
|
use cases.
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button :disabled="loaded" @click="load">Load</button>
|
<button :disabled="loaded" @click="load">Load</button>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -19,8 +19,7 @@ module.exports = {
|
|||||||
.rule("svg")
|
.rule("svg")
|
||||||
.clear()
|
.clear()
|
||||||
.test(/\.svg$/)
|
.test(/\.svg$/)
|
||||||
.use("raw-loader")
|
.type("asset/source");
|
||||||
.loader("raw-loader");
|
|
||||||
|
|
||||||
config.plugin("define").tap(([options]) => [
|
config.plugin("define").tap(([options]) => [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user