mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-11-06 13:09:50 +08:00
chore: improve demo
This commit is contained in:
@ -44,6 +44,7 @@
|
||||
"comment-mark": "^1.1.1",
|
||||
"core-js": "^3.32.0",
|
||||
"echarts": "^5.4.3",
|
||||
"echarts-gl": "^2.0.9",
|
||||
"echarts-liquidfill": "^3.1.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
|
||||
17
pnpm-lock.yaml
generated
17
pnpm-lock.yaml
generated
@ -67,6 +67,9 @@ devDependencies:
|
||||
echarts:
|
||||
specifier: ^5.4.3
|
||||
version: 5.4.3
|
||||
echarts-gl:
|
||||
specifier: ^2.0.9
|
||||
version: 2.0.9(echarts@5.4.3)
|
||||
echarts-liquidfill:
|
||||
specifier: ^3.1.0
|
||||
version: 3.1.0(echarts@5.4.3)
|
||||
@ -3318,6 +3321,10 @@ packages:
|
||||
resolution: {integrity: sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==}
|
||||
dev: true
|
||||
|
||||
/claygl@1.3.0:
|
||||
resolution: {integrity: sha512-+gGtJjT6SSHD2l2yC3MCubW/sCV40tZuSs5opdtn79vFSGUgp/lH139RNEQ6Jy078/L0aV8odCw8RSrUcMfLaQ==}
|
||||
dev: true
|
||||
|
||||
/clean-css@5.3.2:
|
||||
resolution: {integrity: sha512-JVJbM+f3d3Q704rF4bqQ5UUyTtuJ0JRKNbTKVEeujCCBoMdkEi+V+e8oktO9qGQNSvHrFTM6JZRXrUvGR1czww==}
|
||||
engines: {node: '>= 10.0'}
|
||||
@ -4094,6 +4101,16 @@ packages:
|
||||
engines: {node: '>=6.0.0'}
|
||||
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):
|
||||
resolution: {integrity: sha512-5Dlqs/jTsdTUAsd+K5LPLLTgrbbNORUSBQyk8PSy1Mg2zgHDWm83FmvA4s0ooNepCJojFYRITTQ4GU1UUSKYLw==}
|
||||
peerDependencies:
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
<geo-chart />
|
||||
<radar-chart />
|
||||
<connect-chart />
|
||||
<gl-chart />
|
||||
<manual-chart />
|
||||
|
||||
<footer>
|
||||
@ -65,6 +66,7 @@ import ScatterChart from "./examples/ScatterChart";
|
||||
import GeoChart from "./examples/GeoChart";
|
||||
import RadarChart from "./examples/RadarChart";
|
||||
import ConnectChart from "./examples/ConnectChart";
|
||||
import GlChart from "./examples/GlChart";
|
||||
import ManualChart from "./examples/ManualChart";
|
||||
|
||||
use([CanvasRenderer, SVGRenderer]);
|
||||
@ -137,6 +139,7 @@ h2 {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin-bottom: 3em;
|
||||
color: #7f8c8d;
|
||||
@ -158,6 +161,7 @@ p small {
|
||||
p {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
pre {
|
||||
display: inline-block;
|
||||
padding: 0.8em;
|
||||
@ -171,16 +175,6 @@ code {
|
||||
font-family: "Roboto Mono", Monaco, courier, monospace;
|
||||
}
|
||||
|
||||
pre code {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.attr {
|
||||
color: #e96900;
|
||||
}
|
||||
.val {
|
||||
color: #42b983;
|
||||
}
|
||||
footer {
|
||||
margin: 5em 0 3em;
|
||||
font-size: 0.5em;
|
||||
@ -200,16 +194,16 @@ footer {
|
||||
border-bottom: 3px solid #42b983;
|
||||
}
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
border: 1px solid #4fc08d;
|
||||
border-radius: 2em;
|
||||
border-radius: 0.5em;
|
||||
background-color: #fff;
|
||||
color: #42b983;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
padding: 0 0.5em;
|
||||
transition: opacity 0.3s;
|
||||
transition: all 0.2s;
|
||||
|
||||
&:focus {
|
||||
@ -228,33 +222,6 @@ select {
|
||||
opacity: 0.5;
|
||||
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 {
|
||||
@ -276,7 +243,7 @@ button,
|
||||
label,
|
||||
select {
|
||||
font-size: 0.75em;
|
||||
height: 2.4em;
|
||||
height: 2em;
|
||||
}
|
||||
|
||||
figure {
|
||||
@ -369,9 +336,9 @@ figure {
|
||||
flex: 1 0;
|
||||
margin: 0 0.5em;
|
||||
padding: 0;
|
||||
line-height: 2.4em;
|
||||
line-height: 2em;
|
||||
max-width: 40vw;
|
||||
border-radius: 2px;
|
||||
border-radius: 0.5em;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
@ -384,6 +351,7 @@ figure {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
figure {
|
||||
width: 100vw;
|
||||
margin: 1em auto;
|
||||
@ -399,18 +367,16 @@ figure {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.renderer {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
|
||||
button {
|
||||
float: left;
|
||||
position: relative;
|
||||
width: 64px;
|
||||
border-radius: 6px;
|
||||
border-color: #36485e;
|
||||
color: rgba(54, 72, 94, 0.8);
|
||||
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'
|
||||
/* eslint-enable */
|
||||
import logo from "../assets/Vue-ECharts.svg";
|
||||
|
||||
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>
|
||||
|
||||
<template>
|
||||
<v-example id="connect" title="Connectable Charts" split>
|
||||
<v-example id="connect" title="Connectable charts" split>
|
||||
<template #start>
|
||||
<v-chart :option="c1" group="radiance" autoresize />
|
||||
</template>
|
||||
|
||||
@ -2,20 +2,10 @@
|
||||
<h2 :id="id">
|
||||
<a :href="`#${id}`">
|
||||
{{ title }}
|
||||
<small v-if="desc"
|
||||
><slot v-if="$slots.desc" /><template v-else>{{
|
||||
desc
|
||||
}}</template></small
|
||||
>
|
||||
<small v-if="desc">{{ desc }}</small>
|
||||
</a>
|
||||
<button
|
||||
class="round"
|
||||
:class="{ expand }"
|
||||
@click="expand = !expand"
|
||||
aria-label="toggle"
|
||||
></button>
|
||||
</h2>
|
||||
<section v-if="expand">
|
||||
<section>
|
||||
<figure v-if="!split">
|
||||
<slot />
|
||||
</figure>
|
||||
@ -31,25 +21,19 @@
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "v-example",
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
desc: String,
|
||||
split: Boolean
|
||||
<script setup>
|
||||
import { defineProps } from "vue";
|
||||
|
||||
defineProps({
|
||||
id: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
expand: true
|
||||
};
|
||||
}
|
||||
};
|
||||
title: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
desc: String,
|
||||
split: Boolean
|
||||
});
|
||||
</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-options="loadingOptions"
|
||||
style="background-color: #003"
|
||||
manual-update
|
||||
/>
|
||||
<template #desc
|
||||
>You may use <code>manual-update</code> prop for performance critical use
|
||||
cases.</template
|
||||
>
|
||||
<template #extra>
|
||||
<p>
|
||||
You may use the <code>manual-update</code> prop for performance critical
|
||||
use cases.
|
||||
</p>
|
||||
<p>
|
||||
<button :disabled="loaded" @click="load">Load</button>
|
||||
</p>
|
||||
|
||||
@ -19,8 +19,7 @@ module.exports = {
|
||||
.rule("svg")
|
||||
.clear()
|
||||
.test(/\.svg$/)
|
||||
.use("raw-loader")
|
||||
.loader("raw-loader");
|
||||
.type("asset/source");
|
||||
|
||||
config.plugin("define").tap(([options]) => [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user