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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show legend in stock chart like Line chart?

Thread ID:





151212 Feb 4,2020 06:29 AM UTC Feb 5,2020 12:37 PM UTC ASP.NET MVC - EJ 2 1
Tags: Stock Chart
Asked On February 4, 2020 06:29 AM UTC

I read the docs, but seem no way to do it!?

Srihari Muthukaruppan [Syncfusion]
Replied On February 5, 2020 12:37 PM UTC

Hi Gin, 
We have analyzed your query. From that, we would like to let you know that as of now we do not have support for legend in stock chart. Hence we suggest you to use the below workaround solution to achieve your requirement. we have hidden the series on click of div element and made visible on the second click to achieve the legend behavior based on your requirement.  Please find below sample and code snippet,  

Code Snippet: 
    <div id="content" align="center" style="width: 80px; padding: 5px; height: 150; position:relative"> 
        <table style="width: 100%"> 
            <tr id="legend-series"> 
                <td><div id="first" style="width: 15px; height: 2px; background:skyblue"></div></td> 
    var data = window.aapl; 
    var firstClick = true; 
    document.getElementById('content').onclick = function (e) { 
        if (firstClick) { 
            var id = document.getElementById("container_stockChart_chart_Series_0"); 
            id.style.visibility = "hidden" 
            firstClick = !firstClick; 
        } else { 
            var id = document.getElementById("container_stockChart_chart_Series_0"); 
            id.style.visibility = "visible" 
            firstClick = !firstClick; 
Before Click: 
After Click: 

Let us know if you have any concerns. 

Srihari M 


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.

Please sign in to access our forum

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

Live Chat Icon For mobile
Live Chat Icon