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

46
demo/data/bar.ts Normal file
View File

@ -0,0 +1,46 @@
import type { Option } from "../../src/types";
import { DEMO_TEXT_STYLE } from "../constants";
function random(): number {
return Math.round(300 + Math.random() * 700) / 10;
}
export default function getData(): Option {
const option = {
textStyle: { ...DEMO_TEXT_STYLE },
dataset: {
dimensions: ["Product", "2015", "2016", "2017"],
source: [
{
Product: "Matcha Latte",
2015: random(),
2016: random(),
2017: random(),
},
{
Product: "Milk Tea",
2015: random(),
2016: random(),
2017: random(),
},
{
Product: "Cheese Cocoa",
2015: random(),
2016: random(),
2017: random(),
},
{
Product: "Walnut Brownie",
2015: random(),
2016: random(),
2017: random(),
},
],
},
xAxis: { type: "category" },
yAxis: {},
series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }],
} satisfies Option;
return option;
}