Toggle between Pivot Grid and Pivot Chart

Hi,

Is there a built in mechanism to "toggle" between the default chart type and the grid?  Using the "Chart" toolbar button forces you to choose the specific chart type.


Regards,

Adrian.


1 Reply

MM Manikandan Murugesan Syncfusion Team November 11, 2021 12:23 PM UTC

Hi Adrian, 
 
Kindly refer to the following code example to toggle between Table and Chart by using external button click. 
 
Code Example: 
<SfPivotView TValue="ProductDetails" @ref="pivot" ShowFieldList="true" ShowToolbar="true" Toolbar="@toolbar" AllowConditionalFormatting="true" AllowPdfExport="true" AllowExcelExport="true"> 
    <PivotViewDisplayOption Primary="@primary" View=View.Both></PivotViewDisplayOption> 
    <PivotChartSettings><PivotChartSeries Type="ChartSeriesType.Column"></PivotChartSeries></PivotChartSettings> 
</SfPivotView> 
 
    public Primary primary = Primary.Table; 
 
    public void ToggleView(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) 
    { 
        if (primary == Primary.Chart) 
        { 
            primary = Primary.Table; 
        } 
        else 
        { 
            primary = Primary.Chart; 
        } 
    } 
 
Meanwhile, we have prepared a sample for your reference. Please find it from below link. 

Please let us know if you have any concerns. 
 
Regards, 
Manikandan 


Loader.
Up arrow icon