• English
  • chartType

    area-by-order-date

    Area Chart - Sales trend by date

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "area",
              "dimensions": [
                {
                  "field": "order_date",
                  "alias": "Order Date"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "yAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('line'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    bar-by-product-type

    Bar Chart - Sales by product type

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "bar",
              "dimensions": [
                {
                  "field": "product_type",
                  "alias": "Product Type"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "xAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('column'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    chart-type-switching

    Switch between line and bar chart types

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "line",
              "dimensions": [
                {
                  "field": "province",
                  "alias": "Province"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "yAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('columnParallel'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    column-by-area

    Column Chart - Sales by region

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "column",
              "dimensions": [
                {
                  "field": "area",
                  "alias": "Region"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "yAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('bar'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    donut-by-customer-type

    Donut Chart - Sales share by customer type

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "donut",
              "dimensions": [
                {
                  "field": "customer_type",
                  "alias": "Customer Type"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "size",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('pie'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    line-by-province

    Line Chart - Sales trend by province

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "line",
              "dimensions": [
                {
                  "field": "province",
                  "alias": "Province"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "yAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('area'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    line-chart

    Line Chart - Sales trend by province

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "line",
              "dimensions": [
                {
                  "field": "province",
                  "alias": "Province"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "yAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('area'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    pie-by-area

    Pie Chart - Sales share by region

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "pie",
              "dimensions": [
                {
                  "field": "area",
                  "alias": "Region"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "size",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('donut'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    pie-chart-measure-encoding

    Pie Chart Measure Encoding - Test measure-encoding.ts Pie chart type

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "pie",
              "dimensions": [
                {
                  "field": "product_type",
                  "alias": "Product Type"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "angle",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('pie'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    rose-by-city

    Rose Chart - Sales by city

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "rose",
              "dimensions": [
                {
                  "field": "city",
                  "alias": "City"
                }
              ],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "size",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('pie'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    scatter-chart-measure-encoding

    Scatter Chart Measure Encoding - Test measure-encoding.ts Scatter chart type

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "scatter",
              "dimensions": [],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "xAxis"
                },
                {
                  "field": "profit",
                  "alias": "Profit",
                  "encoding": "yAxis"
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('scatter'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }

    scatter-sales-profit

    Scatter Chart - Relationship between Sales and Profit

    Loading...
    import { VBI, VBIChartBuilder } from '@visactor/vbi'
    import { DEMO_CONNECTOR_ID, VSeedRender } from '@components'
    import { useEffect, useState } from 'react'
    
    export default () => {
      const [result, setResult] = useState<any>(null)
    
      useEffect(() => {
        const run = async () => {
          const builder = VBI.chart.create({
            ...{
              "connectorId": "demoSupermarket",
              "chartType": "scatter",
              "dimensions": [],
              "measures": [
                {
                  "field": "sales",
                  "alias": "Sales",
                  "encoding": "xAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                },
                {
                  "field": "profit",
                  "alias": "Profit",
                  "encoding": "yAxis",
                  "aggregate": {
                    "func": "sum"
                  }
                }
              ],
              "whereFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "havingFilter": {
                "id": "root",
                "op": "and",
                "conditions": []
              },
              "theme": "light",
              "locale": "en-US",
              "version": 1,
              "limit": 10
            },
            connectorId: DEMO_CONNECTOR_ID,
          })
          const applyBuilder = (builder: VBIChartBuilder) => { builder.chartType.changeChartType('bar'); }
          applyBuilder(builder)
          setResult(await builder.buildVSeed())
        }
        run()
      }, [])
    
      if (!result) return <div>Loading...</div>
    
      return <VSeedRender vseed={result} />
    }