ASP.NET MVC
<input type="button" value="Excel Export" onclick="excelExport()" />
function excelExport() {
chart = $("#container").ejChart("instance");
exporting = chart.model.exportSettings;
exporting.fileName = "Chart";
exporting.orientation = "portrait";
exporting.angle = 0;
exporting.action = "ExportChart"
exporting.type ="xlsx";
exporting.mode = "server";
chart.export();
}
//Controller
public void ExportChart(string Data, string ChartModel)
{
//...
} |
ASP.NET MVC:
<div id="tooltipTemplate" style="display: none;background-color:white;border:1px solid black; padding:5px">
#point.x#<br />#point.y#
</div>
@(Html.EJ().Chart("container")
//...
.Series(sr =>
{
sr .Tooltip(tl => tl.Visible(true).Template("tooltipTemplate")) .Add();
})
)
|
[JS]
function excelExport() { //button click event triggered
chart = $("#container").ejChart("instance");
chart.export('xlsx', 'ExportChart', true);
}
[CS]
// ..
foreach (string chartProperty in ChartModel)
{
// ..
if (count > 1)
exp.Export((obj as ChartProperties), (IEnumerable)chartData, "Export.xlsx",
ExcelVersion.Excel2010, export, this.mainWork, MultipleExportType.AppendToSheet, null, null);
else
this.mainWork = exp.Export((obj as ChartProperties), (IEnumerable)chartData, "Export.xlsx",
ExcelVersion.Excel2010, true, null, null);
export = (count == (len - 1)) ? false : true;
} |