Print and Export

17 Feb 20224 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.

<ejs-stockchart id="stockchart" load="stockload" title="AAPL Stock Price">
                <e-stockchart-series-collection>
                    <e-stockchart-series type='Candle' xName="x"> </e-stockchart-series>
                </e-stockchart-series-collection>
                <e-stockchart-primaryxaxis>
                    <e-majorgridlines color="transparent"></e-majorgridlines>
                </e-stockchart-primaryxaxis>
                <e-stockchart-primaryyaxis>
                    <e-linestyle color="transparent"></e-linestyle>
                    <e-majorticklines color="transparent" width="0"></e-majorticklines>
                </e-stockchart-primaryyaxis>
            </ejs-stockchart>

    <script src="~/scripts/chart/financial-data.js"></script>
    <script>
        var data = chartData;
        function stockload(args) {
            args.stockChart.series[0].dataSource = data;
        }
    </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.

<ejs-stockchart id="stockchart" load="stockload" title="AAPL Stock Price" exportType="new List<Object>() { }">
                <e-stockchart-series-collection>
                    <e-stockchart-series type='Candle' xName="x"> </e-stockchart-series>
                </e-stockchart-series-collection>
                <e-stockchart-primaryxaxis>
                    <e-majorgridlines color="transparent"></e-majorgridlines>
                </e-stockchart-primaryxaxis>
                <e-stockchart-primaryyaxis>
                    <e-linestyle color="transparent"></e-linestyle>
                    <e-majorticklines color="transparent" width="0"></e-majorticklines>
                </e-stockchart-primaryyaxis>
            </ejs-stockchart>
        </div>

    <script src="~/scripts/chart/financial-data.js"></script>
    <script>
        var data = chartData;
        function stockload(args) {
            args.stockChart.series[0].dataSource = data;
        }
    </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();
        }
    }
}