How to customize the label text dynamically in PivotChart?
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/>