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.
Unfortunately, activation email could not send to your email. Please try again.

How to excel export the chart of more than one category.

Thread ID:





127362 Nov 10,2016 03:44 AM Nov 14,2016 06:55 AM ASP.NET MVC 3
Tags: Chart
Asked On November 10, 2016 03:44 AM

I'm very grateful to you.
I'm currently implementing the excel export function of the chart.
but, I don't know how to excel export the chart of more than one category.
What should I do?

Framework: ASP.NET MVC5

* View
 <button onclick="download()">download</button>
 <div id="chart"></div>
 $(function ($) {
 function init() {
         series: [
                 name: "category1",
                 points: [
                     { x: 1, y: 2 },
                     { x: 2, y: 5 }
                 xName: "X",
                 yName: "Y"
                 name: "category2",
                 points: [
                     { x: 1, y: 3 },
                     { x: 2, y: 6 }
                 xName: "X",
                 yName: "Y"
 function download() {
     var chart = $("#chart").ejChart("instance");
     chart.model.exportSettings.fileName = "Chart";
     chart.model.exportSettings.orientation = "portrait";
     chart.model.exportSettings.action = "/Home/ExportChart";
     chart.model.exportSettings.type = "xlsx";
     chart.model.exportSettings.mode = "server";
     chart.model.exportSettings.multipleExport = false;
     return true;

* Controller
 public void ExportChart(string Data, string ChartModel)
     ChartProperties obj = ConvertChartObject(ChartModel);
     string type = obj.ExportSettings.Type.ToString().ToLower();
     string fileName = obj.ExportSettings.FileName;
     string orientation = obj.ExportSettings.Orientation.ToString();
     List<ExportChartData> chartData = new List<ExportChartData>();
     ExcelExport exp = new ExcelExport();
     exp.Export(obj, chartData, fileName + ".xlsx", ExcelVersion.Excel2010, null, null);
 public class ExportChartData
     public ExportChartData(string x, string y)
         this.X = x; this.Y = y;
     public string X { get; set; }
     public string Y { get; set; }

* Export Chart Example

Anandaraj T [Syncfusion]
Replied On November 11, 2016 08:17 AM

Hi Yuta, 

Thanks for using Syncfusion products. 

We have created a sample with the code snippet provided by you, it works fine for exporting multiple series (category). The sample can be downloaded from the following link 
1)      Excel version (or higher) provided in export action method should be present in the client machine to open the excel worksheet. In your code snippet, Excel 2010 version is specified. 

2)      Excel exporting does not depend upon the number of series (category) or data points. The same code (ExportChart method) can be used for exporting charts with different configurations to excel worksheet. 

Chart in exported excel file 

Could you please let us know the version of Essential Studio you are using ? We will let you know if there are any changes to the above code in specified version. 

Please let us know if you have any concern. 


Replied On November 12, 2016 09:02 AM


Thank you for the advice and sample.
I was misunderstanding.
I was emptying "chartData" for inquiries (whitout "chartData.Add(..)") , but in fact it was unnecessary.
When I ran it as it was, it was the expected behavior.
Thank you very much.

Akbar Basha K M [Syncfusion]
Replied On November 14, 2016 06:55 AM

Hi Yuta, 
Most Welcome. Please let us know if you need any further assistance on this. 
Akbar Basha KM. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.