{
console.group(`selected ${vseed.chartType}`)
console.log('builder', builderRef.current)
console.log('spec', builderRef.current?.spec)
console.log('vseed', builderRef.current?.vseed)
console.log('advancedVSeed', builderRef.current?.advancedVSeed)
console.groupEnd()
}}
>
)
}
export default Demo
```
--------------------------------
### Register All Chart Types with Builder
Source: https://context7.com/visactor/vseed/llms.txt
The `registerAll` function is essential for making all available chart types and themes accessible to the Builder. It must be called before initializing any Builder instances to ensure full functionality.
```typescript
import { registerAll, Builder } from '@visactor/vseed'
// Register all chart types (required)
registerAll()
// Now you can use any chart type
const lineChart = Builder.from({
chartType: 'line',
dataset: [
{ month: 'Jan', value: 100 },
{ month: 'Feb', value: 150 },
{ month: 'Mar', value: 120 }
],
dimensions: [{ id: 'month', alias: 'Month', encoding: 'xAxis' }],
measures: [{ id: 'value', alias: 'Value', encoding: 'yAxis' }]
})
const spec = lineChart.build()
```
--------------------------------
### Column Percent Chart Configuration
Source: https://github.com/visactor/vseed/blob/main/apps/website/docs/zh-CN/galley/chartType/columnPercent.mdx
Defines the configuration for a basic Column Percent Chart. It requires a chart type and a dataset. The dataset contains numerical values for different categories over time.
```json
{
"chartType": "columnPercent",
"dataset": [
{ "date": "2019", "profit": 10, "sales": 20 },
{ "date": "2020", "profit": 30, "sales": 60 },
{ "date": "2021", "profit": 30, "sales": 60 },
{ "date": "2022", "profit": 50, "sales": 100 },
{ "date": "2023", "profit": 40, "sales": 80 }
]
}
```
--------------------------------
### Basic Line Chart Configuration (JSON)
Source: https://github.com/visactor/vseed/blob/main/apps/website/docs/zh-CN/galley/chartType/line.mdx
This JSON configuration defines a basic line chart. It specifies the chart type and the dataset, which includes date and corresponding profit and sales values. This is suitable for simple time-series data visualization.
```json
{
"chartType": "line",
"dataset": [
{ "date": "2019", "profit": 10, "sales": 20 },
{ "date": "2020", "profit": 30, "sales": 60 },
{ "date": "2021", "profit": 30, "sales": 60 },
{ "date": "2022", "profit": 50, "sales": 100 },
{ "date": "2023", "profit": 40, "sales": 80 }
]
}
```
--------------------------------
### Log VSeed Builder Properties
Source: https://github.com/visactor/vseed/blob/main/apps/website/docs/zh-CN/playground/vquery.mdx
Logs the current state of the VSeed builder, including its spec, vseed data, and advancedVSeed configuration to the console. This is useful for debugging and inspecting the builder's internal state.
```javascript
console.log('builder', builderRef.current)
console.log('spec', builderRef.current.spec)
console.log('vseed', builderRef.current.vseed)
console.log('advancedVSeed', builderRef.current.advancedVSeed)
console.groupEnd()
```
--------------------------------
### Import ScatterLinear Component
Source: https://github.com/visactor/vseed/blob/main/apps/website/docs/zh-CN/galley/regressionLine/linear.mdx
Demonstrates how to import the ScatterLinear component from the @components library. This component is likely used for creating scatter plot visualizations with linear scaling.
```typescript
import { ScatterLinear } from '@components'
```
--------------------------------
### Convert Query DSL to SQL (TypeScript)
Source: https://context7.com/visactor/vseed/llms.txt
Converts type-safe query DSL objects into SQL strings, specifically designed for DuckDB execution. This utility enhances type safety and simplifies query construction by abstracting the SQL syntax. It supports various clauses like select, where, groupBy, orderBy, and limit, and can be used with generic types for schema definition.
```typescript
import { convertDSLToSQL } from '@visactor/vquery'
interface Order {
id: number
name: string
age: number
department: string
active: number
}
// Simple grouping query
const sql = convertDSLToSQL