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.
Syncfusion Feedback

Hide legend

Thread ID:

Created:

Updated:

Platform:

Replies:

118781 Apr 9,2015 05:40 AM Apr 14,2015 07:49 AM JavaScript 3
loading
Tags: ejChart
kalpa serashiya
Asked On April 9, 2015 05:40 AM

Hello,

In Multiline syncfusion chart, if series data name is null or empty then I want to hide this data and legend also,how??

  e.g.

Suppose I have ,

Series:[{  type:'line',

name='',

datasource:data.open,

},

type:'line',

name='Product A',

datasource:data.close,

}

}]


In above e.g. series[0] contains no name (blank name) so chart take legend as'series1' , In such a case I want to hide the legend and its corresponding values on chart.






Praveen [Syncfusion]
Replied On April 10, 2015 07:50 AM

Hi Kalpa serashiya,
Thanks for using Syncfusion product.
Currently there is no support to hide the visibility of the legend while series name is empty in chart. We would like to inform you that we have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We request you to visit our website periodically to know more about the feature update.

Query #1: series [0] contains no name (blank name) so chart take legend as'series1' , In such a case I want to hide the legend and its corresponding values on chart.

Response: We have analyzed your query and there is no way to directly achieve this .So we have hide the visibility of the legend while series name is empty in chart by using triggering events of ‘preRender’ and ‘loaded. The prerender event is used to hidden the series visibility and loaded event remove the legend from DOM. Right now we have removed the legend from DOM element but the legend item space calculated to render legenditmes willnot be removed. The following code snippet shows this,

[JS]

function series(sender)

{

for (var i = 0; i < sender.model.series.length; i++)

{

if(sender.model.series[i].name=="")

sender.model.series[i].visibility = "hidden";

}

}

function legend(sender)

{

for (var i = 0; i < sender.model.series.length; i++)

{

if (sender.model.series[i].name == "")

{

$("#" + this._id + "_svg_Legend" + i).remove();

}

}

}



Screen Shot:



We have preapared a sample for your convenience and it can be downloaded from the below link.

Sample : LegendHide.zip

Please let us know if you have any concern.

Thanks,
Praveenkumar


kalpa serashiya
Replied On April 13, 2015 01:24 AM

Hello,
Thank you.
Now my issue is resolved.

Praveen [Syncfusion]
Replied On April 14, 2015 07:49 AM

Hi Kalpa serashiya,
Thanks for your update.
Kindly let us know if you face any difficulties.

Thanks,
Praveenkumar.

CONFIRMATION

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.

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

;