Chart Legend Custom

Hi, there is a way to change legend of chart into PivotClient with OLAP Data source? Specific. Not the label of the axes but the label of the legends of the graph.
Thank you.

1 Reply

MM Manikandan Murugesan Syncfusion Team March 30, 2018 04:33 PM UTC

Hi Simone, 
 
You can customize PivotChart legend text by using RenderSuccess event in PivotClient. Please refer the below code snippet and screenshot. 
Code Snippet: 
@Html.EJ().Pivot().PivotClient("PivotClient1").Locale("en-US").Url(Url.Content("~/api/RelationalClient")).Title("PivotClient").ClientSideEvents(oEve => { oEve.RenderSuccess("setChartProperties"); }) 
 
<script> 
    function setChartProperties(args) { 
        this._pivotChart.model.legendItemRendering = function (args) { 
            if (args.data.legendItem.Text == "ME~~FY 2005~~Amount") 
                args.data.legendItem.Text = "CustomLegendText"; 
        }; 
    } 
</script> 
 
Screenshot: 
 
 
 
 
 
Please let us know I any concern. 
 
 
Thanks, 
Manikandan. 


Loader.
Up arrow icon