AG Studio is an embedded analytics component for building interactive dashboards. The minimum setup is a single data source and a blank canvas.
1. Install Copy Link
Install the ag-studio-angular package from npm:
npm install ag-studio-angular 2. Create Studio Copy Link
Studio works with arrays of plain objects, where each array becomes a data source.
Add the AgStudio standalone component to your template inside a sized parent (it automatically fills the available space) and set mode to "edit" so users can build and modify reports:
import { Component } from '@angular/core';
import { AgStudio } from 'ag-studio-angular';
// Data to display in Studio (can also be loaded asynchronously)
const productData = [
{
productName: 'Printer',
category: 'Printing & Imaging',
brand: 'CleanSlate Office',
listPrice: 109.09,
unitCost: 92.26,
},
{
productName: 'Notebook',
category: 'Paper & Notebooks',
brand: 'PaperLine',
listPrice: 24.70,
unitCost: 14.19,
},
{
productName: 'Highlighters',
category: 'Writing Instruments',
brand: 'PaperLine',
listPrice: 10.34,
unitCost: 5.03,
},
// ... more rows
];
@Component({
selector: 'app-root',
standalone: true,
imports: [AgStudio],
template: `
<div style="height: 100%; width: 100%">
<ag-studio [data]="data" mode="edit"></ag-studio>
</div>
`,
})
export class AppComponent {
data = {
sources: [{
id: 'products',
data: productData,
}],
};
} 3. Run your app Copy Link
The result is an empty AG Studio component that users can begin building reports with:
import { Component } from "@angular/core";
import { AgStudio } from "ag-studio-angular";
import {
AgDataEngine,
AgDataSourcesDefinition,
AgStudioApi,
AgStudioApiReadyEvent,
AgStudioMode,
AgStudioProperties,
enableStudioDevValidations,
} from "ag-studio";
if (process.env.NODE_ENV !== "production") {
// Enable extended validations only for development
enableStudioDevValidations();
}
@Component({
selector: "my-app",
standalone: true,
imports: [AgStudio],
template: `<div style="display: flex; flex-direction: column; height: 100%">
<ag-studio
style="width: 100%; height: 100%;"
class="my-studio-container"
[data]="data"
[mode]="mode"
/>
</div> `,
})
export class AppComponent {
data: AgDataSourcesDefinition | AgDataEngine = {
sources: [
{
id: "products",
data: productData,
},
],
};
mode: AgStudioMode = "edit";
}
const productData = [
{
productName: "Printer",
category: "Printing & Imaging",
brand: "CleanSlate Office",
listPrice: 109.09,
unitCost: 92.26,
},
{
productName: "Notebook",
category: "Paper & Notebooks",
brand: "PaperLine",
listPrice: 24.7,
unitCost: 14.19,
},
{
productName: "Highlighters",
category: "Writing Instruments",
brand: "PaperLine",
listPrice: 10.34,
unitCost: 5.03,
},
// ... more rows
];
import '@angular/compiler';
import { provideHttpClient } from '@angular/common/http';
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component.ts';
const app = bootstrapApplication(AppComponent, {
providers: [provideHttpClient()],
});