Skip to content

Question: Is there a toolbar for SfChart? #168

@scott-david-walker

Description

@scott-david-walker

I want to create a simplistic dashboard where you can add or remove charts. This gives a nice prototype for dragging and dropping but there doesn't appear to be any option for a toolbar or manu item specific for these charts?

Could somebody confirm this or maybe I'm missing something :-)

Thanks

Scott

Activity

G-Durga

G-Durga commented on Feb 13, 2025

@G-Durga

Scott,

Greetings from Syncfusion.

You can achieve your requirement by dynamically adding and removing panels in the Syncfusion Blazor Dashboard Layout using the AddPanelAsync and RemovePanelAsync methods. These methods allow you to add new panels and remove existing ones by specifying the panel ID.

Please check the sample below, where we have implemented adding and removing panels through button clicks.

<SfButton CssClass="e-primary" Content="Add Panel" @onclick="AddClick"></SfButton> <SfButton CssClass="e-primary" Content="Remove Panel" @onclick="RemoveClick"></SfButton> public async Task RemoveClick() { if (this.Count > 0) { string panelId = this.Count.ToString() + "_layout"; await dashboardObject.RemovePanelAsync(panelId); this.Count--; } } public async Task AddClick() { this.Count = this.Count + 1; string HeaderText = "Panel " + this.Count.ToString(); PanelModel panel = new PanelModel { Id = this.Count.ToString() + "_layout", SizeX = 2, SizeY = 2, Row = 0, Column = 0, Enabled = true, Header = @<div>@HeaderText</div>, Content =@<SfChart> <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"> </ChartPrimaryXAxis> <ChartSeriesCollection> <ChartSeries DataSource="@Sales" XName="Month" YName="SalesValue" Type="Syncfusion.Blazor.Charts.ChartSeriesType.Column"> </ChartSeries> </ChartSeriesCollection> </SfChart> }; await dashboardObject.AddPanelAsync(panel); }

Sample : https://blazorplayground.syncfusion.com/hZBoXLCABAbuIINa

UG : https://blazor.syncfusion.com/documentation/dashboard-layout/getting-started#panels-with-components

kmuthukumarmkm

kmuthukumarmkm commented on Jul 3, 2025

@kmuthukumarmkm
Collaborator

The reported query appears to be addressed in the latest update. Could you please confirm if everything works as expected? Closing for now, but feel free to reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @scott-david-walker@gsumankumar@rajendranr-5483@kmuthukumarmkm@G-Durga

        Issue actions

          Question: Is there a toolbar for SfChart? · Issue #168 · syncfusion/blazor-samples