Articles in this section
Category / Section

How to customize the label text dynamically in PivotChart?

1 min read

This KB illustrates that how to customize the label text dynamically in PivotChart.

Solution:

You can customize the label text value by using axesLabelRendering event. Refer to the following code examples.

JavaScript

$("#PivotChart1").ejPivotChart({url: "../wcf/OlapChartService.svc", axesLabelRendering: " OnCustomLabel" });
function OnCustomLabel(args) {
if (args.Label.Value == 0)
  args.Label.Text = "AUS";
else
  args.Label.Text = "ME";
}

 

ASP

<ej:PivotChart ID="PivotChart1" runat="server" Url="../wcf/OlapChartService.svc">
<ClientSideEvents  AxesLabelRendering="OnCustomLabel"/></ej:PivotChart>
<script type="text/javascript">
function OnCustomLabel(args) {
if (args.Label.Value == 0)
  args.Label.Text = "AUS"; 
else
  args.Label.Text = "ME";
}
<script/>

 

MVC

@Html.EJ().Pivot().PivotChart("PivotChart1").Url(Url.Content("~/wcf/OlapChartService.svc")).ClientSideEvents(clientSideEvent => clientSideEvent.AxesLabelRendering("OnCustomLabel"))
<script type="text/javascript">
function OnCustomLabel(args) {
if (args.Label.Value == 0)
  args.Label.Text = "AUS";
else
  args.Label.Text = "ME";
}
<script/>

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied