# spreadsheet-editor-chart

> Spreadsheet editor visualizing data using chart feature by comparing the GDP of different countries with various years.

**Framework:** vue  **Component:** SpreadsheetEditor  **Variant:** chart

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/vue/spreadsheet-editor-chart.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-spreadsheet
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/spreadsheet-editor-chart/SpreadSheetEditor.vue

```vue
<template>
  <div class="control-section">
    <div id="spreadsheet-chart">
        <ejs-spreadsheet ref="spreadsheet" :openUrl="openUrl" :saveUrl="saveUrl" :created="created">
            <e-sheets>
                <e-sheet :name="GDP">
                    <e-rows>
                        <e-row :height="height" :cells="cells1"></e-row>
                        <e-row :height="height" :cells="cells2"></e-row>
                    </e-rows>
                <e-ranges>
                        <e-range :dataSource="dataSource" startCell="A3" ></e-range>
                </e-ranges>
                    <e-columns>
                        <e-column :width=80></e-column>
                        <e-column :width=75></e-column>
                        <e-column :width=75></e-column>
                        <e-column :width=75></e-column>
                        <e-column :width=75></e-column>
                    </e-columns>
                </e-sheet>
            </e-sheets>
        </ejs-spreadsheet>
    </div>
  </div>
</template>
<script>
import { SpreadsheetComponent, RowDirective, RowsDirective, SheetDirective, SheetsDirective, RangeDirective, RangesDirective, ColumnDirective, ColumnsDirective, getFormatFromType } from "@syncfusion/ej2-vue-spreadsheet";
import { GDPData } from '../datasource/spreadsheet-editor-data';

export default {
   components: {
    'ejs-spreadsheet': SpreadsheetComponent,
    'e-row': RowDirective,
    'e-rows': RowsDirective,
    'e-sheet': SheetDirective,
    'e-sheets': SheetsDirective,
    'e-range': RangeDirective,
    'e-ranges': RangesDirective,
    'e-column': ColumnDirective,
    'e-columns': ColumnsDirective
   },  
   data: () => {
    return {
        height: 30,
        GDP:"GDP",
        dataSource: GDPData,
        cells1: [
        { value: 'Gross Domestic Product (in trillions)', style: { backgroundColor: '#e56590', color: '#fff',
            fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' }}
        ],
        cells2: [
        { index: 6, chart: [{ type: 'Column', range: 'A3:E10' }] }
        ],
         openUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/open',
         saveUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/save'
    }
  },
  methods: {
    created: function() {
        var spreadsheet = this.$refs.spreadsheet;
           // Formatting cells dynamically using cellFormat method
             spreadsheet.cellFormat({ backgroundColor: '#e56590', color: '#fff', fontWeight: 'bold', textAlign: 'center' }, 'A3:E3');
             // Applying currency format to the specified range.
             spreadsheet.numberFormat('$#,##0.00', 'B4:E10');
             // Merging the cells from A1 to E1
             spreadsheet.merge('A1:E1');
            }
        }
}
</script>
```
