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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to embed a dashboard file either from local disk or remote link as Web Service or Web API

Platform: Dashboard Platform |
Control: Dashboard SDK |
Published Date: February 14, 2018 |
Last Revised Date: February 6, 2019

By using the following three different formats, you can give the path of the dashboard file to the Dashboard Viewer:

  1. To render the Dashboard, which is placed (or saved) at your local disk, in your web application, give the path of the dashboard file as input to the Dashboard Viewer.

 

Refer to the following code snippet:

 

$("#dashboard").ejDashboardViewer({

    serviceUrl: 'http://localhost:58087/DashboardService.svc',

    dashboardPath: 'E:\\Dashboards\\WorldWideCarSalesDashboard.sydx' //Both the dashboard file and dashboard service are in same (local) machine.

});

 

  1. To render the Dashboard, which is placed in the remote machine and configured as downloadable link, in your web application, give the HTTP link of the dashboard file to the Dashboard Viewer.

 

Refer to the following code snippet:

 

$("#dashboard").ejDashboardViewer({

  serviceUrl: 'https://dashboardsdkdemo.syncfusion.com/DashboardService/DashboardService.svc',

  dashboardPath: 'https://dashboardsdkdemo.syncfusion.com//Dashboards//Northwind Products and Suppliers.sydx'  // Public link, which should download the dashboard file at given Dashboard Service URL.

});

 

 

  1. To render the Dashboard, which is served from a web service (or Web API), in your web application, give the web service link as dashboard file path to the Dashboard Viewer.

For example, the web service has the following code snippet to download the Dashboard file:

 

   public FileContentResult Download () 

        { 

           FileContentResult result       = new FileContentResult(System.IO.File.ReadAllBytes("E:\\ Dashboards\\ WorldWideCarSalesDashboard.sydx"), "application/octet-stream") 

           { 

               FileDownloadName = "WorldWideCarSalesDashboard.sydx"                

           }; 

            return result; 

        }

 

 

And, refer to the code snippet of the Dashboard Viewer side as follows:

 

  $("#dashboard").ejDashboardViewer({

        serviceUrl: 'http://localhost:58087/DashboardService.svc',

        dashboardPath: 'http://localhost:58753/home/Download' //Public link, which should download the dashboard file at given Dashboard Service URL.

  });

 

 

ADD COMMENT
You must log in to leave a comment
Comments
Bennie Janse van Rensburg
Feb 05, 2019

Hi, I get has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.


how do I solve this?

Reply
Mehala Palanisamy [Syncfusion]
Feb 06, 2019

Hi Bennie,

We can reproduce the reported problem in our end when using the serviceUrl in "http". Please modify the serviceUrl and dashboardPath in "https" format. Also we have modified the serviceUrl and dashboardPath in this KB documentation.

Refer the below example code in the place of Dashboard Viewer instance creation in your application.  

  $("#dashboard").ejDashboardViewer({  

        serviceUrl:  'https://dashboardsdkdemo.syncfusion.com/DashboardService/DashboardService.svc',  

        dashboardPath: 'https://dashboardsdkdemo.syncfusion.com//Dashboards//Northwind Products and Suppliers.sydx' // Public link, which should download the dashboard file at given Dashboard Service URL.  

    });  

   

  



Thanks 
Mehala 
Reply
Mehala Palanisamy [Syncfusion]
Feb 06, 2019

Hi Bennie,

Sorry for the inconvenience,

Use below modifed serviceUrl and dashboardPath link instead of previous update.

Refer the below example code in the place of Dashboard Viewer instance creation in your application.  

  $("#dashboard").ejDashboardViewer({  

        serviceUrl:  'https://dashboardsdk.syncfusion.com/DashboardService/DashboardService.svc',  

        dashboardPath: 'https://dashboardsdk.syncfusion.com//Dashboards//Northwind Products and Suppliers.sydx' // Public link, which should download the dashboard file at given Dashboard Service URL.  

    });  

   

  



Thanks 
Mehala 

Please sign in to access our KB

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

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