- Home
- Forum
- Angular - EJ 2
- Need to customize legend styling
Need to customize legend styling
Hello,
Attachment: bug_6ac01411.zip
I am using @syncfusion-ej2-angular-charts version 17.3.30. I want to style the legend based on certain condition. The styling works through chrome developer tools, however I am not able to convert it to a class which I could apply to the legend. One would suggest to set legendSettings visibility to false but I don't want to hide it here, but set the display to none. I've attached two images, one with styling through dev tools and one without.
Thank you !
Attachment: bug_6ac01411.zip
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
SM
Srihari Muthukaruppan
Syncfusion Team
October 15, 2020 10:38 AM UTC
Hi Ryan,
We have analysed your query. From that, we would like to let you know that we have customised the legend group using css as shown in the below code snippet. We have also attached the sample for your reference. Please find the sample, code snippet and screenshot below.
Code Snippet:
|
App.component.css:
.block {
display: block;
}
.none {
display: none;
}
App.component.html:
// add your additional code here
<button ejs-button cssClass="e-info" (click)="onChange($event)" style="text-transform:none !important">
Hide Legend </button>
// add your additional code here
App.component.ts:
public onChange(e: Event): void {
if (this.click) {
document.getElementById("chartcontainer_chart_legend_g_0").setAttribute("class", "none");
} else {
document.getElementById("chartcontainer_chart_legend_g_0").setAttribute("class", "block");
}
this.click = !this.click;
}
// add your additional code here |
Screenshot:
Before Click:
After click:
If still this is not your exact requirement, kindly provide us with more information, which will be helpful in further analysis and provide you the solution sooner.
Regards,
Srihari
Marked as answer
RY
Ryan
October 16, 2020 04:51 AM UTC
Hello,
This solved my problem. I now have a class to manipulate the legend.
Thanks !!
SM
Srihari Muthukaruppan
Syncfusion Team
October 16, 2020 01:15 PM UTC
Hi Ryan,
Most welcome. Kindly get in touch with us, if you would require further assistance. We are always happy in assisting you.
Thanks,
Srihari M
SIGN IN To post a reply.