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