)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to render multiple PivotCharts on the same page in MVC?

Platform: ASP.NET MVC |
Control: PivotChart |
Published Date: January 27, 2015 |
Last Revised Date: July 2, 2019
Tags: olap, mvc, ejolapchart

This KB illustrates that how to render multiple PivotCharts on the same page in MVC.

Solution

You can render multiple PivotCharts on the same page in MVC by using the following code examples.

MVC

@Html.EJ().Pivot().PivotChart("PivotChart1").Url("../wcf/OlapChartService.svc").CommonSeriesOptions(comm => { comm.Type(SeriesType.Column).Tooltip(tool => { tool.Visible(true); }); }).Size(size => size.Height("460px").Width("950px")).PrimaryXAxis(primaryXAxis => primaryXAxis.Title(title => title.Text("Fiscal Year")).LabelRotation(0)).PrimaryYAxis(primaryYAxis => primaryYAxis.Title(title => title.Text("Customer Count"))).Legend(legend => legend.Visible(true).RowCount(2)).ClientSideEvents(
                           oEve => { oEve.BeforeServiceInvoke("beforeServiceCall"); })
<script type="text/javascript">
    $(function () {
        var isValid = true;
        $(document).ajaxSuccess(function (event, xhr, settings) {
            if ($.parseJSON(settings.data).action == "initialize" && isValid) {
                var interval = setInterval(function () {
                    if ($("#PivotChart1").find("svg").length > 0) {
                        isValid = false;
                        $("#PivotChart2").ejPivotChart({
                            url: "/wcf/OlapChartService.svc", beforeServiceInvoke: "beforeServiceCall"
                        });
                        clearInterval(interval);
                    }
                }, 500);
            }
        });
    });
    function beforeServiceCall(e) {
        this.model.customObject = e.element[0].id
    }
</script>

 

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon