Print and Export

17 Feb 20226 minutes to read

The rendered stock chart can be exported to JPEG, PNG, SVG, or PDF format using the export dropdown button in the period selector toolbar. You can choose the required format using the export dropdown button in stock-chart.

The rendered stock chart can be printed directly using print button in period selector toolbar.

<script src="~/financial-data.js"></script>

            @(Html.EJS().StockChart("container").Title("AAPL Stock Price")
                    .PrimaryXAxis(xaxis =>xaxis.MajorGridLines(mg=>mg.Color("transparent")))
                    .PrimaryYAxis(yaxis =>yaxis.MajorTickLines(mt=>mt.Color("transparent").Width(0))
                    .LineStyle(ls=>ls.Color("transparent")))
                                                                .Series(sr =>
                                                                {
                                                                    sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Candle).DataSource("data").Add();
                                                                })
                                                                .Render())

    <script>
        var data = window.chartData;
    </script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers.StockChart
{
    public partial class StockChartController : Controller
    {
        public IActionResult Default()
        {
            return View();
        }
    }
}

Disable Export and print

To empty the value of ExportType for to disable the Export button.

<script src="~/financial-data.js"></script>

            @Html.EJS().StockChart("container").Title("AAPL Stock Price").ExportType(new List<Object>() { })
                    .PrimaryXAxis(xaxis =>xaxis.MajorGridLines(mg=>mg.Color("transparent")))
                    .PrimaryYAxis(yaxis =>yaxis.MajorTickLines(mt=>mt.Color("transparent").Width(0))
                    .LineStyle(ls=>ls.Color("transparent")))
                                                                .Series(sr =>
                                                                {
                                                                    sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Candle).DataSource("data").Add();
                                                                })
                                                                .Render()

    <script>
        var data = window.chartData;
    </script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace EJ2CoreSampleBrowser.Controllers.StockChart
{
    public partial class StockChartController : Controller
    {
        public IActionResult Default()
        {
            return View();
        }
    }
}