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