feat: revamp demo

This commit is contained in:
Justineo
2025-09-24 01:27:35 +08:00
committed by GU Yiling
parent 1da2bf7811
commit def0ad5bf5
47 changed files with 4180 additions and 1740 deletions

78
demo/data/connect.ts Normal file
View File

@ -0,0 +1,78 @@
import type { Option } from "../../src/types";
import { DEMO_TEXT_STYLE } from "../constants";
const POINT_COUNT = 16;
const SYMBOL_COUNT = 6;
function createScatterData(): Array<[number, number, number, number]> {
return Array.from({ length: POINT_COUNT }, () => [
Math.random() * 5,
Math.random() * 4,
Math.random() * 12,
Math.round(Math.random() * (SYMBOL_COUNT - 1)),
]);
}
const BASE_DATA = createScatterData();
function createOption(data: Array<[number, number, number, number]>): Option {
return {
textStyle: { ...DEMO_TEXT_STYLE },
legend: {
top: "3%",
data: ["scatter"],
},
tooltip: {
formatter: "{c}",
},
grid: {
top: "30%",
right: "18%",
bottom: "20%",
},
xAxis: {
type: "value",
splitLine: {
show: false,
},
},
yAxis: {
type: "value",
splitLine: {
show: false,
},
},
visualMap: [
{
realtime: false,
right: "2%",
bottom: "3%",
selectedMode: "multiple",
dimension: 2,
selected: [],
min: 0,
max: 18,
precision: 0,
splitNumber: 0,
calculable: true,
},
],
series: [
{
name: "scatter",
type: "scatter",
symbolSize: 30,
data,
},
],
} satisfies Option;
}
export default function getData(): [Option, Option] {
const options: [Option, Option] = [
createOption(BASE_DATA),
createOption(BASE_DATA),
];
return options;
}